]> oss.titaniummirror.com Git - smckown/dotfiles.git/blobdiff - Xidle
Add .Xidle
[smckown/dotfiles.git] / Xidle
diff --git a/Xidle b/Xidle
new file mode 100755 (executable)
index 0000000..a6d67d8
--- /dev/null
+++ b/Xidle
@@ -0,0 +1,26 @@
+#!/bin/sh
+# This script should be called by xss-lock on no X activity.
+# xss-lock is started in ~/.dwmrc.
+
+# Set mcabber=1 if mcabber is present and running, else 0
+mcabber=0
+if [ -d ~/.mcabber ]; then
+  if [ -p ~/.mcabber/mcabber.fifo ]; then
+    mcabber=1
+  fi
+fi
+
+# Suspend dunst messages
+killall -SIGUSR1 -u $USER dunst 2>/dev/null
+
+# Mark idle in mcabber
+[ $mcabber -eq 1 ] && echo "/status away (Auto-idle)" > ~/.mcabber/mcabber.fifo
+
+# Lock the screen and wait until unlocked
+i3lock --nofork --color=000000
+
+# Mark online in mcabber
+[ $mcabber -eq 1 ] && echo "/status online -" > ~/.mcabber/mcabber.fifo
+
+# Resume dunst messages
+killall -SIGUSR2 -u $USER dunst 2>/dev/null