mirror of
https://github.com/rbreaves/kinto.git
synced 2025-08-03 17:46:39 +02:00
- Added manual keyswap file. Also added comments to xactive script.
This commit is contained in:
50
system-config/keyswap_toggle.sh
Executable file
50
system-config/keyswap_toggle.sh
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Manual keyswap
|
||||||
|
systemtype=$1
|
||||||
|
swapbehavior=$2
|
||||||
|
|
||||||
|
swapcmd_term="setxkbmap -option;setxkbmap -option altwin:swap_alt_win"
|
||||||
|
fallbackcmd_gui=""
|
||||||
|
if [[ "$systemtype" == "windows" || "$systemtype" == "mac" ]]; then
|
||||||
|
swapcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY"
|
||||||
|
elif [[ "$systemtype" == "mac_only" ]]; then
|
||||||
|
swapcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY"
|
||||||
|
# Chromebook keyboard options
|
||||||
|
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_term="setxkbmap -option;setxkbmap -device $internalid -option 'altwin:swap_alt_win'"
|
||||||
|
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"
|
||||||
|
fallbackcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY"
|
||||||
|
elif [[ "$swapbehavior" == "none" ]]; then
|
||||||
|
swapcmd_gui="setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$swapbehavior" == "both_win" ]]; then
|
||||||
|
check=`setxkbmap -query | grep -q 'ctrl_alt_win'; echo $?`
|
||||||
|
else
|
||||||
|
check=`setxkbmap -query | grep -c 'swap_alt_win'`
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $check
|
||||||
|
if [ $check -eq 0 ]; then
|
||||||
|
echo "internal gui to term"
|
||||||
|
eval "$swapcmd_term"
|
||||||
|
|
||||||
|
# Quick hack, will want to refactor later
|
||||||
|
# just resets required checks, for chromebooks that
|
||||||
|
# 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
|
||||||
|
else
|
||||||
|
echo "internal term to gui"
|
||||||
|
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"
|
||||||
|
check_tg="setxkbmap -query | grep -q 'swap_alt_win'"
|
||||||
|
fi
|
||||||
|
fi
|
@@ -18,10 +18,12 @@ if [[ "$systemtype" == "windows" || "$systemtype" == "mac" ]]; 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 'swap_alt_win' 1>/dev/null"
|
check_gt="setxkbmap -query | grep -v 'swap_alt_win' 1>/dev/null"
|
||||||
check_tg="setxkbmap -query | grep -q 'swap_alt_win'"
|
check_tg="setxkbmap -query | grep -q 'swap_alt_win'"
|
||||||
|
# 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_gt="setxkbmap -query | grep -v 'alt_super_win' 1>/dev/null"
|
||||||
check_tg="setxkbmap -query | grep -q 'alt_super_win'"
|
check_tg="setxkbmap -query | grep -q 'alt_super_win'"
|
||||||
|
# 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'"
|
||||||
|
Reference in New Issue
Block a user