literate-dotfiles/dotfiles/sxhkd.org
Thomas Dehaeze 378a67efb3 Remove scripts and bin folders.
Instead, everything is in the =~/.local/bin/= folder
Thus, the home folder is more clean
2020-04-06 23:56:37 +02:00

8.5 KiB

Simple X Hotkey Daemon

Basic

  super + ctrl + x
    xkill
  # make sxhkd reload its configuration files:
  super + Escape
    pkill -USR1 -x sxhkd

  # Update Polybar
  super + r
    $HOME/.config/polybar/scripts/launch.sh

Set shut down, restart and locking features

  XF86PowerOff
    quit
  super + 0
    quit

Start Applications

  # Start program launcher
  super + d
    rofi -show run

  # Launch categorized menu
  super + z
    rofi -show drun

  # Start Sound Manager
  super + shift + s
    pavucontrol

  # Start Bluetooth Manager
  super + shift + b
    blueman-manager

  # Windows Switch
  super + shift + w
    rofi -show window

  # Bookmarks
  # super + shift + f
  #   $HOME/bin/bukurun

  # Passwords
  super + shift + p
    rofi-pass
  # Start Terminal
  super + Return
    $TERMINAL

  # Tmux Terminal
  super + shift + Return
    $TERMINAL -e 'tmux'

  # Start Command line Calendar
  super + shift + c
    $TERMINAL -e "khal interactive"

  # File Manager
  super + o
    $TERMINAL -e "tmux new-session -A -s ranger ranger"

  # Browser
  super + i
    qutebrowser

Multimedia keys

Sound

  XF86AudioMute
    amixer -D pulse sset Master toggle
  XF86AudioRaiseVolume
    amixer -D pulse sset Master 2%+
  XF86AudioLowerVolume
    amixer -D pulse sset Master 2%-

Backlight

  XF86MonBrightnessUp
   xbacklight -inc 10
  XF86MonBrightnessDown
   xbacklight -dec 10

Change Tracks

super + period
    mpc toggle
super + {greater,less}
    mpc {next,prev}
XF86AudioPlay
    mpc toggle
XF86AudioNext
    mpc next
XF86AudioPrev
    mpc prev

Print Screen

Print
    ~/.local/bin/screenshot
XF86Display
    rofi -show window

Other

  XF86Search
    rofi -show run

Command Mode

  # Command line Calendar Client (khal)
  super + space ; c
    $TERMINAL -e "khal interactive"

  # GUI Calendar (Google Calendar)
  super + space ; shift + c
    $BROWSER https://calendar.google.com/

  # pcmanfm: GUI file manager
  super + space ; o
    pcmanfm;

  # Mails with neomutt
  super + space ; m
    $TERMINAL -e "tmux new-session -A -s neomutt neomutt"

  super + space ; shift + m
    $TERMINAL -e "neomutt -R"

  # Weechat
  super + space ; w
    $TERMINAL -e "tmux new-session -A -s weechat weechat"

  # News with newsboat
  super + space ; n
    $TERMINAL -e "tmux new-session -A -s newsboat newsboat"

  # Music with ncmpcpp
  super + space ; p
    $TERMINAL -e "tmux new-session -A -s ncmpcpp ncmpcpp"

  # Print Screen
  super + space ; shift + p
    $HOME/.local/bin/mopidy-restart

  # Default Browser
  super + space ; i
    $BROWSER;

  # Start Terminal Application
  super + space ; t
    $TERMINAL -e "tremc"

  # Alternative Browser
  super + space ; shift + i
    brave;

  # Emacs
  super + space ; e
    emacs;

  # Emacs Client
  super + space ; shift + e
    emacsclient -create-frame --alternate-editor=""

Change Keyboard Layout

super + ctrl + d
    setxkbmap -layout us -variant intl -option caps:escape
super + shift + d
    setxkbmap -layout us -option caps:escape

BSPWM related

BSPWM hotkeys

  # quit/restart bspwm
  super + alt + {q,r}
    bspc {quit,wm -r}

  # close and kill
  super + {_,shift + }q
    bspc node -{c,k}

