summaryrefslogtreecommitdiff
path: root/toggle-desktop.sh
diff options
context:
space:
mode:
Diffstat (limited to 'toggle-desktop.sh')
-rwxr-xr-xtoggle-desktop.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/toggle-desktop.sh b/toggle-desktop.sh
new file mode 100755
index 0000000..f6e8843
--- /dev/null
+++ b/toggle-desktop.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+if [ -s /tmp/lwa.lock ]; then
+ # On my system, lwa-hot-corners sometimes creates many instances of itself
+ # This way, I kill the unnecessary processes
+ # WORKS ONLY when I give the script $PPID as first argument (refer to .lwarc)
+ kill -KILL $1
+ exit
+fi
+
+echo "Running" > /tmp/lwa.lock
+
+if xprop -root _NET_SHOWING_DESKTOP | egrep '= 1' > /dev/null; then
+ wmctrl -k off
+else
+ wmctrl -k on
+fi
+
+sleep 0.2
+
+rm /tmp/lwa.lock