更新hyprland配置

This commit is contained in:
2025-04-29 22:19:29 +08:00
parent e69345b654
commit 87c1617885
9 changed files with 42 additions and 234 deletions

View File

@@ -1,42 +0,0 @@
#!/usr/bin/env bash
ncolor="-h string:bgcolor:#343d46 -h string:fgcolor:#c0c5ce -h string:frcolor:#c0c5ce"
function send_notification {
brightness=`brightnessctl info | grep -oP "(?<=\()\d+(?=%)" | cat`
brightinfo=$(brightnessctl info | awk -F"'" '/Device/ {print $2}')
angle="$(((($brightness + 2) / 5) * 5))"
ico="~/.config/dunst/icons/vol/vol-${angle}.svg"
bar=$(seq -s "." $(($brightness / 15)) | sed 's/[0-9]//g')
if [ $brightness -ne 0 ]; then
notify-send $ncolor "brightctl" -i $ico -a "$brightness$bar" "Device: $brightinfo" -r 91190 -t 800
else
notify-send -i $ico "Brightness: ${brightness}%" -a "$brightinfo" -u low -r 91190 -t 800
fi
}
function get_brightness {
brightnessctl -m | grep -o '[0-9]\+%' | head -c-2
}
case $1 in
i)
# increase the backlight by 5%
brightnessctl set +5%
send_notification
;;
d)
if [[ $(get_brightness) -lt 5 ]]; then
# avoid 0% brightness
brightnessctl set 1%
else
# decrease the backlight by 5%
brightnessctl set 5%-
fi
send_notification
;;
esac

View File

@@ -1,5 +0,0 @@
if [[ $(hyprctl activewindow -j | jq -r ".class") == "Steam" ]]; then
xdotool windowunmap $(xdotool getactivewindow)
else
hyprctl dispatch killactive ""
fi

View File

@@ -1,76 +0,0 @@
#!/usr/bin/env sh
# define functions
function print_error
{
cat << "EOF"
./volumecontrol.sh -[device] <action>
...valid device are...
i -- [i]nput decive
o -- [o]utput device
...valid actions are...
i -- <i>ncrease volume [+5]
d -- <d>ecrease volume [-5]
m -- <m>ute [x]
EOF
exit 1
}
function notify_vol
{
vol=`pamixer $srce --get-volume | cat`
angle="$(( (($vol+2)/5) * 5 ))"
ico="${icodir}/vol-${angle}.svg"
bar=$(seq -s "." $(($vol / 15)) | sed 's/[0-9]//g')
notify-send $ncolor "volctl" -a "$vol$bar" "$nsink" -i $ico -r 91190 -t 800
}
function notify_mute
{
mute=`pamixer $srce --get-mute | cat`
if [ "$mute" == "true" ] ; then
notify-send $ncolor "volctl" -a "muted" "$nsink" -i ${icodir}/muted-${dvce}.svg -r 91190 -t 800
else
notify-send $ncolor "volctl" -a "unmuted" "$nsink" -i ${icodir}/unmuted-${dvce}.svg -r 91190 -t 800
fi
}
# set device source
while getopts io SetSrc
do
case $SetSrc in
i) nsink=$(pamixer --list-sources | grep "_input." | head -1 | awk -F '" "' '{print $NF}' | sed 's/"//')
srce="--default-source"
dvce="mic" ;;
o) nsink=$(pamixer --get-default-sink | grep "_output." | awk -F '" "' '{print $NF}' | sed 's/"//')
srce=""
dvce="speaker" ;;
esac
done
if [ $OPTIND -eq 1 ] ; then
print_error
fi
# set device action
shift $((OPTIND -1))
step="${2:-5}"
icodir="~/.config/dunst/icons/vol"
ncolor="-h string:bgcolor:#343d46 -h string:fgcolor:#c0c5ce -h string:frcolor:#c0c5ce"
case $1 in
i) pamixer $srce -i ${step}
notify_vol ;;
d) pamixer $srce -d ${step}
notify_vol ;;
m) pamixer $srce -t
notify_mute ;;
*) print_error ;;
esac