diff --git a/.config/nvim/pack/plugins/opt/lspconfig b/.config/nvim/pack/plugins/opt/lspconfig index 1028360..0f598b9 160000 --- a/.config/nvim/pack/plugins/opt/lspconfig +++ b/.config/nvim/pack/plugins/opt/lspconfig @@ -1 +1 @@ -Subproject commit 1028360e0f2f724d93e876df3d22f63c1acd6ff9 +Subproject commit 0f598b9ab9f2a6d7e137074be99c8d89af44b990 diff --git a/.config/nvim/pack/plugins/opt/telescope b/.config/nvim/pack/plugins/opt/telescope index be49680..4226740 160000 --- a/.config/nvim/pack/plugins/opt/telescope +++ b/.config/nvim/pack/plugins/opt/telescope @@ -1 +1 @@ -Subproject commit be49680937e821e4d8522329727e50734fdb9b97 +Subproject commit 42267407ae588fd6c07238777d48869571193a49 diff --git a/.config/nvim/pack/plugins/opt/treesitter b/.config/nvim/pack/plugins/opt/treesitter index a954f78..2c59e0f 160000 --- a/.config/nvim/pack/plugins/opt/treesitter +++ b/.config/nvim/pack/plugins/opt/treesitter @@ -1 +1 @@ -Subproject commit a954f789aaa0cedea7609b5493007867b1cd3e9e +Subproject commit 2c59e0ff3da6514b03d853ebecb6c36c515a5d7d diff --git a/.config/suckless b/.config/suckless index 9288ee0..e28dedc 160000 --- a/.config/suckless +++ b/.config/suckless @@ -1 +1 @@ -Subproject commit 9288ee09c89a76cf904886d3c7ffb158948347a1 +Subproject commit e28dedcf452a9117d76f70090d2f48e01b908f8e diff --git a/.config/zsh/custom/themes/powerlevel10k b/.config/zsh/custom/themes/powerlevel10k index 79753fa..e4b8925 160000 --- a/.config/zsh/custom/themes/powerlevel10k +++ b/.config/zsh/custom/themes/powerlevel10k @@ -1 +1 @@ -Subproject commit 79753faacb6dc511088cb0d136ec438873613932 +Subproject commit e4b8925478d79795713c80dca4680782a33cdc1b diff --git a/.config/zsh/ohmyzsh b/.config/zsh/ohmyzsh index 46c7040..50c6786 160000 --- a/.config/zsh/ohmyzsh +++ b/.config/zsh/ohmyzsh @@ -1 +1 @@ -Subproject commit 46c70406dd0b26bbd61210873ad6c86d9e8ee5da +Subproject commit 50c678687e73d1433f278b7bb7f168e8fa817670 diff --git a/bin/set-light b/bin/set-light index 2939cac..e8624e1 100755 --- a/bin/set-light +++ b/bin/set-light @@ -1,5 +1,17 @@ #!/bin/bash -e +function round() { + local nb="$1" + local closest="${2#-}" + local mod; mod="$((nb % closest))" + + if [ "$mod" -lt "$((closest / 2))" ]; then + echo "$((nb - mod))" + return + fi + echo "$((nb + closest - mod))" +} + function get_current() { local d="$1" local cur; cur="$(cat "$1/brightness")" @@ -8,27 +20,30 @@ function get_current() { echo "$((cur * 100 / max))" } -function set-light() { +function set_light() { local d="$1" local max; max="$(cat "$d/max_brightness")" echo "$((CUR * max / 100))" > "$d/brightness" } -NOTIFY='notify-send -t 1000 -a changeVolume -u low' +NOTIFY='notify-send -t 1000 -a changeBrightness -u low' NOTIFYVOL="$NOTIFY -i audio-volume-high" DIRS=(/sys/class/backlight/*) CUR="$(get_current "${DIRS[0]}")" case "${1:0:1}" in - '') echo "$CUR"; exit ;; - '+'|'-') CUR="$((CUR + $1))" ;; - *) CUR="$1" ;; + '') echo "$CUR"; exit ;; + '+'|'-') CUR="$(round $((CUR + "$1")) "$1")" ;; + *) CUR="$1" ;; esac +[ "$CUR" -lt 0 ] && CUR=0 +[ "$CUR" -gt 100 ] && CUR=100 + for d in "${DIRS[@]}"; do - set-light "$d" "$CUR" + set_light "$d" done $NOTIFYVOL -h string:synchronous:vol -h int:value:"$CUR" "$CUR%" diff --git a/bin/set-vol b/bin/set-vol index 267319c..195eb64 100755 --- a/bin/set-vol +++ b/bin/set-vol @@ -19,12 +19,20 @@ if [ "$1" == 'm' ]; then fi else case "${1:0:1}" in - '') echo "$CUR"; exit ;; - '+'|'-') CUR="$((CUR - CUR % $1 + $1))" ;; - *) CUR="$1" ;; + '') + echo "$CUR"; exit + ;; + '+'|'-') + CUR="$((CUR - CUR % $1 + $1))" + [ "$CUR" -lt 0 ] && CUR=0 + [ "$CUR" -gt 150 ] && CUR=150 + ;; + *) + CUR="$1" + ;; esac - wpctl set-volume -l 1.5 "$SINK" "$CUR%" + wpctl set-volume "$SINK" "$CUR%" if [ "$MUTE" = 1 ]; then wpctl set-mute "$SINK" 0 fi