-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathlayoutset
executable file
·38 lines (29 loc) · 1.06 KB
/
layoutset
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Decription
# -----------
# Script to set keyboard layout depending if its Apple or regular keyboard + some settings
# Usage
# -----
# `layoutset`
udevadm trigger --subsystem-match=input --action=change
# Preserve layout for window
# Requires `sudo apt-get install kbdd`
if ! pgrep "kbdd" > /dev/null; then
if hash kbdd 2>/dev/null; then
kbdd
fi
fi
# Alt+Ctrl+Backspace restart, no caps lock, toggle via alt+shift, blink caps when aliternative layout is on
(setxkbmap lv && sleep 0.1s && setxkbmap -layout 'lv,ru' -option 'grp:alt_shift_toggle' -option 'terminate:ctrl_alt_bksp' -option 'ctrl:nocaps' -option 'grp_led:caps') &
# Disable insert
xmodmap -e "keycode 118 ="
# Unset caps is set previosly
xmodmap -e "clear lock"
# If Apple keyboard plugged in, swap left alt and win and put tilde back to left upper corner
if lsusb | grep Apple > /dev/null; then
#setxkbmap -option 'altwin:swap_lalt_lwin'
xmodmap -e "keycode 94 = grave asciitilde"
xmodmap -e "keycode 191 = Print Sys_Req"
else
setxkbmap -option altwin:left_meta_win
fi