New backup 2024-08-10 01:15:01

This commit is contained in:
Penelope Gwen 2024-08-10 01:15:01 -07:00
parent 84ddde7b55
commit 5f19f3f204
5 changed files with 65 additions and 0 deletions

View file

@ -0,0 +1,21 @@
#!/bin/bash
calc_newval(){
printf "%02x\n" $( echo "${1}*${2}*0.01" | bc | sed s/\\.[0-9]*// )
}
brightness="$1"
max_r=$(printf "%d\n" 0xff)
max_g=$(printf "%d\n" 0x00)
max_b=$(printf "%d\n" 0xee)
#calc_newval ${max_r} ${brightness}
#exit
calc_r=$( calc_newval ${max_r} ${brightness} )
calc_g=$( calc_newval ${max_g} ${brightness} )
calc_b=$( calc_newval ${max_b} ${brightness} )
g213-led -a "${calc_r}${calc_g}${calc_b}"

View file

@ -9,3 +9,4 @@
.config/sway-profiles/unlockscript.d/328p1aa
.config/sway-profiles/lockscript.d/328p1aa
.config/sway/config.d/autostart.d/328p1aa
.config/sway/scripts/kb_brightness.d/328p1aa

View file

@ -13,3 +13,4 @@
.config/sway/config.d/autostart.d
.config/sway/workspace_test
.config/sway/workspace_test_tree.json
.config/sway/scripts/kb_brightness.d

View file

@ -35,5 +35,15 @@
# Brightness Down
bindsym XF86MonBrightnessDown exec "$HOME/.config/sway/scripts/brightness.sh down"
#
# Keyboard Brightness
#
# Brightness Up
bindsym shift+XF86AudioRaiseVolume exec "$HOME/.config/sway/scripts/kb_brightness up"
# Brightness Down
bindsym shift+XF86AudioLowerVolume exec "$HOME/.config/sway/scripts/kb_brightness down"
# Numlock
input * xkb_numlock enabled

View file

@ -0,0 +1,32 @@
#!/bin/bash
operation="${1}"
cache_dir="${HOME}/.cache/sway-profiles"
cache_file="${cache_dir}/kb_brightness"
mkdir -p "${cache_dir}"
if [[ ! -f "${cache_file}" ]];then
echo "100" > "${cache_file}"
fi
kb_brightness=$( cat "${cache_file}" )
case "$operation" in
up)
kb_brightness="$((${kb_brightness}+5))"
[[ ${kb_brightness} -gt 100 ]] && kb_brightness="100"
;;&
down)
kb_brightness="$((${kb_brightness}-5))"
[[ ${kb_brightness} -lt 0 ]] && kb_brightness="0"
;;&
up|down)
echo "${kb_brightness}" > "${cache_file}"
# light_lvl="$(brightnessctl set ${brighness_change} | sed -En 's/.*\(([0-9]+)%\).*/\1/p')"
# echo "${light_lvl}" "${de_color_0}${opacity}" "${de_color_1}${opacity}" "${de_color_3}${opacity}" > "$WOBSOCK"
echo "${kb_brightness}"
for s in ~/.config/sway/scripts/kb_brightness.d/*;do
bash -c "${s} ${kb_brightness}"
done
# ;;
esac