-
Notifications
You must be signed in to change notification settings - Fork 0
/
lxqt2kwinexporter.in
executable file
·33 lines (30 loc) · 1.15 KB
/
lxqt2kwinexporter.in
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
#!/bin/bash
# Set keyboard layout for kwin_wayland
kxkbrc=$XDG_CONFIG_HOME/kxkbrc
#kwin_layout=$(cat $kxkbrc |grep LayoutList|cut -d '=' -f2-)
lxqt_settings=$XDG_CONFIG_HOME/lxqt/session.conf
if grep -q layout "$lxqt_settings"; then
echo "Existing keyboard layout setting found in LXQt"
layout_list="LayoutList=$(cat $lxqt_settings| grep layout| sed 's/[^=]*=["]*\([^"]*\)["]*/\1/')"
else
echo "Not configured under LXQt x11, using '$LANG' as fallback"
layout_list="LayoutList=$(echo $LANG|cut -c 1,2)"
if echo "layout_list" | grep -q "en"; then # don't write `LayoutList=en`
layout_list=LayoutList=us
fi
fi
# Check if kwin keyboard config file exists
if [ -f $XDG_CONFIG_HOME/kxkbrc ]; then
echo "kxkbrc found"
# Check if the file contains "LayoutList"
if grep -q "LayoutList" "$kxkbrc"; then
echo "Layout already configured for Kwin"
else
echo "kxkbrc does not contain 'LayoutList, exporting...'"
echo $layout_list >> $XDG_CONFIG_HOME/kxkbrc
fi
else
echo "No kxkbrc found, creating keyboard settings"
echo "[Layout]" > $XDG_CONFIG_HOME/kxkbrc
echo $layout_list >> $XDG_CONFIG_HOME/kxkbrc
fi