Created
August 30, 2016 17:33
-
-
Save synaptiko/46a63f46abed674cc696545b619f0413 to your computer and use it in GitHub Desktop.
Example how to use i3msg command
This file contains hidden or 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
#!/usr/bin/env bash | |
isWorkspaceFocused=$(i3-msg -t get_workspaces | jq 'map(select(.focused==true))|map(.num)|map(select(. == 10))|length' 2> /dev/null) | |
isKicktermRunning=$(i3-msg -t get_tree | jq "recurse(.nodes[]) | .window_properties | objects | .class" | grep '"Kickterm"' | wc -l 2> /dev/null) | |
if [ $isKicktermRunning -eq 0 ]; then | |
/home/jprokop/Projects/kickterm/new-i3.py >& /dev/null | |
fi | |
if [ $isWorkspaceFocused -eq 0 ]; then | |
if [ $isKicktermRunning -eq 0 ]; then | |
i3-msg "workspace 10" >& /dev/null | |
else | |
i3-msg "[class=\"Kickterm\"] focus" >& /dev/null | |
fi | |
else | |
if [ $isKicktermRunning -ne 0 ]; then | |
i3-msg "workspace 10" >& /dev/null | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires jq command as dependency.