This commit is contained in:
OpexHunter
2025-03-16 21:22:11 +03:00
committed by pivodevat
commit 79b6d1aaa1
11 changed files with 562 additions and 0 deletions

14
manager/scripts/bar-toggle Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Получаем конфигурацию i3bar
bar_config=$(i3-msg -t get_bar_config "bar-0")
# Извлекаем значение параметра mode
mode=$(echo "$bar_config" | jq -r '.mode')
# Проверяем текущее состояние и переключаем режим
if [ "$mode" == "dock" ]; then
i3-msg "bar mode invisible"
elif [ "$mode" == "invisible" ]; then
i3-msg "bar mode dock"
fi

33
manager/scripts/brightness Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
# Уникальный идентификатор для уведомления
NOTIFICATION_ID=9999
# Получаем текущий уровень яркости
CURRENT_BRIGHTNESS=$(brightnessctl g)
# Получаем максимальный уровень яркости
MAX_BRIGHTNESS=$(brightnessctl m)
# Вычисляем текущий уровень яркости в процентах
CURRENT_BRIGHTNESS_PERCENT=$((CURRENT_BRIGHTNESS * 100 / MAX_BRIGHTNESS))
# Проверяем переданный параметр
if [ "$1" == "+" ]; then
# Увеличиваем яркость на 10%
brightnessctl set +1%
elif [ "$1" == "-" ]; then
# Уменьшаем яркость на 10%
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}%"

20
manager/scripts/fullscreen Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
xrandr --output eDP --off
sleep 7
i3-msg 'bar mode dock'
xdotool windowactivate --sync $(xdotool search --class "chromium-main" | sort -n | head -n 1) key F11
xdotool windowactivate --sync $(xdotool search --class "chromium-invest" | sort -n | head -n 1) key F11
xdotool windowactivate --sync $(xdotool search --class "chromium-media" | sort -n | head -n 1) key F11
xdotool windowactivate --sync $(xdotool search --class "chromium-blackeducation" | sort -n | head -n 1) key F11
xdotool windowactivate --sync $(xdotool search --class "chromium-punkcraft" | sort -n | head -n 1) key F11
xdotool windowactivate --sync $(xdotool search --name ".* - База знаний - Obsidian.*" | sort -n | head -n 1) key F11
xdotool windowactivate --sync $(xdotool search --name ".* - PIVODEVAT - Obsidian.*" | sort -n | head -n 1) key F11
xdotool windowactivate --sync $(xdotool search --name ".* - Black Education - Obsidian.*" | sort -n | head -n 1) key F11
xdotool windowactivate --sync $(xdotool search --name ".* - PunkCraft - Obsidian.*" | sort -n | head -n 1) key F11
i3-msg 'bar mode invisible'
i3-msg 'workspace 20'
xrandr --output eDP --auto

35
manager/scripts/volume Executable file
View File

@ -0,0 +1,35 @@
#!/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%"
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 '-'."
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}%"

75
manager/workspace-manager Executable file
View File

@ -0,0 +1,75 @@
#!/bin/bash
# Calc swich
key_input=$1
flag=$2
workspace_number=$(i3-msg -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
i3-msg move container to workspace number $workspace_number
else
i3-msg 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

View File

@ -0,0 +1,23 @@
#!/bin/bash
ws1=$(( $1*10 + 1 ))
ws2=$(( $1*10 + 2 ))
ws3=$(( $1*10 + 3 ))
ws4=$(( $1*10 + 4 ))
ws5=$(( $1*10 + 5 ))
ws6=$(( $1*10 + 6 ))
ws7=$(( $1*10 + 7 ))
ws8=$(( $1*10 + 8 ))
ws9=$(( $1*10 + 9 ))
ws10=$(( $1*10 + 10 ))
#1
i3-msg "exec xdg-open obsidian://open?vault=Black%20Education"
#2
chromium --class=chromium-blackeducation --user-data-dir=$HOME/.config/black-education &
sleep 6
i3-msg "[title=\".* - Black Education - Obsidian.*\"] move container to workspace $ws1"
i3-msg "[class=\"^chromium-blackeducation$\"] move container to workspace $ws2"

34
manager/workspaces/main Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
ws1=$(( $1*10 + 1 ))
ws2=$(( $1*10 + 2 ))
ws3=$(( $1*10 + 3 ))
ws4=$(( $1*10 + 4 ))
ws5=$(( $1*10 + 5 ))
ws6=$(( $1*10 + 6 ))
ws7=$(( $1*10 + 7 ))
ws8=$(( $1*10 + 8 ))
ws9=$(( $1*10 + 9 ))
ws10=$(( $1*10 + 10 ))
#1
i3-msg "exec xdg-open obsidian://open?vault=База%20знаний"
#2
chromium --class=chromium-main &
#3
chromium --class=chromium-invest --user-data-dir=$HOME/.config/Invest &
#8-10
i3-msg "workspace ${ws8}; exec i3-sensible-terminal --title \"term_main_8\""
i3-msg "workspace ${ws8}; exec i3-sensible-terminal --title \"term_main_9\""
i3-msg "workspace ${ws8}; exec i3-sensible-terminal --title \"term_main_10\""
sleep 6
i3-msg "[title=\".* - База знаний - Obsidian.*\"] move container to workspace ${ws1}"
i3-msg "[title=\"term_main_8\"] move container to workspace ${ws8}"
i3-msg "[title=\"term_main_9\"] move container to workspace ${ws9}"
i3-msg "[title=\"term_main_10\"] move container to workspace ${ws10}"
i3-msg "[class=\"^chromium-main$\"] move container to workspace ${ws2}"
i3-msg "[class=\"^chromium-invest$\"] move container to workspace ${ws3}"

View File

@ -0,0 +1,6 @@
#!/bin/bash
i3-msg "exec xdg-open obsidian://open?vault=База%20знаний"
i3-msg "exec xdg-open obsidian://open?vault=PIVODEVAT"
i3-msg "exec xdg-open obsidian://open?vault=Black%20Education"
i3-msg "exec xdg-open obsidian://open?vault=PunkCraft"

26
manager/workspaces/pivodevat Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
ws1=$(( $1*10 + 1 ))
ws2=$(( $1*10 + 2 ))
ws3=$(( $1*10 + 3 ))
ws4=$(( $1*10 + 4 ))
ws5=$(( $1*10 + 5 ))
ws6=$(( $1*10 + 6 ))
ws7=$(( $1*10 + 7 ))
ws8=$(( $1*10 + 8 ))
ws9=$(( $1*10 + 9 ))
ws10=$(( $1*10 + 10 ))
#1
i3-msg "exec xdg-open obsidian://open?vault=PIVODEVAT"
#2
chromium --class=chromium-media --user-data-dir=$HOME/.config/media &
i3-msg "workspace $ws9; exec flatpak run org.remmina.Remmina"
sleep 6
i3-msg "[title=\".* - PIVODEVAT - Obsidian.*\"] move container to workspace $ws1"
i3-msg "[class=\"^chromium-media$\"] move container to workspace $ws2"

51
manager/workspaces/punkcraft Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
ws1=$(( $1*10 + 1 ))
ws2=$(( $1*10 + 2 ))
ws3=$(( $1*10 + 3 ))
ws4=$(( $1*10 + 4 ))
ws5=$(( $1*10 + 5 ))
ws6=$(( $1*10 + 6 ))
ws7=$(( $1*10 + 7 ))
ws8=$(( $1*10 + 8 ))
ws9=$(( $1*10 + 9 ))
ws10=$(( $1*10 + 10 ))
#1
i3-msg "exec xdg-open obsidian://open?vault=PunkCraft"
#2
chromium --class=chromium-punkcraft --user-data-dir=$HOME/.config/punkcraft &
#3
i3-msg "workspace $ws3; exec i3-sensible-terminal --title \"term_pnk3\""
#7
i3-msg "workspace $ws7; exec dbeaver"
#8
i3-msg "workspace $ws8; exec krita"
#9
designer ~/dev/punkcraft/launcher/src/resources/mainwindow.ui &
#10
tmux new-session -d -s velocity -c /home/xuy/dev/punkcraft/velocity 'nvim .'
tmux new-session -d -s sponge -c /home/xuy/dev/punkcraft/sponge 'nvim .'
tmux new-session -d -s forge -c /home/xuy/dev/punkcraft/forge 'nvim .'
tmux new-session -d -s launcher -c /home/xuy/dev/punkcraft/launcher 'nvim .'
i3-msg "workspace $ws10; exec i3-sensible-terminal --title \"term_pnk10\" -e \"tmux attach -t forge\""
sleep 6
i3-msg "[title=\".* - PunkCraft - Obsidian.*\"] move container to workspace $ws1"
i3-msg "[class=\"chromium-punkcraft\"] move container to workspace $ws2"
i3-msg "[title=\"term_pnk7\"] move container to workspace $ws3"
i3-msg "[class=\"krita\"] move container to workspace $ws8"
i3-msg "[class=\"Designer\"] move container to workspace $ws9"
i3-msg "[title=\"term_pnk10\"] move container to workspace $ws10"
#i3-msg "[title=\"Qt.*Designer\"] move container to workspace 49"
sleep 7
i3-msg "[class=\"DBeaver\"] move container to workspace $ws7"