This commit is contained in:
2025-03-25 01:47:41 +03:00
commit 55e3c0f310
13 changed files with 354 additions and 0 deletions

11
scripts/bar-toggle Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
bar_config=$(swaymsg -t get_bar_config "bar-0")
mode=$(echo "$bar_config" | jq -r '.mode')
if [ "$mode" == "dock" ]; then
swaymsg "bar mode invisible"
elif [ "$mode" == "invisible" ]; then
swaymsg "bar mode dock"
fi

19
scripts/brightness Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
NOTIFICATION_ID=9999
CURRENT_BRIGHTNESS=$(brightnessctl g)
MAX_BRIGHTNESS=$(brightnessctl m)
CURRENT_BRIGHTNESS_PERCENT=$((CURRENT_BRIGHTNESS * 100 / MAX_BRIGHTNESS))
if [ "$1" == "+" ]; then
brightnessctl set +1%
elif [ "$1" == "-" ]; then
brightnessctl set 10%-
else
notify-send -u normal -r $NOTIFICATION_ID "Ошибка" "Неверный параметр. Используйте '+' или '-'."
exit 1
fi
UPDATED_BRIGHTNESS=$(brightnessctl g)
UPDATED_BRIGHTNESS_PERCENT=$((UPDATED_BRIGHTNESS * 100 / MAX_BRIGHTNESS))
notify-send -u normal -i display-brightness-high -r $NOTIFICATION_ID "Уровень яркости" "${UPDATED_BRIGHTNESS_PERCENT}%" -t 400

22
scripts/volume Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
MAX_VOLUME=200
NOTIFICATION_ID=9999
CURRENT_VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -oP '\d+%' | head -1 | tr -d '%')
if [ "$1" == "+" ]; then
if [ "$CURRENT_VOLUME" -lt "$MAX_VOLUME" ]; then
pactl set-sink-volume @DEFAULT_SINK@ +10%
else
notify-send -u normal -r $NOTIFICATION_ID "Невозможно увеличить звук" "Достигнут лимит в $MAX_VOLUME%" -t 400
exit 0
fi
elif [ "$1" == "-" ]; then
pactl set-sink-volume @DEFAULT_SINK@ -10%
else
notify-send -u normal -r $NOTIFICATION_ID "Error" "Invalid parameter. Use '+' or '-'." -t 400
exit 1
fi
UPDATED_VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -oP '\d+%' | head -1 | tr -d '%')
notify-send -u normal -i audio-volume-high -r $NOTIFICATION_ID "Уровень звука" "${UPDATED_VOLUME}%" -t 400

75
scripts/workspace-manager Executable file
View File

@ -0,0 +1,75 @@
#!/bin/bash
# Calc swich
key_input=$1
flag=$2
workspace_number=$(swaymsg -t get_workspaces | jq -r '.[] | select(.focused==true) | .name')
last_workspace=$(cat /tmp/last_workspace 2>/dev/null)
f_key_number=$(cat /tmp/f_key_number 2>/dev/null || echo 0)
digit_key_number=$(cat /tmp/digit_key_number 2>/dev/null || echo 0)
case $key_input in
F1) f_key_number=1 ;;
F2) f_key_number=2 ;;
F3) f_key_number=3 ;;
F4) f_key_number=4 ;;
F5) f_key_number=5 ;;
F6) f_key_number=6 ;;
F7) f_key_number=7 ;;
F8) f_key_number=8 ;;
F9) f_key_number=9 ;;
F10) f_key_number=10 ;;
F11) f_key_number=11 ;;
F12) f_key_number=12 ;;
0) digit_key_number=10;;
[1-9]) digit_key_number=$key_input ;;
*) echo "Invalid key input"; exit 1 ;;
esac
workspace_number=$((f_key_number * 10 + digit_key_number))
# Hooks
case $workspace_number in
30) workspace_number=48 ;; # Krita
esac
# swich
if [[ $flag == "move" ]]; then
swaymsg move container to workspace number $workspace_number
else
swaymsg workspace $workspace_number
fi
echo "$current_workspace" > /tmp/last_workspace
echo "$f_key_number" > /tmp/f_key_number
echo "$digit_key_number" > /tmp/digit_key_number
# End swich
# Post swich
case $workspace_number in
51)
xinput set-prop "ASUE1305:00 04F3:3212 Touchpad" "libinput Disable While Typing Enabled" 0
;;
48)
xinput set-prop "ASUE1305:00 04F3:3212 Touchpad" "libinput Disable While Typing Enabled" 0
;;
30)
xinput set-prop "ASUE1305:00 04F3:3212 Touchpad" "libinput Disable While Typing Enabled" 0
;;
18)
xinput set-prop "ASUE1305:00 04F3:3212 Touchpad" "libinput Disable While Typing Enabled" 0
;;
*)
xinput set-prop "ASUE1305:00 04F3:3212 Touchpad" "libinput Disable While Typing Enabled" 1
;;
esac
case $workspace_number in
*)
setxkbmap us; sleep 0.1; setxkbmap -layout "us,ru" -option "grp:alt_shift_toggle"
;;
esac