aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr
diff options
context:
space:
mode:
authorJa.KooLit <85185940+JaKooLit@users.noreply.github.com>2024-05-21 22:02:23 +0900
committerGitHub <noreply@github.com>2024-05-21 22:02:23 +0900
commit47395723dff722fc06f4da5d50159aefd049a3ac (patch)
tree2e3c4cf8c0d7a2fa448712c2a1b3dd0f8277be85 /config/hypr
parent67da07ee3fdaaf65123e52d1d596a70fc69f30bb (diff)
parent543ac255b7387dd0d45d9b1dd8cbef78d49263dc (diff)
Merge pull request #292 from vailrahmatulin/main
Keyboard layout change fix and correction. Change of keybinds as well and now moved to UserConfigs directory
Diffstat (limited to 'config/hypr')
-rw-r--r--config/hypr/UserConfigs/UserKeybinds.conf1
-rw-r--r--config/hypr/UserConfigs/UserSettings.conf2
-rwxr-xr-xconfig/hypr/scripts/SwitchKeyboardLayout.sh37
3 files changed, 37 insertions, 3 deletions
diff --git a/config/hypr/UserConfigs/UserKeybinds.conf b/config/hypr/UserConfigs/UserKeybinds.conf
index eede1669..9858558f 100644
--- a/config/hypr/UserConfigs/UserKeybinds.conf
+++ b/config/hypr/UserConfigs/UserKeybinds.conf
@@ -27,6 +27,7 @@ bind = $mainMod, Z, exec, pypr zoom # Toggle Zoom
# User Added Keybinds
bind = $mainMod SHIFT, O, exec, $UserScripts/ZshChangeTheme.sh # Change oh-my-zsh theme
+bindn = ALT_L, SHIFT_L, exec, $scriptsDir/SwitchKeyboardLayout.sh # Changing the keyboard layout
# For passthrough keyboard into a VM
# bind = $mainMod ALT, P, submap, passthru
diff --git a/config/hypr/UserConfigs/UserSettings.conf b/config/hypr/UserConfigs/UserSettings.conf
index f8c8c2a2..38c83f2c 100644
--- a/config/hypr/UserConfigs/UserSettings.conf
+++ b/config/hypr/UserConfigs/UserSettings.conf
@@ -93,7 +93,7 @@ input {
kb_layout=us
kb_variant=
kb_model=
- kb_options=grp:alt_shift_toggle
+ kb_options=
kb_rules=
repeat_rate=50
repeat_delay=300
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
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage