summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sway/config21
-rwxr-xr-xsway/sway_autolock12
2 files changed, 16 insertions, 17 deletions
diff --git a/sway/config b/sway/config
index 4a6496b..255f97a 100644
--- a/sway/config
+++ b/sway/config
@@ -28,27 +28,11 @@ set $menu bemenu-run | xargs swaymsg exec --
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
# output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
#
-# Example configuration:
-#
-# output HDMI-A-1 resolution 1920x1080 position 1920,0
-#
-# You can get the names of your outputs by running: swaymsg -t get_outputs
-
-### Idle configuration
-
-exec swayidle -w \
- timeout 300 'swaylock -f -c 000000' \
- timeout 300 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'
-# before-sleep 'swaylock -f -c 000000'
-
-# This will lock your screen after 300 seconds of inactivity, then turn off
-# your displays after another 300 seconds, and turn your screens back on when
-# resumed. It will also lock your screen before your computer goes to sleep.
### Visual stuff
hide_edge_borders --i3 none
-default_border pixel 1
+default_border none # pixel 1
client.focused #000000 #af4c00 #ffffff #2e9ef4 #AF4C00
@@ -68,6 +52,9 @@ client.focused #000000 #af4c00 #ffffff #2e9ef4 #AF4C00
# Time
bindsym $mod+Return exec sway_stats
+ # Autolock
+ bindsym $mod+Shift+h exec sway_autolock
+
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
diff --git a/sway/sway_autolock b/sway/sway_autolock
new file mode 100755
index 0000000..9168249
--- /dev/null
+++ b/sway/sway_autolock
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+pid="$(pgrep swayidle)"
+if [ -z "$pid" ]; then
+ swayidle -w timeout 300 'swaylock -f -c 000000' \
+ timeout 300 'swaymsg "output * dpms off"' \
+ resume 'swaymsg "output * dpms on"' &
+ notify-send --app-name "Autolock" "Enabled"
+else
+ kill -9 "$pid"
+ notify-send --app-name "Autolock" "DISABLED"
+fi