mirror of
https://github.com/rbreaves/kinto.git
synced 2025-08-06 19:08:27 +02:00
- Updated keyswap service and xactive to use kintox11 binary over xprop
This commit is contained in:
@@ -16,6 +16,8 @@ if [[ "$swapbehavior" == "1" ]]; then
|
|||||||
cp ./system-config/keyswap.sh ~/.config/autostart/keyswap.sh
|
cp ./system-config/keyswap.sh ~/.config/autostart/keyswap.sh
|
||||||
cp ./system-config/xactive.sh ~/.config/xactive.sh
|
cp ./system-config/xactive.sh ~/.config/xactive.sh
|
||||||
cp ./system-config/keyswap_toggle.sh ~/.config/keyswap_toggle.sh
|
cp ./system-config/keyswap_toggle.sh ~/.config/keyswap_toggle.sh
|
||||||
|
cp ./kintox11/binary/kintox11_ubuntu19-10 ~/.config/kintox11
|
||||||
|
cp ./kintox11/binary/appnames.csv ~/.config/appnames.csv
|
||||||
sed -i "s/{username}/`whoami`/g" ~/.config/systemd/user/keyswap.service
|
sed -i "s/{username}/`whoami`/g" ~/.config/systemd/user/keyswap.service
|
||||||
sed -i "s/ExecStart=/ExecStart=${swapcmd}/g" ~/.config/systemd/user/keyswap.service
|
sed -i "s/ExecStart=/ExecStart=${swapcmd}/g" ~/.config/systemd/user/keyswap.service
|
||||||
systemctl --user enable keyswap
|
systemctl --user enable keyswap
|
||||||
|
@@ -1,9 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# How to add more terminal editors
|
|
||||||
# run this command while using the terminal
|
|
||||||
# and add the name to class_name
|
|
||||||
# xprop -id $(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2) WM_CLASS
|
|
||||||
class_name='konsole\|Gnome-terminal\|terminator\|sakura\|guake\|tilda\|xterm\|eterm'
|
|
||||||
|
|
||||||
systemtype=$1
|
systemtype=$1
|
||||||
internalid=$2
|
internalid=$2
|
||||||
@@ -21,73 +16,46 @@ if [[ "$systemtype" == "windows" || "$systemtype" == "mac" ]]; then
|
|||||||
# mac_only is for apple keyboards without an apple hid driver
|
# mac_only is for apple keyboards without an apple hid driver
|
||||||
elif [[ "$systemtype" == "mac_only" ]]; then
|
elif [[ "$systemtype" == "mac_only" ]]; then
|
||||||
swapcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY"
|
swapcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY"
|
||||||
check_gt="setxkbmap -query | grep -v 'alt_super_win' 1>/dev/null"
|
|
||||||
check_tg="setxkbmap -query | grep -q 'alt_super_win'"
|
|
||||||
swapcmd_term="setxkbmap -option"
|
swapcmd_term="setxkbmap -option"
|
||||||
# Chromebook options
|
# Chromebook options
|
||||||
elif [[ "$swapbehavior" == "both_mac" ]]; then
|
elif [[ "$swapbehavior" == "both_mac" ]]; then
|
||||||
swapcmd_gui="setxkbmap -option;setxkbmap -option ctrl:swap_lwin_lctl; xkbcomp -w0 -i $internalid -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY"
|
swapcmd_gui="setxkbmap -option;setxkbmap -option ctrl:swap_lwin_lctl; xkbcomp -w0 -i $internalid -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY"
|
||||||
swapcmd_term="setxkbmap -option;setxkbmap -device $internalid -option 'altwin:swap_alt_win'"
|
swapcmd_term="setxkbmap -option;setxkbmap -device $internalid -option 'altwin:swap_alt_win'"
|
||||||
check_gt="setxkbmap -query | grep -v 'swap_alt_win' 1>/dev/null"
|
|
||||||
check_tg="setxkbmap -query | grep -q 'swap_alt_win'"
|
|
||||||
elif [[ "$swapbehavior" == "both_win" ]]; then
|
elif [[ "$swapbehavior" == "both_win" ]]; then
|
||||||
swapcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY; setxkbmap -device $usbid -option altwin:ctrl_alt_win"
|
swapcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY; setxkbmap -device $usbid -option altwin:ctrl_alt_win"
|
||||||
fallbackcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY"
|
fallbackcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY"
|
||||||
check_gt="setxkbmap -query | grep -q 'ctrl_alt_win'"
|
|
||||||
check_tg="setxkbmap -query | grep -v 'ctrl_alt_win' 1>/dev/null"
|
|
||||||
elif [[ "$swapbehavior" == "none" ]]; then
|
elif [[ "$swapbehavior" == "none" ]]; then
|
||||||
swapcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY"
|
swapcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY"
|
||||||
check_gt="setxkbmap -query | grep -v 'swap_alt_win' 1>/dev/null"
|
|
||||||
check_tg="setxkbmap -query | grep -q 'swap_alt_win'"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# echo "$systemtype $swapbehavior"
|
|
||||||
# echo "$swapcmd_gui"
|
|
||||||
|
|
||||||
eval "$swapcmd_gui"
|
eval "$swapcmd_gui"
|
||||||
|
|
||||||
# regex for extracting hex id's
|
# If running gnome this will disable the overlay-key mapping
|
||||||
grep_id='0[xX][a-zA-Z0-9]\+'
|
gsettings set org.gnome.mutter overlay-key ''
|
||||||
|
|
||||||
#Storing timestamp and will use timediff to prevent xprop duplicates
|
./kintox11 |
|
||||||
timestp=$(date +%s)
|
|
||||||
|
|
||||||
xprop -spy -root _NET_ACTIVE_WINDOW | grep --line-buffered -o $grep_id |
|
|
||||||
while read -r id; do
|
while read -r id; do
|
||||||
class="`xprop -id $id WM_CLASS | grep $class_name`"
|
if [[ "$id" == "term" ]]; then
|
||||||
newtime=$(date +%s)
|
|
||||||
timediff=$((newtime-timestp))
|
|
||||||
if [ $timediff -gt 0 ]; then
|
|
||||||
if [ -n "$class" ]; then
|
|
||||||
# Set keymap for terminal, Alt is Super, Ctrl is Ctrl, Super is Alt
|
|
||||||
eval "$check_gt"
|
|
||||||
echo $?
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "internal gui to term"
|
echo "internal gui to term"
|
||||||
eval "$swapcmd_term"
|
eval "$swapcmd_term"
|
||||||
|
|
||||||
# Quick hack, will want to refactor later
|
# Gnome - Set Activities Overview
|
||||||
# just resets required checks, for chromebooks that
|
gsettings set org.gnome.desktop.wm.keybindings panel-main-menu "['<Super>Space']"
|
||||||
# use usb windows keyboards
|
|
||||||
if [[ "$swapbehavior" == "both_win" ]]; then
|
|
||||||
check_gt="setxkbmap -query | grep -q 'ctrl_alt_win'"
|
|
||||||
check_tg="setxkbmap -query | grep -v 'ctrl_alt_win' 1>/dev/null"
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
else
|
if [[ "$id" == "gui" ]]; then
|
||||||
# Set keymap for gui, Alt is Ctrl,Super is Alt, Ctrl is Super
|
|
||||||
eval "$check_tg"
|
|
||||||
echo $?
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "internal term to gui"
|
echo "internal term to gui"
|
||||||
eval "$swapcmd_gui"
|
eval "$swapcmd_gui"
|
||||||
if [ $? -eq 0 ] && [[ "$swapbehavior" == "both_win" ]]; then
|
|
||||||
eval "$fallbackcmd_gui"
|
# Gnome - Set Activities Overview
|
||||||
check_gt="setxkbmap -query | grep -v 'swap_alt_win' 1>/dev/null"
|
gsettings set org.gnome.desktop.wm.keybindings panel-main-menu "['<Ctrl>Space']"
|
||||||
check_tg="setxkbmap -query | grep -q 'swap_alt_win'"
|
|
||||||
fi
|
# # Fallback code
|
||||||
fi
|
# if [ $? -eq 0 ] && [[ "$swapbehavior" == "both_win" ]]; then
|
||||||
fi
|
# eval "$fallbackcmd_gui"
|
||||||
timestp=$(date +%s)
|
# check_gt="setxkbmap -query | grep -v 'swap_alt_win' 1>/dev/null"
|
||||||
|
# check_tg="setxkbmap -query | grep -q 'swap_alt_win'"
|
||||||
|
# fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
Reference in New Issue
Block a user