Browse Source

Swap keys using xkb instead of xmodmap

Removed old swap key lines from config and added dir/script to symlink
xkb file to lc dir. Fixes issue of having to release keys when starting
terminal with xmodmap.
red-hat-laptop
Kevin Mok 7 years ago
parent
commit
0bba4a0eb3
  1. 15
      aliases/zsh_aliases
  2. 11
      configs/set-config-dirs.sh
  3. 13
      configs/set-configs.sh
  4. 3
      dotfiles/Xresources
  5. 1
      dotfiles/vimrc
  6. 15
      dotfiles/zshrc
  7. 87
      xkb/NZXT-pc
  8. 11
      xkb/set-layouts.sh

15
aliases/zsh_aliases

@ -168,7 +168,7 @@ if [ "$(hostname)" = "NZXT" ]; then
alias sfa="f ~/Documents/self-authoring" alias sfa="f ~/Documents/self-authoring"
alias rcg="$cd_coding_dir/random-color-generator" alias rcg="$cd_coding_dir/random-color-generator"
alias dcr="$cd_coding_dir/dcr-logger" alias dcr="$cd_coding_dir/dcr-logger"
alias pf="$cd_coding_dir/ParsaFood"
alias prf="$cd_coding_dir/ParsaFood"
# swbot {{{ # # swbot {{{ #
alias sb="$cd_coding_dir/swbot" alias sb="$cd_coding_dir/swbot"
@ -204,14 +204,6 @@ fi
# laptop {{{ # laptop {{{
if [[ "$(hostname)" = "X1-Carbon" ]]; then if [[ "$(hostname)" = "X1-Carbon" ]]; then
# key swaps {{{ #
xmodmap -e "keycode 9 = Escape"
xmodmap -e "keycode 22 = Home"
xmodmap -e "keycode 119 = End"
xmodmap -e "keycode 110 = Delete"
xmodmap -e "keycode 115 = BackSpace"
# }}} key swaps #
alias gbl="xbacklight -get" alias gbl="xbacklight -get"
function bl() { xbacklight -set $(echo "scale=2;$1*10" | bc) ; } function bl() { xbacklight -set $(echo "scale=2;$1*10" | bc) ; }
@ -258,7 +250,7 @@ alias gcam="git commit --amend"
# todo: fix # todo: fix
function gcm(){ echo git commit -m \""$1"\" ; } function gcm(){ echo git commit -m \""$1"\" ; }
function gpsg() {
function psg() {
git add . git add .
git commit -m '.' git commit -m '.'
git push git push
@ -329,7 +321,7 @@ alias cdn="$cd_coding_dir"
ideas_dir="$coding_dir""/ideas" ideas_dir="$coding_dir""/ideas"
alias ids="f $ideas_dir" alias ids="f $ideas_dir"
alias lci="f $ideas_dir/general" alias lci="f $ideas_dir/general"
alias vli="ni $ideas_dir/ideas.md"
alias vli="ni $ideas_dir/general/ideas.md"
alias fyn="f $ideas_dir/yes-no" alias fyn="f $ideas_dir/yes-no"
alias ans="f /usr/local/android-studio/bin && ./studio.sh" alias ans="f /usr/local/android-studio/bin && ./studio.sh"
@ -417,6 +409,7 @@ function run() {
# temp {{{ # # temp {{{ #
alias m8="make checkpasswd && ./checkpasswd < passwd.in" alias m8="make checkpasswd && ./checkpasswd < passwd.in"
alias m3="make pfact && ./pfact.out 14" alias m3="make pfact && ./pfact.out 14"
function pf() { make pfact && ./pfact.out $1 ; }
alias 35w="c9 3-5_wait.c && ./3-5_wait.out abc a" alias 35w="c9 3-5_wait.c && ./3-5_wait.out abc a"
# }}} temp # # }}} temp #

11
configs/set-config-dirs.sh

@ -1,11 +0,0 @@
# Get directory variables from script.
. ../dirs.sh
# List of config dirs in system config dir that I want to link to.
# config_dirs=(neofetch i3 i3blocks sam-i3blocks ranger)
config_dirs=(neofetch i3 i3blocks ranger)
for cur_dir in $config_dirs; do
# Remove system file.
rm -rf "$sys_config_dir"/"$cur_dir"
# Link config file in repository to system config location.
ln -s "$config_dir"/"$pc"/"$cur_dir" "$sys_config_dir"/"$cur_dir"
done

13
configs/set-configs.sh

@ -1,12 +1,11 @@
# Get directory variables from script. # Get directory variables from script.
. ../dirs.sh . ../dirs.sh
# List of config files in system config dir that I want to link to.
config_files="neofetch/config.conf i3/config i3blocks/i3blocks.conf "\
"sam-i3blocks/sam-i3blocks.conf"
for file in $config_files; do
# List of config dirs in system config dir that I want to link to.
# config_dirs=(neofetch i3 i3blocks sam-i3blocks ranger)
config_dirs=(neofetch i3 i3blocks ranger)
for cur_dir in $config_dirs; do
# Remove system file. # Remove system file.
rm "$sys_config_dir"/"$file"
rm -rf "$sys_config_dir"/"$cur_dir"
# Link config file in repository to system config location. # Link config file in repository to system config location.
ln -s "$config_dir"/"$pc"/$(echo "$file" | cut -d'/' -f 1).conf \
"$sys_config_dir"/"$file"
ln -s "$config_dir"/"$pc"/"$cur_dir" "$sys_config_dir"/"$cur_dir"
done done

3
dotfiles/Xresources

@ -1,4 +1,5 @@
URxvt.font: xft:hack:size=14
! URxvt.font: xft:hack:size=14
URxvt.font: xft:hack:size=13
/* transparency {{{ */ /* transparency {{{ */
URxvt*inheritPixmap: true URxvt*inheritPixmap: true

1
dotfiles/vimrc

@ -144,6 +144,7 @@ let mapleader="\<Space>"
nnoremap <leader>cmt :%s/>\(.*\)>/<!---\1-->/g<CR> nnoremap <leader>cmt :%s/>\(.*\)>/<!---\1-->/g<CR>
" delete line into system clipboard " delete line into system clipboard
nnoremap <leader>D "+dd nnoremap <leader>D "+dd
nnoremap <leader>DA "+ggdG
" reload file " reload file
nnoremap <leader>e :e<CR> nnoremap <leader>e :e<CR>
" reload folds " reload folds

15
dotfiles/zshrc

@ -94,18 +94,13 @@ source ~/linux-config/aliases/zsh_aliases
# alias zshconfig="mate ~/.zshrc" # alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh" # alias ohmyzsh="mate ~/.oh-my-zsh"
if [ "$(whoami)" = "kevin" ]; then
# pywal
export PATH="${PATH}:${HOME}/.local/bin/" export PATH="${PATH}:${HOME}/.local/bin/"
(cat ~/.cache/wal/sequences &) (cat ~/.cache/wal/sequences &)
# keyboard delay/rate # keyboard delay/rate
xset r rate 200 60 xset r rate 200 60
fi
# NZXT
if [ "$(hostname)" = "NZXT" ];
then
xmodmap -e "clear Lock"
xmodmap -e "keycode 22 = Caps_Lock"
xmodmap -e "keycode 66 = BackSpace"
# else
# xrandr --dpi 150
# laptop
if [ "$(hostname)" = "X1-Carbon" ];
xrandr --dpi 125
fi fi

87
xkb/NZXT-pc

@ -0,0 +1,87 @@
default partial alphanumeric_keys modifier_keys
xkb_symbols "pc105" {
key <ESC> { [ Escape ] };
// The extra key on many European keyboards:
key <LSGT> { [ less, greater, bar, brokenbar ] };
// The following keys are common to all layouts.
key <BKSL> { [ backslash, bar ] };
key <SPCE> { [ space ] };
include "srvr_ctrl(fkey2vt)"
include "pc(editing)"
include "keypad(x11)"
key <BKSP> { [ Caps_Lock ] };
key <TAB> { [ Tab, ISO_Left_Tab ] };
key <RTRN> { [ Return ] };
key <CAPS> { [ BackSpace, BackSpace ] };
key <NMLK> { [ Num_Lock ] };
key <LFSH> { [ Shift_L ] };
key <LCTL> { [ Control_L ] };
key <LWIN> { [ Super_L ] };
key <RTSH> { [ Shift_R ] };
key <RCTL> { [ Control_R ] };
key <RWIN> { [ Super_R ] };
key <MENU> { [ Menu ] };
// Beginning of modifier mappings.
modifier_map Shift { Shift_L, Shift_R };
modifier_map Lock { Caps_Lock };
modifier_map Control{ Control_L, Control_R };
modifier_map Mod2 { Num_Lock };
modifier_map Mod4 { Super_L, Super_R };
// Fake keys for virtual<->real modifiers mapping:
key <LVL3> { [ ISO_Level3_Shift ] };
key <MDSW> { [ Mode_switch ] };
modifier_map Mod5 { <LVL3>, <MDSW> };
key <ALT> { [ NoSymbol, Alt_L ] };
include "altwin(meta_alt)"
key <META> { [ NoSymbol, Meta_L ] };
modifier_map Mod1 { <META> };
key <SUPR> { [ NoSymbol, Super_L ] };
modifier_map Mod4 { <SUPR> };
key <HYPR> { [ NoSymbol, Hyper_L ] };
modifier_map Mod4 { <HYPR> };
// End of modifier mappings.
key <OUTP> { [ XF86Display ] };
key <KITG> { [ XF86KbdLightOnOff ] };
key <KIDN> { [ XF86KbdBrightnessDown ] };
key <KIUP> { [ XF86KbdBrightnessUp ] };
};
hidden partial alphanumeric_keys
xkb_symbols "editing" {
key <PRSC> {
type= "PC_ALT_LEVEL2",
symbols[Group1]= [ Print, Sys_Req ]
};
key <SCLK> { [ Scroll_Lock ] };
key <PAUS> {
type= "PC_CONTROL_LEVEL2",
symbols[Group1]= [ Pause, Break ]
};
key <INS> { [ Insert ] };
key <HOME> { [ Home ] };
key <PGUP> { [ Prior ] };
key <DELE> { [ Delete ] };
key <END> { [ End ] };
key <PGDN> { [ Next ] };
key <UP> { [ Up ] };
key <LEFT> { [ Left ] };
key <DOWN> { [ Down ] };
key <RGHT> { [ Right ] };
};

11
xkb/set-layouts.sh

@ -0,0 +1,11 @@
# Get directory variables from script.
. ../dirs.sh
xkb_config_file_name="pc"
sys_layout_file="/usr/share/X11/xkb/symbols/$xkb_config_file_name"
xkb_config_dir="$linux_config_dir/xkb"
# Remove system file.
sudo rm -rf "$sys_layout_file"
# Link config file in repository to system config location.
sudo ln -s "$xkb_config_dir"/"$pc"-"$xkb_config_file_name" "$sys_layout_file"
Loading…
Cancel
Save