- Several changes, need to do more testing before merging into master. It appears to work on chromebooks though, the more difficult of the 3.

This commit is contained in:
Ryan Reaves
2019-07-30 02:33:52 -05:00
parent 930279ba9e
commit 53ad0d579f
6 changed files with 78 additions and 63 deletions

8
system-config/keyswap.service Normal file → Executable file
View File

@@ -1,15 +1,15 @@
[Unit]
Description=keyswap for Terminal and GUI
After=syslog.target
PartOf=graphical-session.target
[Service]
Type=simple
User={username}
Group={username}
#User={username}
#Group={username}
Environment=DISPLAY=:0
Restart=always
WorkingDirectory=/home/{username}/.config/
ExecStart=
[Install]
WantedBy=multi-user.target
WantedBy=default.target

3
system-config/keyswap.sh Executable file
View File

@@ -0,0 +1,3 @@
#/bin/bash
systemctl --user start keyswap

View File

@@ -30,8 +30,8 @@ elif [[ "$swapbehavior" == "none" ]]; then
check_tg="setxkbmap -query | grep -q 'swap_alt_win'"
fi
# echo "$systemtype $swapbehavior"
# echo "$swapcmd_gui"
echo "$systemtype $swapbehavior"
echo "$swapcmd_gui"
# regex for extracting hex id's
grep_id='0[xX][a-zA-Z0-9]\{7\}'
@@ -48,7 +48,7 @@ while read -r id; do
if [ -n "$class" ]; then
# Set keymap for terminal, Alt is Super, Ctrl is Ctrl, Super is Alt
if [[ $internalid -gt 0 ]]; then
eval "$check_gt;echo $?"
eval "$check_gt"
if [ $? -eq 0 ]; then
echo "internal gui to term"
eval "$swapcmd_term"
@@ -65,10 +65,10 @@ while read -r id; do
else
# Set keymap for gui, Alt is Ctrl,Super is Alt, Ctrl is Super
if [[ $internalid -gt 0 ]]; then
eval "$check_tg;echo $?"
eval "$check_tg"
if [ $? -eq 0 ]; then
echo "internal term to gui"
eval "$swapcmd_gui;echo $?"
eval "$swapcmd_gui"
if [ $? -eq 0 ] && [[ "$swapbehavior" == "both_win" ]]; then
eval "$fallbackcmd_gui"
check_gt="setxkbmap -query | grep -v 'swap_alt_win' 1>/dev/null"