This repository has been archived on 2021-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
.stumpwm.d/keybindings.lisp

130 lines
5.2 KiB
Common Lisp

;;; set prefix
(in-package :stumpwm)
(set-prefix-key (kbd "s-SPC"))
(defvar browser (getenv "BROWSER"))
(defvar editor (getenv "EDITOR"))
(defvar *my-frames-float-keymap*
(let ((m (make-sparse-keymap)))
(define-key m (kbd "f") "float-this")
(define-key m (kbd "F") "unfloat-this")
(define-key m (kbd "C-f") "flatten-floats")
m))
(defvar *my-frames-management-keymap*
(let ((m (make-sparse-keymap)))
(define-key m (kbd "c") "move-focus left")
(define-key m (kbd "t") "move-focus down")
(define-key m (kbd "s") "move-focus up")
(define-key m (kbd "r") "move-focus right")
(define-key m (kbd "C") "move-window left")
(define-key m (kbd "T") "move-window down")
(define-key m (kbd "S") "move-window up")
(define-key m (kbd "R") "move-window right")
(define-key m (kbd "C-c") "exchange-direction left")
(define-key m (kbd "C-t") "exchange-direction down")
(define-key m (kbd "C-s") "exchange-direction up")
(define-key m (kbd "C-r") "exchange-direction right")
(define-key m (kbd "n") "next")
(define-key m (kbd "p") "prev")
(define-key m (kbd "/") "hsplit")
(define-key m (kbd "-") "vsplit")
(define-key m (kbd "h") "hsplit")
(define-key m (kbd "v") "vsplit")
(define-key m (kbd "H") "hsplit-equally")
(define-key m (kbd "V") "vsplit-equally")
(define-key m (kbd ".") "iresize")
(define-key m (kbd "d") "remove-split")
(define-key m (kbd "D") "only")
(define-key m (kbd "e") "expose")
(define-key m (kbd "f") "fullscreen")
(define-key m (kbd "F") '*my-frames-float-keymap*)
(define-key m (kbd "i") "info")
(define-key m (kbd "I") "show-window-properties")
(define-key m (kbd "m") "meta")
(define-key m (kbd "o") "other-window")
(define-key m (kbd "q") "delete-window")
(define-key m (kbd "Q") "kill-window")
(define-key m (kbd "s") "sibling")
(define-key m (kbd "u") "next-urgent")
(define-key m (kbd "U") "unmaximize")
m))
(defvar *my-rofi-keymap*
(let ((m (make-sparse-keymap)))
(define-key m (kbd "a") "exec awiki")
(define-key m (kbd "r") "exec rofi -combi-modi drun,window -show combi")
(define-key m (kbd "s") "exec rofi -show ssh")
(define-key m (kbd "p") "exec rofi-pass -t")
(define-key m (kbd "P") "exec rofi-pass")
(define-key m (kbd "e") "exec rofi-emoji")
(define-key m (kbd "m") "exec rofi-mount")
(define-key m (kbd "u") "exec rofi-umount")
(define-key m (kbd "w") "exec wacom-setup")
(define-key m (kbd "y") "exec ytplay")
(define-key m (kbd "Y") "exec rofi-ytdl")
m))
(defvar *my-applications-keymap*
(let ((m (make-sparse-keymap)))
(define-key m (kbd "b") (concat "exec " browser))
(define-key m (kbd "d") "exec lightcord")
(define-key m (kbd "e") (concat "exec " editor))
(define-key m (kbd "E") "exec emacs")
(define-key m (kbd "g") "exec gimp")
(define-key m (kbd "n") "exec nemo")
(define-key m (kbd "r") '*my-rofi-keymap*)
(define-key m (kbd "s") '*my-screenshot-keymap*)
m))
(defvar *my-screenshot-keymap*
(let ((m (make-sparse-keymap)))
(define-key m (kbd "d") "exec scrot -d 3 -e 'mv $f ~/Pictures/Screenshots'")
(define-key m (kbd "s") "exec scrot -e 'mv $f ~/Pictures/Screenshots'")
(define-key m (kbd "S") "exec scrot -s -e 'mv $f ~/Pictures/Screenshots'")
(define-key m (kbd "g") "exec scrot -e 'gimp $f; mv $f ~/Pictures/Screenshots'")
m))
(define-key *top-map* (kbd "s-c") "move-focus left")
(define-key *top-map* (kbd "s-t") "move-focus down")
(define-key *top-map* (kbd "s-s") "move-focus up")
(define-key *top-map* (kbd "s-r") "move-focus right")
(define-key *top-map* (kbd "s-C") "move-window left")
(define-key *top-map* (kbd "s-T") "move-window down")
(define-key *top-map* (kbd "s-S") "move-window up")
(define-key *top-map* (kbd "s-R") "move-window right")
(define-key *top-map* (kbd "s-M-c") "exchange-direction left")
(define-key *top-map* (kbd "s-M-t") "exchange-direction down")
(define-key *top-map* (kbd "s-M-s") "exchange-direction up")
(define-key *top-map* (kbd "s-M-r") "exchange-direction right")
(define-key *top-map* (kbd "Print") '*my-screenshot-keymap*)
(define-key *top-map* (kbd "s-RET") "exec kitty")
(define-key *top-map* (kbd "s-a") '*my-applications-keymap*)
(defvar *my-end-session-keymap*
(let ((m (make-sparse-keymap)))
(define-key m (kbd "q") "end-session")
(define-key m (kbd "l") "logout")
(define-key m (kbd "s") "suspend-computer")
(define-key m (kbd "S") "shutdown-computer")
(define-key m (kbd "r") "restart-computer")
m))
(define-key *root-map* (kbd "SPC") "exec kitty")
(define-key *root-map* (kbd "l") "exec plock")
(define-key *root-map* (kbd "r") "reload")
(define-key *root-map* (kbd "w") '*my-frames-management-keymap*)
(define-key *root-map* (kbd "q") '*my-end-session-keymap*)
(define-interactive-keymap (iresize tile-group) (:on-enter #'setup-iresize
:on-exit #'resize-unhide
:abort-if #'abort-resize-p)
((kbd "c") "resize-direction left")
((kbd "t") "resize-direction down")
((kbd "s") "resize-direction up")
((kbd "r") "resize-direction right"))