From 20768edcf69eddae5cf65e30a0bde869f9ddd19b Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Tue, 13 Aug 2024 20:14:09 -0400 Subject: [PATCH] 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. --- ansible/roles/firefox/defaults/main.yaml | 2 +- .../framework_laptop/files/iwlwifi_modprobe.conf | 14 +++++++++++--- ansible/roles/waybar/files/waybar_config.json | 2 +- .../files/waybar_scripts/waybar_night_mode.bash | 4 ++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ansible/roles/firefox/defaults/main.yaml b/ansible/roles/firefox/defaults/main.yaml index c7e134e..9dd9150 100644 --- a/ansible/roles/firefox/defaults/main.yaml +++ b/ansible/roles/firefox/defaults/main.yaml @@ -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 diff --git a/ansible/roles/framework_laptop/files/iwlwifi_modprobe.conf b/ansible/roles/framework_laptop/files/iwlwifi_modprobe.conf index 9135bbf..28ad914 100644 --- a/ansible/roles/framework_laptop/files/iwlwifi_modprobe.conf +++ b/ansible/roles/framework_laptop/files/iwlwifi_modprobe.conf @@ -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 diff --git a/ansible/roles/waybar/files/waybar_config.json b/ansible/roles/waybar/files/waybar_config.json index 4d86742..be2bb1e 100644 --- a/ansible/roles/waybar/files/waybar_config.json +++ b/ansible/roles/waybar/files/waybar_config.json @@ -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" } } diff --git a/ansible/roles/waybar/files/waybar_scripts/waybar_night_mode.bash b/ansible/roles/waybar/files/waybar_scripts/waybar_night_mode.bash index 6857a35..2110334 100644 --- a/ansible/roles/waybar/files/waybar_scripts/waybar_night_mode.bash +++ b/ansible/roles/waybar/files/waybar_scripts/waybar_night_mode.bash @@ -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