Skip to content

Instantly share code, notes, and snippets.

@chrishoage
Created November 23, 2016 18:23
Show Gist options
  • Save chrishoage/c06b3f864dbb9e1e637206d8799d1133 to your computer and use it in GitHub Desktop.
Save chrishoage/c06b3f864dbb9e1e637206d8799d1133 to your computer and use it in GitHub Desktop.
#!/bin/bash
kwmc=$HOME/bin/kwmc
currentFocus=$($kwmc query focus-follows-mouse)
currentMouse=$($kwmc query mouse-follows-focus)
tag=$($kwmc query space active mode)
if [ "$1" = 'quit' ]; then
killall kwm
exit
fi
if [ "$1" = 'reload' ]; then
$kwmc config reload
exit
fi
if [ "$1" = 'refresh' ]; then
$kwmc space -r focused
exit
fi
if [ "$1" = 'bsp' ]; then
$kwmc space -t bsp
exit
fi
if [ "$1" = 'monocle' ]; then
$kwmc space -t monocle
exit
fi
if [ "$1" = 'float' ]; then
$kwmc space -t float
exit
fi
if [ "$1" = 'toggle-autoraise' ]; then
[[ $currentFocus = "autoraise" ]] && value="disabled" || value="autoraise"
$kwmc config focus $value
exit
fi
if [ "$1" = 'toggle-mouse-follows' ]; then
[[ $currentMouse = "on" ]] && value="off" || value="on"
$kwmc config mouse-follows-focus $value
exit
fi
echo "kwm $tag | dropdown=false"
echo "---";
echo "BSP | bash=$0 param1=bsp terminal=false"
echo "Monocle | bash=$0 param1=monocle terminal=false"
echo "Floating | bash=$0 param1=float terminal=false"
echo "---"
[[ $currentFocus = "autoraise" ]] && focus="Disable" || focus="Enable"
echo "$focus Focus Follows Mouse | bash=$0 param1=toggle-autoraise terminal=false"
[[ $currentMouse = "on" ]] && mouse="Disable" || mouse="Enable"
echo "$mouse Mouse Follows Focus | bash=$0 param1=toggle-mouse-follows terminal=false"
echo "---"
echo "Refresh kwm | bash=$0 param1=refresh terminal=false"
echo "Reload kwm | bash=$0 param1=reload terminal=false"
echo "Quit kwm | bash=$0 param1=quit terminal=false"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment