Last active
May 18, 2020 12:20
-
-
Save staticf0x/9a302eeb8701df88b47389abe2ccd40b to your computer and use it in GitHub Desktop.
ros stands for "run or switch", a simple script to either start a program or switch to its window using wmctrl, ideal for shortcuts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PID=$(pgrep $1) | |
if [ ${PID:-null} = null ] | |
then | |
$1 & | |
else | |
wmctrl -xa $1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment