This repository has been archived by the owner on Dec 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlxqt2labwcexporter.in
57 lines (47 loc) · 1.96 KB
/
lxqt2labwcexporter.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Exports settings from LXQt x11 session to labwc/environment
# Executed once at session start
echo "Importing LXQt settings into labwc..."
labwc_settings=$XDG_CONFIG_HOME/labwc/environment
lxqt_settings=$XDG_CONFIG_HOME/lxqt/session.conf
# Keyboard layouts
layout_labwc=$(cat $labwc_settings |grep LAYOUT|cut -d '=' -f2-)
# Check if layouts are configured in LXQt x11
if grep -q layout "$lxqt_settings"; then
echo "Existing keyboard layout setting found in LXQt"
layout="XKB_DEFAULT_LAYOUT=$(cat $lxqt_settings| grep layout| sed 's/[^=]*=["]*\([^"]*\)["]*/\1/')"
else
layout="XKB_DEFAULT_LAYOUT=$(echo $LANG|cut -c 1,2)"
if echo "$layout" | grep -q "en"; then
layout=XKB_DEFAULT_LAYOUT=us
fi
fi
# Check if it is not configured already in labwc
if [ -z "$layout_labwc" ]; then
echo "No existing keyboard layout found in labwc, importing..."
echo $layout >> $labwc_settings
else
echo "Keyboard layout in labwc already configured"
fi
# Add toggle option only if more than one layout is configured
if [[ $layout == *,* ]]; then
# Import toggle layout setting at first run
options_lxqt=$(cat $lxqt_settings |grep options|cut -d '=' -f2-)
options_labwc=$(cat $labwc_settings |grep OPTIONS|cut -d '=' -f2-)
if [ -z "$options_labwc" ]; then
echo "No existing layout switch shortcut found in labwc, importing..."
echo XKB_DEFAULT_OPTIONS=$options_lxqt >> $labwc_settings
else
echo "Layout toggle shortcut in labwc already configured"
fi
else
echo "Only one layout present - toggle options skipped"
fi
# Sync labwc cursor env vars with LXQt settings
# remove existing lines
sed -i '/XCURSOR/d' $labwc_settings
# import LXQt settings
echo XCURSOR_SIZE=$(cat $lxqt_settings |grep _size| cut -d '=' -f2) >> $labwc_settings
echo XCURSOR_THEME=$(cat $lxqt_settings |grep theme| cut -d '=' -f2) >> $labwc_settings
echo "Imported cursor size and theme"
#todo XKB_DEFAULT_RULES, XKB_DEFAULT_MODEL, XKB_DEFAULT_VARIANT and