From d8ade3780a167b7c6a2ec72ab03824e54fe5c35e Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Wed, 14 Mar 2018 07:12:31 -0400 Subject: [PATCH] Fixes #54, setup xkb on laptop Functions: - tar/unzip that remove original file after extraction - remove directory - sudo nvim Vim leader mappings: - delete entire buffer into system clipboard - find merge conflicts --- aliases/zsh_aliases | 9 ++- configs/X1-Carbon/i3/config | 13 ++-- configs/X1-Carbon/i3blocks/i3blocks.conf | 2 +- dotfiles/Xresources | 4 +- dotfiles/vimrc | 3 + dotfiles/zshrc | 4 ++ xkb/X1-Carbon-pc | 87 ++++++++++++++++++++++++ xkb/set-layouts.sh | 3 + 8 files changed, 111 insertions(+), 14 deletions(-) create mode 100644 xkb/X1-Carbon-pc diff --git a/aliases/zsh_aliases b/aliases/zsh_aliases index 05d7c6c..4909a0f 100644 --- a/aliases/zsh_aliases +++ b/aliases/zsh_aliases @@ -33,7 +33,8 @@ function rgrp() { grep -r $1 * ; } function cpd() { cp -avr $1 $2 ; } # extract tar archive -function untar() { tar -xzvf $1 ; } +function untar() { tar -xzvf $1 && rm $1; } +function runzip() { unzip $1 && rm $1; } # }}} command line related # # directory-related {{{ # @@ -44,6 +45,7 @@ function f() { cd $1 && pwd > ~/.last_dir && ls -a ; } if [ -f ~/.last_dir ] then cd `cat ~/.last_dir` fi +function rmr() { rm -rf $1 ; } # todo: fix # function f.() { f $(printf "%0.s../" $(seq 1 $1 )) ; } @@ -100,11 +102,12 @@ alias rg="ranger" function ok() { okular $1 & ; } function chr() { google-chrome $1 ; } function ni() { nvim $1 ; } +function sni() { sudo nvim $1 ; } alias nisw="f ~/.local/share/nvim/swap" # function mrk() { pandoc -o ${1%.*}.html $1 && chr ${1%.*}.html ; } function mrk() { pandoc -o ${1%.*}.html $1 ; } -alias vbn="cvlc --loop --alsa-gain 1 ~/Downloads/brown-noise.mp3" +alias vbn="cvlc --loop --alsa-gain 1 ~/Music/brown-noise.mp3" alias vlm="alsamixer -c 2" alias rmsw="rm .sw*" @@ -409,7 +412,7 @@ function run() { # temp {{{ # alias m8="make checkpasswd && ./checkpasswd < passwd.in" alias m3="make pfact && ./pfact.out 14" -function pf() { make pfact && ./pfact.out $1 ; } +function pf() { ./pfact.out $1 ; } alias 35w="c9 3-5_wait.c && ./3-5_wait.out abc a" # }}} temp # diff --git a/configs/X1-Carbon/i3/config b/configs/X1-Carbon/i3/config index 9d03840..b747d7a 100644 --- a/configs/X1-Carbon/i3/config +++ b/configs/X1-Carbon/i3/config @@ -2,15 +2,10 @@ # startup {{{ # exec redshift -O 4000 -exec_always /home/kevin/.local/bin/wal -i "/home/kevin/Pictures/Backgrounds/" +exec /home/kevin/.local/bin/wal -i "/home/kevin/Pictures/Backgrounds/" # exec_always /home/kevin/.local/bin/wal -i "/home/kevin/Pictures/Backgrounds/japan-street.jpg" exec imwheel -# enable horizontal scrolling -exec --no-startup-id synclient HorizTwoFingerScroll=1 -# disable touchscreen -exec xinput disable 12 exec $def_term -reload # }}} startup # set $def_term "rxvt-unicode" @@ -129,8 +124,10 @@ bindsym $mod+F10 workspace $ws10; exec $def_term # ws bindings {{{ # # switch to workspace -bindsym $mod+plus workspace next -bindsym $mod+minus workspace prev +# bindsym $mod+plus workspace next +# bindsym $mod+minus workspace prev +bindsym $mod+minus move workspace to output left +bindsym $mod+plus move workspace to output right bindsym $mod+1 workspace $ws1 bindsym $mod+2 workspace $ws2 diff --git a/configs/X1-Carbon/i3blocks/i3blocks.conf b/configs/X1-Carbon/i3blocks/i3blocks.conf index f2a295a..85db6d8 100644 --- a/configs/X1-Carbon/i3blocks/i3blocks.conf +++ b/configs/X1-Carbon/i3blocks/i3blocks.conf @@ -61,7 +61,7 @@ interval=60 [wifi] label=🖧 instance=wlp3s0 -interval=10 +interval=5 # }}} wifi # # time {{{ # diff --git a/dotfiles/Xresources b/dotfiles/Xresources index b9715bd..ae525dd 100644 --- a/dotfiles/Xresources +++ b/dotfiles/Xresources @@ -5,8 +5,8 @@ URxvt.font: xft:hack:size=13 URxvt*inheritPixmap: true URxvt*transparent: true ! URxvt*shading: 0 to 99 darkens, 101 to 200 lightens -! URxvt*shading: 40 -URxvt*shading: 20 +URxvt*shading: 40 +! URxvt*shading: 20 /* }}} transparency */ URxvt.scrollBar: false diff --git a/dotfiles/vimrc b/dotfiles/vimrc index 4ecb5f7..ba83cc1 100644 --- a/dotfiles/vimrc +++ b/dotfiles/vimrc @@ -144,9 +144,12 @@ let mapleader="\" nnoremap cmt :%s/>\(.*\)>//g " delete line into system clipboard nnoremap D "+dd +" delete entire buffer into system clipboard nnoremap DA "+ggdG " reload file nnoremap e :e +" find merge conflicts +nnoremap fc /[<>=]\{7\} " reload folds nnoremap ff :set foldmethod=marker zM " toggle search highlighting diff --git a/dotfiles/zshrc b/dotfiles/zshrc index 3c46dc6..d5f49ca 100644 --- a/dotfiles/zshrc +++ b/dotfiles/zshrc @@ -102,5 +102,9 @@ export PATH="${PATH}:${HOME}/.local/bin/" xset r rate 200 60 # laptop if [ "$(hostname)" = "X1-Carbon" ]; +then xrandr --dpi 125 + xinput disable "ELAN Touchscreen" + # enable horizontal scrolling + synclient HorizTwoFingerScroll=1 fi diff --git a/xkb/X1-Carbon-pc b/xkb/X1-Carbon-pc new file mode 100644 index 0000000..a5295a1 --- /dev/null +++ b/xkb/X1-Carbon-pc @@ -0,0 +1,87 @@ +default partial alphanumeric_keys modifier_keys +xkb_symbols "pc105" { + + key { [ Escape ] }; + + // The extra key on many European keyboards: + key { [ less, greater, bar, brokenbar ] }; + + // The following keys are common to all layouts. + key { [ backslash, bar ] }; + key { [ space ] }; + + include "srvr_ctrl(fkey2vt)" + include "pc(editing)" + include "keypad(x11)" + + key { [ BackSpace, BackSpace ] }; + + key { [ Tab, ISO_Left_Tab ] }; + key { [ Return ] }; + + key { [ Caps_Lock ] }; + key { [ Num_Lock ] }; + + key { [ Shift_L ] }; + key { [ Control_L ] }; + key { [ Super_L ] }; + + key { [ Shift_R ] }; + key { [ Control_R ] }; + key { [ Super_R ] }; + key { [ 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 { [ ISO_Level3_Shift ] }; + key { [ Mode_switch ] }; + modifier_map Mod5 { , }; + + key { [ NoSymbol, Alt_L ] }; + include "altwin(meta_alt)" + + key { [ NoSymbol, Meta_L ] }; + modifier_map Mod1 { }; + + key { [ NoSymbol, Super_L ] }; + modifier_map Mod4 { }; + + key { [ NoSymbol, Hyper_L ] }; + modifier_map Mod4 { }; + // End of modifier mappings. + + key { [ XF86Display ] }; + key { [ XF86KbdLightOnOff ] }; + key { [ XF86KbdBrightnessDown ] }; + key { [ XF86KbdBrightnessUp ] }; +}; + +hidden partial alphanumeric_keys +xkb_symbols "editing" { + key { + type= "PC_ALT_LEVEL2", + symbols[Group1]= [ Print, Sys_Req ] + }; + key { [ Scroll_Lock ] }; + key { + type= "PC_CONTROL_LEVEL2", + symbols[Group1]= [ Pause, Break ] + }; + key { [ Insert ] }; + key { [ Home ] }; + key { [ Prior ] }; + key { [ Delete ] }; + key { [ End ] }; + key { [ Next ] }; + + key { [ Up ] }; + key { [ Left ] }; + key { [ Down ] }; + key { [ Right ] }; +}; diff --git a/xkb/set-layouts.sh b/xkb/set-layouts.sh index a18fbbe..ae06720 100755 --- a/xkb/set-layouts.sh +++ b/xkb/set-layouts.sh @@ -5,6 +5,9 @@ xkb_config_file_name="pc" sys_layout_file="/usr/share/X11/xkb/symbols/$xkb_config_file_name" xkb_config_dir="$linux_config_dir/xkb" +# Copy system file into xkb_config_dir. +# cp "$sys_layout_file" ./"$pc"-"$xkb_config_file_name" + # Remove system file. sudo rm -rf "$sys_layout_file" # Link config file in repository to system config location.