BREAKING CHANGES: control session with Hyper key

My entire session is no longer dependent on using the Super key (mod4).
Its function is now performed by Hyper (mod3).  This new modifier key is
defined in `.Xmodmap', which is included in the same Stow package as the
core BSPWM/SXHKD configs (because it is equally important to them).

The `.Xmodmap' enables Hyper and binds it to the Caps lock and the right
"Windows" key.  This means that there no longer exists a toggle for
writing all capital letters.  The Super key is also limited to just the
left Windows key.  This is a tentative design that might be reviewed
upon further consideration.

* * *

The present commit is merely _the first step_ in a major review of my
custom desktop session.  The overarching objective is to eventually
merge my bespoke BSPWM setup with my newer Emacs environment.

For the time being, my "dotemacs" is available from my website[0] and is
stored in a separate repo,[1] but will ultimately be merged with my
dotfiles once all the prerequisites are met.

Expect far-reaching changes to practically everything that I now do
inside of Emacs (writing, emailing, reading…) and is still covered by
specialised tools (vim, mutt, newsboat, ncmpcpp…).  For more on that,
see my video blog on the Emacs mindset and the Unix philosophy (ignore
my remarks on Xfce, as I did not know about `mod3' back then).[2]

[0]: https://protesilaos.com/dotemacs
[1]: https://gitlab.com/protesilaos/dotemacs
[2]: https://protesilaos.com/codelog/2019-08-09-vlog-emacs-unix/

* * *

If anyone reviewing this has read my "Prot's Dots For Debian",[4] they
should be reminded that PDFD does not track this repo directly.  It has
its own "snapshot" of my dotfiles.[5]

I will not be pushing any of these breaking changes to PDFD for the time
being.  That is a longer term objective that _might happen_ with the
release of Debian 11 'bullseye' (about 22 months from now).

[4]: https://protesilaos.com/pdfd
[5]: https://gitlab.com/protesilaos/cpdfd
parent 582dac7a
!!!!!!!!!!!!!!!
! Prior notes !
!!!!!!!!!!!!!!!
! These settings have been implemented succesfully on Debian 10
! 'buster' running a variety of desktop environments on top of Xorg.
! To get the current status of the modifiers:
!
! xmodmap -pm
!
! To find out the key codes that are available:
!
! xmodmap -pke
!
! Or narrow the results, e.g.:
!
! xmodmap -pke | grep -E '(Alt|Shift)'
!
! Alternatively, use `xev` to print the key code upon key press.
!
! Here are some of the most likely candidates for changes:
!
! keycode 37 = Control_L
! keycode 50 = Shift_L
! keycode 62 = Shift_R
! keycode 64 = Alt_L
! keycode 66 = Caps_Lock
! keycode 77 = Num_Lock
! keycode 105 = Control_R
! keycode 108 = Alt_R
! keycode 133 = Super_L
! keycode 134 = Super_R
! keycode 135 = Menu
!!!!!!!!!!!!!!!!!
! Modifications !
!!!!!!!!!!!!!!!!!
! Sometimes the Hyper key is bundled with Mod4 (Super). So what we want
! is to remove it from that group. Mod4 should just cover Super. Then
! I choose to bind Hyper to the Caps key and the right Win key
! (Super_R).
! I know that many Emacs users use Capos as an extra Ctrl, but I have
! never gotten used to that. Whereas now I can use Hyper for my tiling
! window manager, and leave Ctrl, Meta, Super for Emacs. Furthermore, I
! am aware that Emacs can bind different keys to Meta and Alt, but I
! still have no use for that and do not want to increase the complexity
! of my key bindings.
! Clear affected keys
clear lock
clear mod3
clear mod4
! Caps Lock as left Hyper
keycode 66 = Hyper_L
! Right Super as Right Hyper
keycode 134 = Hyper_R
! Set mod3 to capslock/hyper
add mod3 = Hyper_L Hyper_R
! Keep Super in tact
add mod4 = Super_L Super_R
\ No newline at end of file
......@@ -96,6 +96,11 @@ _bc presel_feedback_color "#2a2829"
# autostart
# =========
# Parse my custom key mappings. These enable Mod3 ("Hyper") and make
# some necessary adjustments to that end. We need to evaluate this
# first otherwise it might mess up with SXHKD.
[ -f "$HOME"/.Xmodmap ] && xmodmap "$HOME"/.Xmodmap
# The hotkey daemon that handles all custom key bindings, including the
# ones that control BSPWM. No real need to check for the presence of
# this executable, because it is a dependency of the BSPWM package.
......
......@@ -12,8 +12,36 @@
# Partial configuration file for the Simple X Hotkey Daemon. Meant to
# work with `bspwm`. This is part of my dotfiles, which are managed
# with GNU Stow. See https://gitlab.com/protesilaos/dotfiles
#
# Last full review on 2019-05-23
############################################################################
# IMPORTANT NOTE ABOUT THE USE OF MOD3 (written on 2019-10-19) #
# #
# Earlier versions of my SXHKD-related files would use Super (mod4) as the #
# main modifier key for controlling my custom BSPWM session. However, #
# since early July 2019 I have switched my main computing/coding/writing #
# environment to Emacs, where the Super key is more useful there. As #
# such, I am now including an `~/.Xmodmap' file which enables the Hyper #
# key (mod3) and binds it to the Caps lock and the right "Win" key #
# respectively. #
# #
# Please be very careful with the syntax of the key bindings for SXHKD. #
# My tests would only yield the desired results when `mod3' was #
# referenced explicitly. Writing `hyper' would mess things up with #
# `super'. #
# #
# At any rate, this change is likely to be the first in a series as I #
# try to blend my BSPWM with my Emacs setup. Eventually, I will make #
# the key bindings that control the window manager behave more like #
# those of Emacs and/or I will review all key chord chain to be more #
# aligned with Emacs conventions. This is meant to prevent me from the #
# friction that context-switching tends to cause. #
############################################################################
......@@ -24,11 +52,11 @@
# for when assigning direct keybindings would become unwieldy. The idea
# is to scope bindings so as to avoid conflicts.
#
# Environment: super + e ; ...
# Executables which typically run in the console: super + x ; ...
# Graphical applications: super + g ; ...
# Assign (node flags): super + a ; ...
# Split (split ratios): super + s ; ...
# Environment: mod3 + e ; ...
# Executables which typically run in the console: mod3 + x ; ...
# Graphical applications: mod3 + g ; ...
# Assign (node flags): mod3 + a ; ...
# Split (split ratios): mod3 + s ; ...
......@@ -48,7 +76,7 @@
# the us,gr layout. All this is done to be able to get the active
# keyboard layout and print its name to my system panel (custom lemonbar
# called "melonpanel").
{alt + Caps_Lock,super + Escape}
{alt + Caps_Lock,mod3 + Escape}
own_script_current_keyboard_layout
# Environment
......@@ -69,7 +97,7 @@
#
# Recall that these depend on my dotfiles:
# https://gitlab.com/protesilaos/dotfiles.
super + e ; {c,d,f,s,p,t,m,k,q,x}
mod3 + e ; {c,d,f,s,p,t,m,k,q,x}
{ \
toggle_compton, \
dotsmenu, \
......@@ -84,7 +112,7 @@ super + e ; {c,d,f,s,p,t,m,k,q,x}
}
# Session management (log out, lock, switch users, reboot, shutdown).
# Can also be invoked with super + e ; q (as defined above).
# Can also be invoked with mod3 + e ; q (as defined above).
ctrl + alt + {Home,End,Delete}
poweroptionsmenu
......@@ -97,23 +125,23 @@ ctrl + alt + {Home,End,Delete}
# complements the features of a tiling WM. No need to spawn tens of
# terminals, like a barbarian! Watch my screen cast on the matter:
# https://protesilaos.com/codelog/2019-01-13-tmux-demo-bspwm/
super + {_, shift + } Return
mod3 + {_, shift + } Return
{xterm -e tmux new-session -A -s 'Default', xterm}
# GUI programs. Where these are alternatives to common CLI tools they
# are mapped to the same number as their counterparts, but prepended
# with a `g` (mnemonic for GUI).
super + g ; {1,2,3}
mod3 + g ; {1,2,3}
{ \
notify-send -i firefox "Run GUI program" "Launching Web Browser" && firefox-esr, \
notify-send -i system-file-manager "Run GUI program" "Launching File Manager" && caja, \
notify-send -i thunderbird "Run GUI program" "Launching Email Client" && thunderbird \
notify-send -i firefox "Launching Firefox" && firefox-esr, \
notify-send -i system-file-manager "Launching Caja File Manager" && caja, \
notify-send -i thunderbird "Launching Thunderbird" && thunderbird \
}
# CLI programs. Any browser and/or file manager should be assigned the
# numbers 1 and 2 respectively, in order to keep consistency with the
# above-defined GUIs.
super + x ; {3-5}
mod3 + x ; {3-5}
xterm -e {mutt,newsboat,ncmpcpp}
# I use "my_float_window" as an application name or class for those rare
......@@ -121,11 +149,11 @@ super + x ; {3-5}
#
# Note that the executable `calc` is contained in the Debian package
# `apcalc`.
super + x ; 0
mod3 + x ; 0
xterm -class "my_float_window" -e calc
# Bring up the help text for common keybindings
super + {F1,Home}
mod3 + {F1,Home}
xterm -class "my_float_window" \
-geometry '100x30' -e less "$HOME/.config/sxhkd/cheatsheet_sxhkdrc.txt"
......@@ -150,17 +178,17 @@ super + {F1,Home}
# https://protesilaos.com/codelog/2019-02-17-unix-ways-todo/
#
# NOTE the keys are mnemonics for Backgrounds, Wallpapers, Tasks.
super + x; {b,w,t}
mod3 + x; {b,w,t}
{sbgmenu,nbm,stmmenu}
# dmenu_run and passmenu using my custom colours.
super + {d,p}
mod3 + {d,p}
{own_script_run_dmenu_xcolors,own_script_run_passmenu_xcolors}
# dmenu specifically for flatpaks. While it is possible to include
# these in the $PATH, or to query by `.desktop` file, I prefer to keep
# them separate.
super + shift + d
mod3 + shift + d
flatpakmenu
# Tools and utilities
......@@ -172,9 +200,9 @@ super + shift + d
#### allow an external program to handle them. Below is an example
#### implementation in lieu of the actual commands, which assigns the key
#### chords I have specified in `dunstrc`.
###super + {_, shift + } v
###mod3 + {_, shift + } v
### VIEW {context menu of} last notification (shows max 3 at a time)
###super + {_, shift + } c
###mod3 + {_, shift + } c
### CLOSE {all} notification{s}
# Screenshots (requires `scrot`). First one is for the focused window.
......@@ -182,7 +210,7 @@ super + shift + d
# Note that `scrot` also has an interactive mode that I do not use.
Print
scrot -u -z '%Y-%m-%d_%H:%M:%S_$wx$h$n.png' -e 'mv $f ~/Desktop' && notify-send -i gnome-screenshot "Window view screenshot" "Saved image to Desktop"
super + Print
mod3 + Print
scrot -m -z '%Y-%m-%d_%H:%M:%S_$wx$h.png' -e 'mv $f ~/Desktop' && notify-send -i gnome-screenshot "Screen view screenshot" "Saved image to Desktop"
# Control the laptop's screen brightness (requires `xbacklight`).
......@@ -206,11 +234,11 @@ XF86Audio{Play,Prev,Next,Stop}
# mpc method that is specific to the Music Player Daemon. This uses
# dedicated media keys.
super + XF86Audio{Mute,LowerVolume,RaiseVolume}
mod3 + XF86Audio{Mute,LowerVolume,RaiseVolume}
mpc {toggle,prev,next,stop}
# mpc method as above, but using the arrow keys.
super + {Down,Left,Right,Up}
mod3 + {Down,Left,Right,Up}
mpc {toggle,prev,next,stop}
# Speaker/output volume. Requires `amixer` and dedicated keys.
......@@ -220,6 +248,5 @@ XF86Audio{Mute,LowerVolume,RaiseVolume}
# Microphone/input volume. Same requirements as previous definition.
XF86AudioMicMute
amixer set Capture toggle
super + XF86Audio{Mute,LowerVolume,RaiseVolume}
mod3 + XF86Audio{Mute,LowerVolume,RaiseVolume}
amixer set Capture {toggle,5%-,5%+}
......@@ -15,20 +15,48 @@
#
# LARGE PORTIONS OF THIS FILE INVOKE MY SHELL SCRIPTS. Do not blindly
# copy-paste from here!
#
# Last full review on 2019-06-18
############################################################################
# IMPORTANT NOTE ABOUT THE USE OF MOD3 (written on 2019-10-19) #
# #
# Earlier versions of my SXHKD-related files would use Super (mod4) as the #
# main modifier key for controlling my custom BSPWM session. However, #
# since early July 2019 I have switched my main computing/coding/writing #
# environment to Emacs, where the Super key is more useful there. As #
# such, I am now including an `~/.Xmodmap' file which enables the Hyper #
# key (mod3) and binds it to the Caps lock and the right "Win" key #
# respectively. #
# #
# Please be very careful with the syntax of the key bindings for SXHKD. #
# My tests would only yield the desired results when `mod3' was #
# referenced explicitly. Writing `hyper' would mess things up with #
# `super'. #
# #
# At any rate, this change is likely to be the first in a series as I #
# try to blend my BSPWM with my Emacs setup. Eventually, I will make #
# the key bindings that control the window manager behave more like #
# those of Emacs and/or I will review all key chord chain to be more #
# aligned with Emacs conventions. This is meant to prevent me from the #
# friction that context-switching tends to cause. #
############################################################################
# Close {or kill} currently focused node
super + {_,shift + }q
mod3 + {_,shift + }q
bspc node -{c,k}
# Focus/swap nodes/desktops
# -------------------------
# Focus the node in the given direction.
super + {h,j,k,l}
mod3 + {h,j,k,l}
bspc node -f {west,south,north,east}
# Swap focused window with the one in the given direction. If there is
......@@ -49,7 +77,7 @@ super + {h,j,k,l}
# --rotate the tree.
#
# bspwm_smart_move is part of my dotfiles (link in the description).
super + shift + {h,j,k,l}
mod3 + shift + {h,j,k,l}
bspwm_smart_move {west,south,north,east}
# Dynamic desktop behaviour: this invokes a script of mine that
......@@ -58,10 +86,10 @@ super + shift + {h,j,k,l}
# removed automatically.
#
#
# super + <number> = focus the given desktop
# super + shift + <number> = send focused window to given desktop
# super + ctrl + shift + <number> = as above, but send to next monitor
# super + ctrl + <number> = switches the active (visible) desktop of the
# mod3 + <number> = focus the given desktop
# mod3 + shift + <number> = send focused window to given desktop
# mod3 + ctrl + shift + <number> = as above, but send to next monitor
# mod3 + ctrl + <number> = switches the active (visible) desktop of the
# unfocused monitor, without focusing it (focus stays on the current
# desktop/monitor). It also inserts a receptacle, meaning that the next
# created window will go there without calling focus to itself (see my
......@@ -72,25 +100,25 @@ super + shift + {h,j,k,l}
# section.
#
# NOTE the leading `;` runs this command asynchronously.
super + {_,shift + ,ctrl + shift +,ctrl +}{0-9}
mod3 + {_,shift + ,ctrl + shift +,ctrl +}{0-9}
;bspwm_dynamic_desktops {--df,--ns,--nm,--da} {0-9}
# With `alt` focus {next,previous} window in the current desktop. With
# `super` focus {next,previous} desktop in the current monitor.
# `mod3` focus {next,previous} desktop in the current monitor.
# Cyclical behaviour. Move in the opposite direction while also holding
# down `shift`.
{super,alt} + {_,shift +} Tab
{mod3,alt} + {_,shift +} Tab
bspc {desktop,node} -f {next,prev}.local
# Switch to the {next,previous} monitor. This brings focus to that
# monitor's active desktop.
super + {_,shift + }comma
mod3 + {_,shift + }comma
bspc monitor -f {next,prev}
# Switch to last active {desktop,node}. With super move to the last
# Switch to last active {desktop,node}. With mod3 move to the last
# active desktop. With alt move to the last active node. "grave" is
# positioned above Tab in QWERTY layouts.
{super,alt} + grave
{mod3,alt} + grave
bspc {desktop,node} -f last
# Expand or contract node in the given direction.
......@@ -100,27 +128,27 @@ super + {_,shift + }comma
# such as MATE and Xfce). I have not set the script to resize floating
# windows because: (i) I do not use them and if I do I do not want to
# change their dimensions, and (ii) to keep the script concise.
super + ctrl + {h,j,k,l}
mod3 + ctrl + {h,j,k,l}
own_script_bspwm_node_resize {west,south,north,east} 50
# Move a floating window with the arrow keys (else use Alt + Left Mouse
# Click to drag). I seldom use floating windows.
super + shift + {Left,Down,Up,Right}
mod3 + shift + {Left,Down,Up,Right}
bspc node -v {-20 0,0 20,0 -20,20 0}
# Swap current window with the biggest one in the present
# desktop.
super + shift + b
mod3 + shift + b
bspc node -s biggest.local
# Preselect the direction or insert again to cancel the preselection.
# This enters the manual tiling mode that splits the currently focused
# window.
super + alt + {h,j,k,l}
mod3 + alt + {h,j,k,l}
bspc node --presel-dir '~{west,south,north,east}'
# Preselect the ratio. The default value is 0.5, defined in `bspwmrc`.
super + alt + {1-9}
mod3 + alt + {1-9}
bspc node -o 0.{1-9}
# Node layout state and flags
......@@ -128,7 +156,7 @@ super + alt + {1-9}
# Toggle monocle layout (maximise focused node). If you use `-l
# monocle` you lose the toggle functionality.
super + m
mod3 + m
bspc desktop -l next
# Toggle tiled, pseudo_tiled, floating, fullscreen view. Tiled is what
......@@ -139,7 +167,7 @@ super + m
#
# NOTE the presence of the tilde ~. If current state matches the given
# state, then the argument is interpreted as the last state.
super + {t,shift + space,space,f}
mod3 + {t,shift + space,space,f}
bspc node -t ~{tiled,pseudo_tiled,floating,fullscreen}
# Set the node flags. Locked is a node that cannot be closed with `bspc
......@@ -147,13 +175,13 @@ super + {t,shift + space,space,f}
# the given item (such as sending the marked item to the newest
# preselection). Sticky stays in the focused desktop. Private tries to
# keep its dimensions and tiling position.
super + a ; {l,m,s,p}
mod3 + a ; {l,m,s,p}
bspc node -g {locked,marked,sticky,private}
# Set the split ratio on demand. Applies to the next window, or when
# using the next set of commands that equalise the tree or balance the
# parent node.
super + s ; {2,3,4}
mod3 + s ; {2,3,4}
bspc config split_ratio { \
0.50 && notify-send "BSPWM configuration" "Split ratio set to 0.50", \
0.66 && notify-send "BSPWM configuration" "Split ratio set to 0.66", \
......@@ -163,27 +191,27 @@ super + s ; {2,3,4}
# Make node split ratios equal or balanced. The former applies to the
# root of the tree to equalise all split ratios. The latter applies to
# the parent node to even out manually-split windows.
super + s ; {e,b}
mod3 + s ; {e,b}
bspc node {@/ --equalize,@parent --balance}
# Manipulate the workspace
# ------------------------
# Rotate all windows {counter-}clockwise by 90 degrees.
super + {_,shift + }r
mod3 + {_,shift + }r
bspc node @/ --rotate {90,-90}
# Flip desktop: what is on the right/top moves to the left/bottom and
# vice versa.
super + alt + {_,shift + }r
mod3 + alt + {_,shift + }r
bspc node @/ --rotate {180,-180}
# Switch between gap presets.
super + shift + {y,u,i,o}
mod3 + shift + {y,u,i,o}
bspc config window_gap {0,5,10,20}
# Dynamic gaps.
super + shift + bracket{left,right}
mod3 + shift + bracket{left,right}
bspc config -d focused window_gap "$(($(bspc config -d focused window_gap) {-,+} 5 ))"
# Advanced operations (receptacles and scripted actions)
......@@ -197,39 +225,39 @@ super + shift + bracket{left,right}
#
# Whereas bspwm_smart_move (defined above) will automatically insert
# a receptacle in the given direction by splitting the entire viewport.
super + n ; r
mod3 + n ; r
bspc node -i
# Insert the marked window (or focused if no marks) in the first
# matching receptacle (or preselection if no receptacles).
super + n ; i
mod3 + n ; i
bspwm_smart_presel
# Kill/remove the first matching receptacle from the current desktop.
# With shift, kill them all at once.
super + n ; super + {_, shift + }r
mod3 + n ; mod3 + {_, shift + }r
{ \
bspc node 'any.leaf.!window.local' -k, \
bspwm_multifaceted_operation --kill-all-receptacles \
}
# Summon all marked windows across all desktops to the current desktop.
super + n ; m
mod3 + n ; m
bspwm_multifaceted_operation --summon-all-marked
# Bring the windows of the given desktop to the current one. With
# shift, send the current window to the given one.
super + n ; super + {_, shift + }{0-9}
mod3 + n ; mod3 + {_, shift + }{0-9}
bspwm_multifaceted_operation {--bring-desktop-here,--send-desktop-there} {0-9}
# Close {or kill} all windows in the present desktop except the focused
# or any marked ones.
super + n ; super + {_,shift + }q
mod3 + n ; mod3 + {_,shift + }q
bspwm_multifaceted_operation --{close,kill}-all-local-non-focused
# Assign the locked flag to all windows in the current desktop. With
# shift, remove the locked flag from all.
super + n ; {_, shift + }l
mod3 + n ; {_, shift + }l
bspwm_multifaceted_operation {--lock-all-local,--unlock-all-local}
......@@ -245,17 +273,17 @@ super + n ; {_, shift + }l
# couterparts.
# Resize node in the given direction.
super + c : {h,j,k,l}
mod3 + c : {h,j,k,l}
own_script_bspwm_node_resize {west,south,north,east} 50
# Gaps presets.
super + c : {y,u,i,o}
mod3 + c : {y,u,i,o}
bspc config window_gap {0,5,10,20}
# Mode for dynamic gaps.
super + c : bracket{left,right}
mod3 + c : bracket{left,right}
bspc config -d focused window_gap "$(($(bspc config -d focused window_gap) {-,+} 5 ))"
# Move floating windows with the arrow keys
super + c : {Left,Down,Up,Right}
mod3 + c : {Left,Down,Up,Right}
bspc node -v {-20 0,0 20,0 -20,20 0}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment