diff options
| author | Ja.KooLit <85185940+JaKooLit@users.noreply.github.com> | 2024-05-24 13:52:30 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-24 13:52:30 +0900 |
| commit | 5acf937b57fd0c25baf26cae45e0f15862ab7d52 (patch) | |
| tree | dbcae5ec4d6c9199dcb482f313bef2bf461edb4f /config/hypr/scripts | |
| parent | 912f18dd534ea7244b7e453e65a84344b34b15b0 (diff) | |
| parent | 06d66be192eeb6f844d7069d05ffc34653352791 (diff) | |
Merge pull request #300 from JaKooLit/development
Pre-release stage: Development to Main
Diffstat (limited to 'config/hypr/scripts')
| -rwxr-xr-x | config/hypr/scripts/KeyHints.sh | 2 | ||||
| -rwxr-xr-x | config/hypr/scripts/SwitchKeyboardLayout.sh | 37 |
2 files changed, 37 insertions, 2 deletions
diff --git a/config/hypr/scripts/KeyHints.sh b/config/hypr/scripts/KeyHints.sh index 9d29dda4..55ed6903 100755 --- a/config/hypr/scripts/KeyHints.sh +++ b/config/hypr/scripts/KeyHints.sh @@ -58,6 +58,8 @@ yad --width=$dynamic_width --height=$dynamic_height \ " Print" "screenshot" "(grim)" \ " Shift Print" "screenshot region" "(grim + slurp)" \ " Shift S" "screenshot region" "(swappy)" \ +" CTRL Print" "screenshot timer 5 secs " "(grim)" \ +" CTRL SHIFT Print" "screenshot timer 10 secs " "(grim)" \ "ALT Print" "Screenshot active window" "active window only" \ "CTRL ALT P" "power-menu" "(wlogout)" \ "CTRL ALT L" "screen lock" "(hyprlock)" \ diff --git a/config/hypr/scripts/SwitchKeyboardLayout.sh b/config/hypr/scripts/SwitchKeyboardLayout.sh index 0145e262..cbacd74f 100755 --- a/config/hypr/scripts/SwitchKeyboardLayout.sh +++ b/config/hypr/scripts/SwitchKeyboardLayout.sh @@ -41,5 +41,38 @@ new_layout="${layout_mapping[next_index]}" hyprctl switchxkblayout "at-translated-set-2-keyboard" "$new_layout" echo "$new_layout" > "$layout_f" -# Notification for the new keyboard layout -notify-send -u low -i "$notif" "new KB_Layout: $new_layout" +# Created by T-Crypt + +get_keyboard_names() { + hyprctl devices -j | jq -r '.keyboards[].name' +} + +change_layout() { + local got_error=false + + while read -r name; do + hyprctl switchxkblayout "$name" next + if [[ $? -eq 0 ]]; then + echo "Switched the layout for $name." + else + >&2 echo "Error while switching the layout for $name." + got_error=true + fi + done <<< "$(get_keyboard_names)" + + if [ "$got_error" = true ]; then + >&2 echo "Some errors were found during the process..." + return 1 + fi + + return 0 # All layouts had been cycled successfully +} + +if ! change_layout; then + notify-send -u low -t 2000 'Keyboard layout' 'Error: Layout change failed' + >&2 echo "Layout change failed." + exit 1 +else + # Notification for the new keyboard layout + notify-send -u low -i "$notif" "new KB_Layout: $new_layout" +fi |
