aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/Tak0-Per-Window-Switch.sh
diff options
context:
space:
mode:
authorDonald Williams <129223418+dwilliam62@users.noreply.github.com>2025-12-23 23:48:04 -0500
committerGitHub <noreply@github.com>2025-12-23 23:48:04 -0500
commit7450439d789bf191ec97b04c89ecd84922e4cb4b (patch)
treede282f02c6e9c7c2fe1dabab3425ed5f2c68cc27 /config/hypr/scripts/Tak0-Per-Window-Switch.sh
parent4ca3cc077bd32e0375d68f303e76b92a5c5d52e0 (diff)
parent71181a305f5530aee6248209e4fb3e45ca22c140 (diff)
Merge pull request #891 from JaKooLit/kb-fix
Fixed SwitchKeyboardLayout was sourcing wrong file
Diffstat (limited to 'config/hypr/scripts/Tak0-Per-Window-Switch.sh')
-rwxr-xr-xconfig/hypr/scripts/Tak0-Per-Window-Switch.sh33
1 files changed, 16 insertions, 17 deletions
diff --git a/config/hypr/scripts/Tak0-Per-Window-Switch.sh b/config/hypr/scripts/Tak0-Per-Window-Switch.sh
index 76b6ad2d..7879fb85 100755
--- a/config/hypr/scripts/Tak0-Per-Window-Switch.sh
+++ b/config/hypr/scripts/Tak0-Per-Window-Switch.sh
@@ -1,5 +1,5 @@
##################################################################
-# #
+# #
# #
# TAK_0'S Per-Window-Switch #
# #
@@ -7,21 +7,14 @@
# #
# Just a little script that I made to switch keyboard layouts #
# per-window instead of global switching for the more #
-# smooth and comfortable workflow. #
+# smooth and comfortable workflow. #
# #
##################################################################
-
-
-
-
-
-
-
-# This is for changing kb_layouts. Set kb_layouts in
+# This is for changing kb_layouts. Set kb_layouts in
MAP_FILE="$HOME/.cache/kb_layout_per_window"
-CFG_FILE="$HOME/.config/hypr/UserConfigs/UserSettings.conf"
+CFG_FILE="$HOME/.config/hypr/configs/SystemSettings.conf"
ICON="$HOME/.config/swaync/images/ja.png"
SCRIPT_NAME="$(basename "$0")"
@@ -49,8 +42,8 @@ get_keyboards() {
# Save window-specific layout
save_map() {
local W=$1 L=$2
- grep -v "^${W}:" "$MAP_FILE" > "$MAP_FILE.tmp"
- echo "${W}:${L}" >> "$MAP_FILE.tmp"
+ grep -v "^${W}:" "$MAP_FILE" >"$MAP_FILE.tmp"
+ echo "${W}:${L}" >>"$MAP_FILE.tmp"
mv "$MAP_FILE.tmp" "$MAP_FILE"
}
@@ -82,7 +75,7 @@ cmd_toggle() {
break
fi
done
- NEXT=$(( (i+1) % count ))
+ NEXT=$(((i + 1) % count))
do_switch "$NEXT"
save_map "$W" "${kb_layouts[NEXT]}"
notify-send -u low -i "$ICON" "kb_layout: ${kb_layouts[NEXT]}"
@@ -104,7 +97,10 @@ cmd_restore() {
# Listen to focus events and restore window-specific layouts
subscribe() {
local SOCKET2="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"
- [[ -S "$SOCKET2" ]] || { echo "Error: Hyprland socket not found." >&2; exit 1; }
+ [[ -S "$SOCKET2" ]] || {
+ echo "Error: Hyprland socket not found." >&2
+ exit 1
+ }
socat -u UNIX-CONNECT:"$SOCKET2" - | while read -r line; do
[[ "$line" =~ ^activewindow ]] && cmd_restore
@@ -118,6 +114,9 @@ fi
# CLI
case "$1" in
- toggle|"") cmd_toggle ;;
- *) echo "Usage: $SCRIPT_NAME [toggle]" >&2; exit 1 ;;
+toggle | "") cmd_toggle ;;
+*)
+ echo "Usage: $SCRIPT_NAME [toggle]" >&2
+ exit 1
+ ;;
esac
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage