Skip to content

Commit e865a33

Browse files
committed
Use idle script
1 parent c7e250d commit e865a33

File tree

2 files changed

+32
-26
lines changed

2 files changed

+32
-26
lines changed

.config/sway/config

+14-22
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ set $border_size 2
1919
set $gap_size 8
2020

2121
default_border pixel $border_size
22-
# default_border normal 0
2322
default_floating_border normal 0
2423
smart_borders on
2524

@@ -30,7 +29,6 @@ smart_gaps on
3029

3130
# -----------------------------------------------------------------------------
3231
# Font
33-
# set $main_font pango:Input 10
3432
set $main_font pango:Roboto 11
3533
font $main_font
3634
title_align left
@@ -175,18 +173,18 @@ client.urgent $border_f $bg_uf $text_f $indic_f $border_uf
175173
bindsym $mod+Return exec --no-startup-id alacritty
176174

177175
# XF86 Keys
178-
bindsym XF86AudioRaiseVolume exec --no-startup-id $HOME/scripts/volume -i 5
179-
bindsym XF86AudioLowerVolume exec --no-startup-id $HOME/scripts/volume -d 5
180-
bindsym XF86AudioMute exec --no-startup-id $HOME/scripts/volume -t
181-
bindsym XF86AudioMicMute exec --no-startup-id $HOME/scripts/mute_mic
176+
bindsym XF86AudioRaiseVolume exec $HOME/scripts/volume -i 5
177+
bindsym XF86AudioLowerVolume exec $HOME/scripts/volume -d 5
178+
bindsym XF86AudioMute exec $HOME/scripts/volume -t
179+
bindsym XF86AudioMicMute exec $HOME/scripts/mute_mic
182180

183-
bindsym XF86MonBrightnessUp exec --no-startup-id $HOME/scripts/brightness inc
184-
bindsym XF86MonBrightnessDown exec --no-startup-id $HOME/scripts/brightness dec
181+
bindsym XF86MonBrightnessUp exec $HOME/scripts/brightness inc
182+
bindsym XF86MonBrightnessDown exec $HOME/scripts/brightness dec
185183

186-
bindsym XF86Favorites exec --no-startup-id $HOME/scripts/toggle_backlight
184+
bindsym XF86Favorites exec $HOME/scripts/toggle_backlight
187185

188186
# Application runner
189-
bindsym $mod+space exec --no-startup-id rofi -show drun -config $HOME/.config/rofi/sf_sway.rasi
187+
bindsym $mod+space exec rofi -show drun -config $HOME/.config/rofi/sf_sway.rasi
190188

191189
# Quick copy screenshot
192190
bindsym $mod+Print exec grim - | wl-copy -t image/png
@@ -210,23 +208,18 @@ bindsym Control+Mod1+Delete exec $HOME/scripts/logout
210208
exec mako
211209

212210
# Waybar
213-
exec_always --no-startup-id $HOME/.config/waybar/waybar.sh
211+
exec_always $HOME/.config/waybar/waybar.sh
214212

215213
# Gnome Policykit
216214
exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
217215

218-
# Lock screen when idle
219216
# exec swayidle -w \
220-
# timeout 1500 'swaymsg "output * dpms off"' \
221-
# resume 'swaymsg "output * dpms on"' \
222-
# timeout 1800 'swaylock -e -i $HOME/Pictures/Backgrounds/aD7PxAG.jpg' \
223-
# before-sleep 'swaylock -e -i $HOME/Pictures/Backgrounds/aD7PxAG.jpg'
217+
# timeout 1500 'swaylock -f -i $HOME/Pictures/Backgrounds/aD7PxAG.jpg' \
218+
# timeout 1800 'swaymsg "output * dpms off"' \
219+
# resume 'swaymsg "output * dpms on"' \
220+
# before-sleep 'swaylock -f -i $HOME/Pictures/Backgrounds/aD7PxAG.jpg'
224221

225-
exec swayidle -w \
226-
timeout 1500 'swaylock -f -i $HOME/Pictures/Backgrounds/aD7PxAG.jpg' \
227-
timeout 1800 'swaymsg "output * dpms off"' \
228-
resume 'swaymsg "output * dpms on"' \
229-
before-sleep 'swaylock -f -i $HOME/Pictures/Backgrounds/aD7PxAG.jpg'
222+
exec_always $HOME/scripts/idle
230223

231224
# }}}
232225

@@ -250,7 +243,6 @@ for_window [app_id="pavucontrol"] floating enable
250243

251244
# Background
252245
output "eDP-1" background $HOME/Pictures/arc_flowers_1080.png fill
253-
# output "*" background #3e4452 solid_color
254246

255247
# GTK Settings
256248
set $gnome-schema org.gnome.desktop.interface

scripts/idle

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
#!/bin/bash
22

3-
mins()
4-
{
3+
4+
killall -q swayidle
5+
while pgrep -x swayidle >/dev/null; do sleep 1; done
6+
7+
mins() {
58
echo `expr $1 '*' 60`
69
}
710

811
dim_timeout=$(mins 15)
9-
lock_timeout=$(mins 30)
12+
lock_timeout=$(mins 17)
1013
display_timeout=$(mins 20)
1114

12-
echo $dim_timeout
15+
# dim_timeout=10
16+
# lock_timeout=15
17+
# display_timeout=30
18+
19+
swayidle -w \
20+
timeout $dim_timeout '$HOME/scripts/dim_screen' \
21+
resume '$HOME/scripts/dim_screen restore' \
22+
timeout $lock_timeout 'swaylock -f -i $HOME/Pictures/Backgrounds/aD7PxAG.jpg' \
23+
timeout $display_timeout 'swaymsg "output * dpms off"' \
24+
resume 'swaymsg "output * dpms on"' \
25+
before-sleep 'swaylock -f -i $HOME/Pictures/Backgrounds/aD7PxAG.jpg'
26+

0 commit comments

Comments
 (0)