Monocle Layout

  # alternate between the tiled and monocle layout
  super + m
    bspc desktop -l next

  # focus the next/previous node in the current desktop
  super + c
    bspc node -f next.local

Set the window State

  # Set the window state to tiled
  super + t
    bspc node -t tiled


  # Toggle Fullscreen State
  super + f
    if [ -z "$(bspc query -N -n focused.fullscreen)" ]; then \
        bspc node focused -t fullscreen; \
    else \
        bspc node focused -t tiled; \
    fi

  # Toggle Floating State
  super + s
    if [ -z "$(bspc query -N -n focused.floating)" ]; then \
        bspc node focused -t floating; \
    else \
        bspc node focused -t tiled; \
    fi

Sticky Window

  # set the node flags
  super + ctrl + y
    bspc node -g sticky

Focus and Swap

  # Focus/swap the node in the given direction
  super + {_,shift + }{h,j,k,l}
    bspc node -{f,s} {west,south,north,east}

  # focus the last Node
  super + Tab
    bspc node -f last
  # Focus the next/previous desktop in the current monitor
  super + {p,n}
    bspc desktop -f {prev,next}.local

  # focus the last Desktop
  super + b
    bspc desktop -f last

  # focus or send to the given desktop
  super + {_,ctrl + }{1-9}
    bspc {desktop -f,node -d} '^{1-9}'

  # Send and Focus to the given desktop
  super + shift + {1-9}
    bspc node -d '^{1-9}' --follow

Preselect

# preselect the direction
super + ctrl + {h,j,k,l}
  bspc node -p {west,south,north,east}

# preselect the ratio
# super + ctrl + {1-9}
#   bspc node -o 0.{1-9}

# cancel the preselection for the focused node
super + ctrl + space
  bspc node -p cancel

Resize

  # expand a window by moving one of its side outward
  super + alt + {h,j,k,l}
    bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}

  # contract a window by moving one of its side inward
  super + alt + shift + {h,j,k,l}
    bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}
  # move a floating window
  super + {Left,Down,Up,Right}
    bspc node -v {-20 0,0 20,0 -20,20 0}

I3 related

Quit/Restart hotkeys

  # quit/restart bspwm
  super + alt + {q,r}
    i3-msg {quit,restart}

  # close and kill
  super + {_,shift + }q
    i3-msg {kill,kill}

Set the window State

  # Set the window to full-screen
  super + f
    i3-msg fullscreen toggle

  # Set the window to floating
  super + s
    i3-msg floating toggle

  # Alternate between the tiled and normal layout
  super + t
    i3-msg layout toggle tabbed split

  # Change focus between tiling / floating windows
  super + c
    i3-msg focus mode_toggle

  # Sticky window
  super + y
    i3-msg sticky toggle

focus/swap

  # Focus/swap the node in the given direction
  super + {_,shift + }{h,Left}
    i3-msg {focus,move} left
  super + {_,shift + }{j,Down}
    i3-msg {focus,move} down
  super + {_,shift + }{k,Up}
    i3-msg {focus,move} up
  super + {_,shift + }{l,Right}
    i3-msg {focus,move} right
  # Focus the next/previous desktop in the current monitor
  super + {p,n}
    i3-msg workspace {prev,next}

  # focus the last Desktop
  super + b
    i3-msg workspace back_and_forth

  # focus or send to the given desktop
  super + {1-9}
    i3-msg workspace '{1-9}'
  super + ctrl + {1-9}
    i3-msg move container to workspace '{1-9}'
  super + shift + {1-9}
    WP={1-9} && i3-msg move container to workspace $WP && i3-msg workspace $WP

Preselect

Preselect the direction

  super + ctrl + {h,l,Left,Right}
    i3-msg split h

  super + ctrl + {j,k,Up,Down}
    i3-msg split v

Resize

Expand/Shrink a window

  super + alt + h
    i3-msg resize shrink width 10 px or 10 ppt
  super + alt + j
    i3-msg resize grow height 10 px or 10 ppt
  super + alt + k
    i3-msg resize shrink height 10 px or 10 ppt
  super + alt + l
    i3-msg resize grow width 10 px or 10 ppt