diff options
author | Camil Staps | 2023-02-20 16:38:30 +0100 |
---|---|---|
committer | Camil Staps | 2023-02-20 16:38:30 +0100 |
commit | da08e8288c455f94ddc41d299a656e8019edde87 (patch) | |
tree | f50d75bd703146c9bedeaa2b9fa919d330d07840 | |
parent | Add night light shortcuts (diff) |
Add shortcuts to set night mode to day/night (extremes); change shortcuts for this and brightness
-rw-r--r-- | i3/.i3/config | 10 | ||||
-rwxr-xr-x | yoga/bin/night-light | 14 |
2 files changed, 12 insertions, 12 deletions
diff --git a/i3/.i3/config b/i3/.i3/config index 2cb64b2..a1d2355 100644 --- a/i3/.i3/config +++ b/i3/.i3/config @@ -36,10 +36,12 @@ bindsym XF86AudioLowerVolume exec amixer sset Master 1%- && kill -s 10 `pidof i3 bindsym XF86MonBrightnessUp exec bash -c 'echo "$(($(cat /sys/class/backlight/amdgpu_bl0/brightness)+10))" > /sys/class/backlight/amdgpu_bl0/brightness' bindsym XF86MonBrightnessDown exec bash -c 'echo "$(($(cat /sys/class/backlight/amdgpu_bl0/brightness)-10))" > /sys/class/backlight/amdgpu_bl0/brightness' -bindsym $mod+XF86MonBrightnessUp exec bash -c 'echo 255 > /sys/class/backlight/amdgpu_bl0/brightness' -bindsym $mod+XF86MonBrightnessDown exec bash -c 'echo 1 > /sys/class/backlight/amdgpu_bl0/brightness' -bindsym $mod+Shift+XF86MonBrightnessUp exec night-light increase -bindsym $mod+Shift+XF86MonBrightnessDown exec night-light decrease +bindsym Shift+XF86MonBrightnessUp exec bash -c 'echo 255 > /sys/class/backlight/amdgpu_bl0/brightness' +bindsym Shift+XF86MonBrightnessDown exec bash -c 'echo 1 > /sys/class/backlight/amdgpu_bl0/brightness' +bindsym Ctrl+XF86MonBrightnessUp exec night-light increase +bindsym Ctrl+XF86MonBrightnessDown exec night-light decrease +bindsym Ctrl+Shift+XF86MonBrightnessUp exec night-light day +bindsym Ctrl+Shift+XF86MonBrightnessDown exec night-light night bindsym $mod+F7 exec toggle-dp bindsym $mod+Shift+F7 exec toggle-dp-brightness diff --git a/yoga/bin/night-light b/yoga/bin/night-light index 6c4224c..b76054d 100755 --- a/yoga/bin/night-light +++ b/yoga/bin/night-light @@ -1,5 +1,5 @@ #!/bin/bash -# Usage: night-light [increase|decrease] +# Usage: night-light [increase|decrease|day|night] set -e TMPFILE=/tmp/.night-light-index @@ -20,18 +20,16 @@ STEPS=( "1:1:1" ) -CUR=${#STEPS[@]} +CUR=$((${#STEPS[@]}-1)) if [ -f $TMPFILE ]; then CUR=$(cat $TMPFILE) fi case "$1" in - increase) - NEW=$(($CUR >= ${#STEPS[@]} ? $CUR : $CUR+1)) - ;; - decrease) - NEW=$(($CUR <= 0 ? $CUR : $CUR-1)) - ;; + increase) NEW=$(($CUR >= ${#STEPS[@]} ? $CUR : $CUR+1)) ;; + decrease) NEW=$(($CUR <= 0 ? $CUR : $CUR-1)) ;; + day) NEW=$((${#STEPS[@]}-1)) ;; + night) NEW=0 ;; *) echo "Invalid argument '$1'" exit 1 |