From a033f3e3cbeb255d8fa737addf8c8e5828788d38 Mon Sep 17 00:00:00 2001 From: q3aql Date: Wed, 4 Nov 2020 17:08:41 +0100 Subject: [PATCH] Added Script to map Win key to AltGr key (for SK71/SK64) --- linux/win-to-altgr_xmodmap.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 linux/win-to-altgr_xmodmap.sh diff --git a/linux/win-to-altgr_xmodmap.sh b/linux/win-to-altgr_xmodmap.sh new file mode 100755 index 0000000..67375fc --- /dev/null +++ b/linux/win-to-altgr_xmodmap.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +###################################### +# Script to map Win key to AltGr key # +# # +# Author: q3aql@protonmail.ch # +###################################### + +# Variables +xmodmap_config_dir=/tmp/.win-altgr +xmodmap_config_file=${xmodmap_config_dir}/super-key.key + +# Check dir and create/restore config +mkdir -p ${xmodmap_config_dir} +if [ -f ${xmodmap_config_file} ] ; then + echo "* Restoring original function of Win-Key..." + sleep 2 + restore_key=$(cat ${xmodmap_config_file}) + xmodmap -e "keycode ${restore_key} = Super_L" + rm -rf ${HOME}/.Xmodmap + rm -rf ${xmodmap_config_file} + echo "* Restored!" +else + echo "* Creating mapping of Win-Key to AltGr-Key..." + sleep 2 + win_key_detect=$(xmodmap -pke | grep Super_L | grep keycode | head -1 | cut -d " " -f 2) + echo ${win_key_detect} > ${xmodmap_config_file} + xmodmap -e "keycode ${win_key_detect} = ISO_Level3_Shift" + echo "keycode ${win_key_detect} = ISO_Level3_Shift" > ${HOME}/.Xmodmap + echo "* Created!" +fi