This nushell script emulates the main features of tdrop in niri:
- if the specified program is not running: launch it and focus it.
- if the specified program is already running on another workspace: focus it.
nudrop [OPTIONS] [COMMAND]
[COMMAND]
The usual command you would run to start the desired program
-c, --class
Set classname of the program to be run. Use this if the classname is different from the name of the [COMMAND] and nudrop does not have a hardcoded replacement.-a, --app-id
Set app-id of the program to be run. Use this if the app-id is different from the name of the [COMMAND] and nudrop does not have a hardcoded replacement.-i, --insensitive
Case insensitive partial matching of class names. Can work as a stopgap if a running program is not recognized and a new instance is launched instead. Note: incorrect matches may occur, adding a special handling of the program to nudrop (hardcoded or via-c, --class) is preferable.-o, --online
Delay initial launch for up to 20 seconds until internet connectivity is established.
Multiple instances of the same program can be run concurrently, if different class names are assigned to each instance. Presently, there is support for the following flags in the [COMMAND] string:
-a|--app-id(foot terminal emulator)
-c|--class(all other programs)
binds {
Mod+e { spawn "nudrop" "kitty" "--class" "kitty_1"; }
Mod+Alt+e { spawn "nudrop" "kitty" "--class" "kitty_2"; }
Mod+a { spawn "nudrop" "kitty" "--class" "kitty_hx" "hx"; }
Mod+Alt+a { spawn "nudrop" "kitty" "--class" "kitty_code"; }
}Note
Defining a class name is only necessary when running multiple instances of the same program at the same time.