#!/bin/bash ## ====================================================== ## === XKBSET.sh to set the XKB keyboard options === ## === by Øystein Bech "DreymaR" Gadmar, 2014 === ## ====================================================== HeadStr="DreymaR's setxkbmap script (by GadOE, 2015-01)" DescStr=\ "\e[1mShell script to change X.org keyboard setup\e[0m\n"\ " using the 'setxkbmap' command.\n"\ " To override system settings after logon,\n"\ " source it, e.g., in your ~/.bashrc file,\n"\ " or use -a to write the setxkbmap command to a file.\n" FootStr="Happy xkb-hacking! ~ Øystein Bech 'DreymaR' Gadmar" ## NOTE: It now works with local xkb(-mod) dir # By default, setxkbmap checks ./rules first! # Need a full xkb dir then (not just the xkb-mod files) ## NOTE: I made a handy shorthand for activating simple cmk_ed model/layout combos. # Example: -s '5w no us' activates model pc105awide-sl, layout no(cmk_ed_us) # Models: 4n 4a(pc104angle-z) 4w(pc104wide-qu) 4aw(pc104awide-zqu) 4f(pc104aframe) # 5n 5a(pc105angle-lg) 5w/5aw(pc105awide-sl) # Options left out of this: Too complex (replace all or add another, and if so, how?) ##-------------- init ------------------------------------------ ## NOTE: '#(-a)' means that the value can be set by a command-line argument '-a ' #~ MyDATE=`date +"%Y-%m-%d_%H-%M"` MyNAME=`basename $0` #~ MyPATH=`dirname $0` ## @@@ The default X11 dir under Debian/Ubuntu/etc is /usr/share/X11 @@@ ## @@@ The default X11 dir under some (older) distros is /usr/lib/X11 @@@ X11DIR='/usr/share/X11'; [ -d "${X11DIR}" ] || X11DIR='/usr/lib/X11' #~ XKBmodel=pc104awide-zqu # ANSI-104 keyboard w/ Angle(Z)Wide(Quote) mod XKBmodel=pc105awide-sl # ISO-105 keyboard w/ AngleWide(Slash) mod #~ XKBmodel=pc105caw-bksl # ISO-105 w/ Curl(DbgHk)AngleWide(Slash) mod #~ XKBlayout='us(cmk_ed_us),gr(colemak),ru(colemak)' XKBlayout='no(cmk_ed_us)' # Norwegian Colemak[eD]'Universal Symbols' layout XKBoption='misc:extend,lv5:caps_switch_lock,grp:shifts_toggle,compose:menu' VerboseLvl=9 # (-v) How much info should setxkbmap print out? KeepXKM='no' # (-k) Retain old /var/lib/xkb/server-*.xkm files? XKBdir="${X11DIR}/xkb" # (-d) The xkb-type dir to run setxkbmap from AddCmd='no' # (-a) Add setxkbmap cmd to file? AddDefault="${HOME}/.bashrc" AddCmdTo=${AddDefault} # (-f) File (such as '~/.bashrc') to add setxkbmap cmd to SetXStr='' #'5aw no us' # (-s) Shortcut string for setxkb - 'model locale eD-variant(sym)' HelpStr="\e[1mUsage: bash ${MyNAME} [optional args]\e[0m\n"\ "[-m] - '${XKBmodel}'\n"\ "[-l] - '${XKBlayout}'\n"\ "[-o]