feat: autorandr, wallpaper and screensaver

This commit is contained in:
AngeD 2023-05-30 18:41:56 +02:00
parent f8b873255e
commit 5e3b4b3637
9 changed files with 45 additions and 20 deletions

View File

@ -0,0 +1,7 @@
output eDP
mode 1920x1080
pos 0x0
primary
output HDMI-A-0
mode 1920x1080
pos 1920x0

View File

@ -0,0 +1 @@
/home/ange/bin/wallpaper

View File

@ -0,0 +1,2 @@
HDMI-A-0 00ffffffffffff004c2d200d34415743191e010380341d782a9315a655519c27115054bfef80714f81c0810081809500a9c0b3000101023a801871382d40582c450009252100001e000000fd00324b1e5111000a202020202020000000fc00533234463335300a2020202020000000ff0048345a4e3630323031370a20200114020311b14690041f13120365030c001000011d00bc52d01e20b828554009252100001e8c0ad090204031200c4055000925210000188c0ad08a20e02d10103e9600092521000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051
eDP 00ffffffffffff0009e5d50800000000231d0104a5221378030b95935c59932a20505400000001010101010101010101010101010101043a803671381e403020360058c21000001a000000000000000000000000000000000000000000fe00424f452043510a202020202020000000fe004e5431353646484d2d4e34330a000e

View File

@ -0,0 +1,6 @@
output HDMI-A-0
off
output eDP
mode 1920x1080
pos 0x0
primary

View File

@ -0,0 +1 @@
/home/ange/bin/wallpaper

View File

@ -0,0 +1 @@
eDP 00ffffffffffff0009e5d50800000000231d0104a5221378030b95935c59932a20505400000001010101010101010101010101010101043a803671381e403020360058c21000001a000000000000000000000000000000000000000000fe00424f452043510a202020202020000000fe004e5431353646484d2d4e34330a000e

View File

@ -1,30 +1,16 @@
#!/bin/sh
# display
## laptop
if ls -d /sys/class/power_supply/BAT*/ > /dev/null 2>&1; then
stimeout=300
else # desktop
stimeout=1800
fi
cycle=15 # lock 15 sec after stimeout
dpms="$((stimeout + cycle + 1))" # turn off screen 1 sec after lock
xset s "$stimeout" "$cycle" &
xset dpms "$dpms" "$dpms" "$dpms" &
feh --bg-fill "$XDG_CONFIG_HOME/wallpapers/mount_cook.jpg" --no-fehbg &
xss-lock -n "feh --fullscreen $XDG_CONFIG_HOME/wallpapers/lock.png" -- lock &
# bar
#(i3status | while read line; do xsetroot -name "$line"; done) &
# startup
set-display &
xss-lock -n screensaver -- lock &
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 || # arch
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 || # debian
/usr/libexec/polkit-gnome-authentication-agent-1 & # fedora
picom &
gammastep 2> /dev/null &
sbar &
/usr/libexec/polkit-gnome-authentication-agent-1 & # fedora
picom &
gammastep 2> /dev/null &
sbar &
exec dbus-launch dwm

3
bin/screensaver Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
feh --fullscreen "$XDG_CONFIG_HOME/wallpapers/lock.png"

18
bin/wallpaper Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
feh --bg-fill "$XDG_CONFIG_HOME/wallpapers/mount_cook.jpg" --no-fehbg
NBMON="$(xrandr | grep -c connected)"
BAT="$(ls /sys/class/power_supply/BAT*/ 2> /dev/null)"
if [ "$NBMON" = 1 ] && [ -n "$BAT" ]; then
stimeout=300 # laptop
else
stimeout=1800 # desktop
fi
cycle=15 # lock 15 sec after stimeout
dpms="$((stimeout + cycle + 1))" # turn off screen 1 sec after lock
xset s "$stimeout" "$cycle"
xset dpms "$dpms" "$dpms" "$dpms"