Return to repo list

smartlaunch

Contextual launcher/tag shortcut methodology; intended for dwm.
Return to HMagellan.com

commit e8806feefac6f03b908363e9facc1ebf651dfcb9
parent 0f57e7d483e89f5961299605482e5ec95ece792d
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Sat, 18 Jul 2020 16:32:46 -0500

Updated README with new usage instructions

Diffstat:
MREADME | 28+++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/README b/README @@ -5,8 +5,8 @@ A method for contextually-aware rules-based application/tag view change shortcut Smartlaunch is a shell script and a set of instructions that are meant to be used in conjunction with dwm (https://dwm.suckless.org) to achieve a *certain kind of application launching behavior*. The project - consists of two parts: a script that launches a command as long as no window matching a given WM_NAME - xproperty exists, and a set of instructions and examples on how to use this script with dwm to create + consists of two parts: a script that launches a command as long as no window matching a pair of given + xproperties exists, and a set of instructions and examples on how to use this script with dwm to create keyboard shortcuts that can launch applications and then *function as quick ways to access those same application once they are already running* (for example, press MOD+F to launch Firefox, then press MOD+F again anytime to return immediately to the tag that Firefox was opened in, as long as Firefox is still there). @@ -48,20 +48,26 @@ A method for contextually-aware rules-based application/tag view change shortcut 03. Usage Instructions - smartlaunch.sh takes two arguments: a string matching all or part of a WM_NAME xproperty, and a command to launch - if that name cannot be found among existing windows. + smartlaunch.sh takes three arguments: + + $1 - A command to launch. + $2 - A string matching "WM_NAME" in the window created by the above command. + $3 - A string matching *THE FIRST FIELD* of "WM_CLASS" in the window created by the above command. Here is an example: - $ ./smartlaunch.sh Firefox firefox + $ ./smartlaunch.sh firefox Firefox firefox The above example will launch the command 'firefox' if it cannot find any existing windows who's WM_NAME contain - the string 'Firefox'. You may ask, "How do I find the WM_NAME property of a window?" The simplest way is to run - xprop(1), then click on the window you want to investigate. WM_NAME will be among the properties in the output. + the string 'Firefox' and who's WM_CLASS contains 'firefox' in the first field. You may ask, "How do I find the + WM_NAME and WM_CLASS properties of a window?" The simplest way is to run xprop(1), then click on the window you + want to investigate. Both properties will be among the text in the output. It is important to NOT confuse 'WM_NAME' + with '_NET_WM_NAME' or any similarly named property. Look only for the properties on lines beginning with 'WM_NAME' + and 'WM_CLASS'. To include the above example in dwm's config.h, create a command that looks something like this: - static const char *smartlaunchcmd[] = { "/bin/bash", "-c", "/path/to/smartlaunch.sh Firefox firefox", NULL } + static const char *smartlaunchcmd[] = { "/bin/bash", "-c", "/path/to/smartlaunch.sh firefox Firefox firefox", NULL } This can be bound to a key combination in the 'keys[]' array in config.h. For instance, to bind it to MOD+F: @@ -83,11 +89,11 @@ A method for contextually-aware rules-based application/tag view change shortcut Now, when you press the chosen key combination (MOD+F in the examples), one of two things will happen: - 1). If there is no window matching the WM_NAME in the command, a new instance of the application + 1). If there is no window matching the BOTH properties in the command, a new instance of the application will be started and the view will switch immediately to the tag associated with that application, or: - 2). If there IS a window matching the WM_NAME in the command, the view will simply switch to the tag - associated with the existing application, and nothing new will be started. + 2). If there IS a window matching BOTH of the properties in the command, the view will simply switch to + the tag associated with the existing application, and nothing new will be started. Refer to the file config.h.patch in this repository to see an example of the changes to be made to config.h to configure any given program to work with Smartlaunch.