From 17164de6adc6f00838ae8e576b6f3aedf1c77042 Mon Sep 17 00:00:00 2001 From: thek4n Date: Sun, 9 Nov 2025 21:08:08 +0300 Subject: [PATCH] add script to switch kb layouts --- TARGETS.sh | 2 +- home/user/.config/i3/config | 6 +++++- home/user/.local/bin/switch-layout | 11 +++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100755 home/user/.local/bin/switch-layout diff --git a/TARGETS.sh b/TARGETS.sh index b7f2f0e..a796191 100644 --- a/TARGETS.sh +++ b/TARGETS.sh @@ -12,7 +12,7 @@ ssh: git:.config/git .local/bin/ga ranger:.config/ranger gpg: -i3:.xinitrc .xprofile .Xresources .config/i3 .config/i3blocks .config/rofi .config/picom .local/bin/slm .local/bin/slm_rofi.sh .local/bin/power_rofi.sh .local/bin/i3_switch_workspace.sh .config/mimeapps.list .local/bin/screenshot .local/bin/i3_swap_workspaces .local/bin/i3blocks_helper %pomodoro +i3:.xinitrc .xprofile .Xresources .config/i3 .config/i3blocks .config/rofi .config/picom .local/bin/slm .local/bin/slm_rofi.sh .local/bin/power_rofi.sh .local/bin/i3_switch_workspace.sh .config/mimeapps.list .local/bin/screenshot .local/bin/i3_swap_workspaces .local/bin/i3blocks_helper .local/bin/switch-layout %pomodoro pomodoro: bat:.config/bat font: diff --git a/home/user/.config/i3/config b/home/user/.config/i3/config index 0319835..40f7846 100644 --- a/home/user/.config/i3/config +++ b/home/user/.config/i3/config @@ -25,7 +25,8 @@ exec --no-startup-id unclutter -idle 0.3 -root exec_always --no-startup-id xset r rate 250 100 -exec_always --no-startup-id setxkbmap -model pc105 -layout us,ru -option grp:win_space_toggle -option ctrl:nocaps +exec_always --no-startup-id setxkbmap -model pc105 -layout us,ru -option ctrl:nocaps + # Wallpapers exec --no-startup-id nitrogen --restore; sleep 1; picom -b --config ~/.config/picom/picom.conf @@ -38,6 +39,9 @@ font xft:FiraCode $font_size # use pactl to adjust volume in PulseAudio. set $refresh_i3blocks exec pkill -SIGRTMIN+10 i3blocks set $refresh_i3blocks_language exec pkill -SIGRTMIN+11 i3blocks + +bindsym $mod+space exec --no-startup-id switch-layout && $refresh_i3blocks_language + bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3blocks bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3blocks bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3blocks diff --git a/home/user/.local/bin/switch-layout b/home/user/.local/bin/switch-layout new file mode 100755 index 0000000..51f55ae --- /dev/null +++ b/home/user/.local/bin/switch-layout @@ -0,0 +1,11 @@ +#!/bin/bash + +echo "here" > /tmp/test + +current=$(setxkbmap -query | grep layout | awk '{print $2}') + +if [ "${current}" = "us" ]; then + setxkbmap -model pc105 -option ctrl:nocaps ru +else + setxkbmap -model pc105 -option ctrl:nocaps us +fi