Browse Source

add lock script

Cullum Smith 2 years ago
parent
commit
6605acd466
3 changed files with 18 additions and 1 deletions
  1. 16
    0
      bin/bin/lock
  2. 1
    0
      cwm/.cwmrc
  3. 1
    1
      i3/.config/i3/config

+ 16
- 0
bin/bin/lock View File

@@ -0,0 +1,16 @@
1
+#!/bin/sh
2
+
3
+# locks the screen using xidle or xscreensaver if one of them is running.
4
+# otherwise, falls back on xlock.
5
+
6
+is_running() {
7
+  pgrep -u $USER "$1" > /dev/null
8
+}
9
+
10
+if is_running xscreensaver ; then
11
+  xscreensaver-command -lock
12
+elif is_running xidle ; then
13
+  pkill -USR1 xidle
14
+else
15
+  exec xlock
16
+fi

+ 1
- 0
cwm/.cwmrc View File

@@ -78,5 +78,6 @@ command mutt     "xterm -T mutt -e 'ssh mail -t ksh -l -c neomutt'"
78 78
 command xclock   xclock
79 79
 command xcalc    xcalc
80 80
 command xkill    xkill
81
+command lock     lock
81 82
 
82 83
 ignore xclock

+ 1
- 1
i3/.config/i3/config View File

@@ -135,7 +135,7 @@ for_window[class="XClock"]       floating enable
135 135
 
136 136
 # Application keybindings
137 137
 bindsym $mod+Return            exec --no-startup-id xterm
138
-bindsym Control+Mod1+l         exec --no-startup-id xscreensaver-command -lock
138
+bindsym Control+Mod1+l         exec --no-startup-id lock
139 139
 bindsym $mod+d                 exec --no-startup-id i3-dmenu-desktop --dmenu='dmenu -i -fn fixed:style=semicondensed:pixelsize=13:encoding=iso10646'
140 140
 bindsym --release $mod+Shift+q exec --no-startup-id xkill
141 141
 bindsym XF86AudioLowerVolume   exec --no-startup-id "vol down"

Loading…
Cancel
Save