dotfiles/stumpwm/stumpwmrc

177 lines
4.9 KiB
Text
Raw Normal View History

2016-06-02 21:30:02 +02:00
;; -*-lisp-*-
;;
;; StumpWM config
(in-package :stumpwm)
2017-07-21 10:13:45 +02:00
(defparameter *key-layout* "us -variant altgr-intl" "Stores the current key layout")
2016-12-04 23:18:21 +01:00
;; creating groups
(gnewbg "2")
(gnewbg "3")
(gnewbg "4")
(gnewbg "5")
(gnewbg "6")
(gnewbg "7")
(gnewbg "8")
(gnewbg "9")
;; border width
(setf *maxsize-border-width* 5)
(setf *transient-border-width* 5)
(setf *normal-border-width* 5)
;; border style
(setf *window-border-style* :tight)
(set-focus-color "#b00045")
(set-win-bg-color "black")
(set-unfocus-color "black")
(set-float-focus-color "#b00045")
(set-float-unfocus-color "black")
;; window gravity
(set-normal-gravity :center)
(set-maxsize-gravity :center)
(set-transient-gravity :center)
(gravity :center)
;; root keybindings
2017-07-21 10:13:45 +02:00
;
;; browser
2017-07-31 17:57:51 +02:00
(define-key *root-map* (kbd "W") "exec x-www-browser")
2016-12-04 23:18:21 +01:00
;;; terminal
(define-key *root-map* (kbd "c") "exec urxvt")
2016-12-23 22:06:39 +01:00
;;; es as emacs
(define-key *root-map* (kbd "e") "exec es")
2017-08-10 09:46:29 +02:00
;;; ranger
(define-key *root-map* (kbd "C-c") "exec urxvt -e ranger")
2016-12-04 23:18:21 +01:00
;;; groups to rpws keys
(define-key *root-map* (kbd "C-1") "change-workspace 1")
(define-key *root-map* (kbd "C-2") "change-workspace 2")
(define-key *root-map* (kbd "C-3") "change-workspace 3")
(define-key *root-map* (kbd "C-4") "change-workspace 4")
(define-key *root-map* (kbd "C-5") "change-workspace 5")
(define-key *root-map* (kbd "C-6") "change-workspace 6")
(define-key *root-map* (kbd "C-7") "change-workspace 7")
(define-key *root-map* (kbd "C-8") "change-workspace 8")
(define-key *root-map* (kbd "C-9") "change-workspace 9")
2016-06-02 21:30:02 +02:00
2017-07-21 10:13:45 +02:00
;;; mode-line key
(define-key *root-map* (kbd "Menu") "mode-line")
2016-06-02 21:30:02 +02:00
;; xserver
2017-07-21 10:13:45 +02:00
2016-06-02 21:30:02 +02:00
(run-shell-command "xrdb -merge ~/.Xresources")
;;; HiDPI stuff.
;;; TODO: Only run if required
2017-03-20 22:48:25 +01:00
;; (run-shell-command "xrdb -merge ~/.Xresources-hidpi")
2016-06-02 21:30:02 +02:00
2016-12-04 23:18:21 +01:00
;; dunst notify server
(run-shell-command "dunst")
;; nitrogen (wallpaper)
2016-06-02 21:30:02 +02:00
(run-shell-command "nitrogen --restore")
2017-03-28 11:59:26 +02:00
;; keepassxc
(run-shell-command "gpg --textmode -d ~/.config/keepassxc/password.gpg | keepassxc --pw-stdin ~/ownCloud/keys/2017-04.kdbx")
2017-03-28 11:59:26 +02:00
2016-06-02 21:30:02 +02:00
;; set the mouse focus
(setf *mouse-focus-policy* :click)
2017-03-20 22:48:25 +01:00
;; set DESKTOP_SESSION variable
(setf (getenv "DESKTOP_SESSION") "stumpwm")
2016-06-02 21:30:02 +02:00
;; define volume control keys
(define-key *top-map* (kbd "XF86AudioLowerVolume") "exec amixer set Master 5%-")
(define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec amixer set Master 5%+")
(define-key *top-map* (kbd "XF86AudioMute") "exec amixer set Master toggle")
2016-12-04 23:18:21 +01:00
(define-key *top-map* (kbd "XF86AudioMicMute") "exec amixer set Capture toggle")
2017-03-28 12:04:39 +02:00
(define-key *top-map* (kbd "XF86Launch1") "exec blurlock")
2016-12-04 23:18:21 +01:00
;; battery status
(define-key *root-map* (kbd "b") "exec ~/scripts/rat/bat.sh")
;; set backlight
(defcommand set-backlight (value)
((:string "Backlight in %: "))
"Setting a new value for the backlight"
(run-shell-command (concatenate 'string "xbacklight -set " value))
(echo (concatenate 'string "Backlight set to " value)))
(define-key *root-map* (kbd "B") "set-backlight")
;; tweet
(defcommand tweet (tweet)
((:string "Tweet: "))
"Tweet"
(run-shell-command (concatenate 'string "cd ~/programs/dart/learning/twitter && dart main.dart -t \"" tweet "\""))
(echo (concatenate 'string "Tweeted: " tweet)))
(define-key *root-map* (kbd "T") "tweet")
;; switch key layout
(defun switch-layout-to (new-lang)
"Switch the key layout to the given one"
(setq *key-layout* new-lang)
(run-shell-command (concatenate 'string "setxkbmap -layout " new-lang " && xmodmap ~/.Xmodmap"))
(echo (concatenate 'string "Set keyboard layout to " new-lang)))
;; switch key leyout to german
(defcommand layout-de ()
()
"Set the keyboard layout to de (german)"
(switch-layout-to "de"))
;; switch key leyout to american english
(defcommand layout-en ()
()
"Set the keyboard layout to US International AltGr"
(switch-layout-to "us -variant altgr-intl"))
2016-12-04 23:18:21 +01:00
;; switch key layout automatically
(defcommand switch-layout ()
()
"Switch the layout"
(if (string= "us -variant altgr-intl" *key-layout*)
2016-12-04 23:18:21 +01:00
(switch-layout-to "de")
(switch-layout-to "us -variant altgr-intl")))
2016-12-04 23:18:21 +01:00
(define-key *top-map* (kbd "s-SPC" ) "switch-layout")
;; switch workspace with a message
(defcommand change-workspace (n)
((:string n))
"Switch workspace"
(run-commands (concatenate 'string "gselect " n))
(echo (concatenate 'string "Switched to " n)))
2016-12-23 22:06:39 +01:00
;; working with emacsclient
(defvar *es-win* nil
"to hold the window called emacsclient")
(defun save-es-called-win ()
(setf *es-win* (current-window)))
(defun return-es-called-window (win)
(let* ((group (window-group win))
(frame (window-frame win))
(old-frame (tile-group-current-frame group)))
(frame-raise-window group frame win)
(focus-all win)
(unless (eq frame old-frame)
(show-frame-indicator group))))
2017-03-28 11:59:26 +02:00
2017-07-21 10:13:45 +02:00
(load-module "stumptray")
2017-07-31 17:58:12 +02:00
;; font configuration
(load-module "ttf-fonts")
(set-font (make-instance 'xft:font :family "Hack" :subfamily "Regular" :size 30))
2017-07-21 10:13:45 +02:00
(switch-layout-to *key-layout*)
(run-shell-command "xmodmap $HOME/.Xmodmap" t)