Fix night mode signal handling.

Now the script works on both FreeBSD and Linux, and it exits properly so switching between docked and undocked doesn't cause problems for waybar.
This commit is contained in:
Tom Alexander 2024-08-13 20:14:09 -04:00
parent 8175cf443a
commit 20768edcf6
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
4 changed files with 15 additions and 7 deletions

View File

@ -38,6 +38,6 @@ firefox_config:
privacy.fingerprintingProtection: true
# Allow sending dark mode preference to websites.
# Allow sending timezone to websites.
privacy.fingerprintingProtection.overrides: "+AllTargets,-CSSPrefersColorScheme,-JSDateTimeUTC"
privacy.fingerprintingProtection.overrides: "+AllTargets,-CSSPrefersColorScheme,-JSDateTimeUTC,-CanvasExtractionBeforeUserInputIsBlocked"
# Disable weather on new tab page
browser.newtabpage.activity-stream.showWeather: false

View File

@ -1,5 +1,13 @@
#options iwlwifi power_save=1
# Manually disable power save:
# iw wlan0 set power_save off
#options iwlwifi uapsd_disable=0
## High power:
options iwlwifi power_save=0
# options iwlwifi uapsd_disable=1
options iwlmvm power_scheme=1 # 1-active, 2-balanced, 3-low power, default: 2 (int)
#options iwlmvm power_scheme=3
## Low power:
# options iwlwifi power_save=1
# ? power_level:default power save level (range from 1 - 5, default: 1) (int)
# options iwlwifi uapsd_disable=0
# options iwlmvm power_scheme=3

View File

@ -48,6 +48,6 @@
"exec": "waybar_night_mode",
"return-type": "json",
"restart-interval": 30,
"on-click": "pkill --signal USR1 -f waybar_night_mode"
"on-click": "pkill -USR1 -f waybar_night_mode"
}
}

View File

@ -21,7 +21,7 @@ function cleanup {
kill "$wlsunset_pid"
true
}
for sig in EXIT INT QUIT HUP TERM; do
for sig in EXIT; do
trap "set +e; cleanup" "$sig"
done
@ -85,7 +85,7 @@ function handle_click {
log "Setting night mode to force-night."
night_mode_mode="on"
fi
kill -USR1 "$wlsunset_pid"
kill -s SIGUSR1 "$wlsunset_pid"
}
trap "handle_click" SIGUSR1