Skip to content

Instantly share code, notes, and snippets.

@staticf0x
Last active May 18, 2020 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save staticf0x/9a302eeb8701df88b47389abe2ccd40b to your computer and use it in GitHub Desktop.
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
#!/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