2019-11-13 03:59:12 +00:00
|
|
|
(in-package :stumpwm)
|
|
|
|
|
|
|
|
;; Start up a swank server for happy SLIME hacking
|
|
|
|
(require :swank)
|
|
|
|
(swank-loader:init)
|
|
|
|
(swank:create-server :port 4004
|
|
|
|
:style swank:*communication-style*
|
2019-12-04 13:20:43 +00:00
|
|
|
:dont-close t)
|
|
|
|
|
2020-03-10 03:36:15 +00:00
|
|
|
(defun get-color (name)
|
|
|
|
(let ((colors '(("base03" . "#002b36")
|
|
|
|
("base02" . "#073642")
|
|
|
|
("base01" . "#586e75")
|
|
|
|
("base00" . "#657b83")
|
|
|
|
("base0" . "#839496")
|
|
|
|
("base1" . "#93a1a1")
|
|
|
|
("base2" . "#eee8d5")
|
|
|
|
("base3" . "#fdf6e3")
|
|
|
|
("yellow" . "#b58900")
|
|
|
|
("orange" . "#cb4b16")
|
|
|
|
("red" . "#dc322f")
|
|
|
|
("magenta" . "#d33682")
|
|
|
|
("violet" . "#6c71c4")
|
|
|
|
("blue" . "#268bd2")
|
|
|
|
("cyan" . "#2aa198")
|
|
|
|
("green" . "#859900"))))
|
|
|
|
(cdr (assoc name colors :test 'equal))))
|
|
|
|
|
2020-01-05 17:45:14 +00:00
|
|
|
;; StumpWM configs
|
2020-03-09 01:05:32 +00:00
|
|
|
(setq *message-window-gravity* :center
|
|
|
|
*input-window-gravity* :center
|
|
|
|
*window-border-style* :thin
|
|
|
|
*message-window-padding* 10
|
2020-03-10 03:36:15 +00:00
|
|
|
*message-window-y-padding* 5
|
|
|
|
*maxsize-border-width* 2
|
|
|
|
*normal-border-width* 2
|
2020-03-09 01:05:32 +00:00
|
|
|
*transient-border-width* 2
|
|
|
|
stumpwm::*float-window-border* 2
|
2020-03-10 03:36:15 +00:00
|
|
|
stumpwm::*float-window-title-height* 2
|
|
|
|
*mouse-focus-policy* :click
|
|
|
|
*colors* (list (get-color "base02")
|
|
|
|
(get-color "red")
|
|
|
|
(get-color "green")
|
|
|
|
(get-color "yellow")
|
|
|
|
(get-color "blue")
|
|
|
|
(get-color "magenta")
|
|
|
|
(get-color "cyan")
|
|
|
|
(get-color "base2")))
|
|
|
|
|
|
|
|
;; Input/message bar
|
|
|
|
(set-fg-color (get-color "base00"))
|
|
|
|
(set-bg-color (get-color "base3"))
|
|
|
|
(set-border-color (get-color "base2"))
|
|
|
|
(set-msg-border-width 2)
|
|
|
|
|
|
|
|
;; Windows
|
|
|
|
(set-focus-color (get-color "base2"))
|
|
|
|
(set-unfocus-color (get-color "base2"))
|
|
|
|
(set-float-focus-color (get-color "base2"))
|
|
|
|
(set-float-unfocus-color (get-color "base2"))
|
2020-01-05 17:45:14 +00:00
|
|
|
|
2020-01-20 04:40:46 +00:00
|
|
|
;; Sudo
|
|
|
|
(defcommand stumpwm-password (prompt) ((:string "prompt: "))
|
|
|
|
"Prompts the user for a password"
|
|
|
|
(read-one-line (current-screen) prompt :password t))
|
|
|
|
|
2020-03-08 14:41:51 +00:00
|
|
|
(defmacro run-sudo-command (cmd &optional collect-output-p)
|
2020-01-20 04:40:46 +00:00
|
|
|
`(run-shell-command
|
|
|
|
(format nil "SUDO_ASKPASS=~~/bin/stumpwm-sudo.sh sudo -A ~S" ,cmd)
|
2020-03-08 14:41:51 +00:00
|
|
|
,collect-output-p))
|
2020-01-20 04:40:46 +00:00
|
|
|
|
2019-12-04 13:20:43 +00:00
|
|
|
;; Commands
|
2020-01-20 04:40:46 +00:00
|
|
|
(defcommand shutdown () ()
|
2020-03-08 14:47:38 +00:00
|
|
|
(when (y-or-n-p (format nil "~@{~a~^~%~}"
|
|
|
|
"You are about to shut down the computer."
|
|
|
|
"Really ^1^Bshutdown^b^n?"
|
|
|
|
"^B^6Confirm?^n "))
|
|
|
|
(run-shell-command "shutdown now")))
|
2020-01-20 04:40:46 +00:00
|
|
|
|
2019-12-04 13:20:43 +00:00
|
|
|
(defcommand firefox () ()
|
|
|
|
(run-or-raise "firefox" '(:class "firefox")))
|
2019-11-13 03:59:12 +00:00
|
|
|
|
2019-12-07 06:14:43 +00:00
|
|
|
(defcommand lock () ()
|
2019-12-07 14:49:07 +00:00
|
|
|
(run-shell-command
|
|
|
|
(concatenate 'string
|
|
|
|
"i3lockmore "
|
|
|
|
"--image-fill ~/Pictures/space-background.png "
|
|
|
|
"-n "
|
|
|
|
"--lock-icon ~/Pictures/lock.png")))
|
2019-12-07 06:14:43 +00:00
|
|
|
|
2020-01-03 01:20:22 +00:00
|
|
|
(defcommand battery () ()
|
|
|
|
(let ((capacity
|
|
|
|
(string-trim
|
|
|
|
'(#\newline)
|
|
|
|
(run-shell-command
|
|
|
|
"cat /sys/class/power_supply/BAT0/capacity"
|
|
|
|
t))))
|
|
|
|
(echo-string (current-screen)
|
|
|
|
(format nil "Battery: ~A%" capacity))))
|
|
|
|
|
2020-01-04 14:50:24 +00:00
|
|
|
(defcommand caps->escape () ()
|
|
|
|
(run-shell-command "setxkbmap -option caps:escape"))
|
|
|
|
|
2020-01-15 01:45:05 +00:00
|
|
|
(defcommand org-capture () ()
|
|
|
|
(run-shell-command "emacsclient -a '' -e '(make-orgcapture-frame)'"))
|
|
|
|
|
2020-03-05 01:00:42 +00:00
|
|
|
(defcommand background-random () ()
|
|
|
|
(run-shell-command (concatenate 'string
|
|
|
|
"feh --bg-scale "
|
|
|
|
"\"/home/jdormit/Dropbox/pictures/desktop/"
|
|
|
|
"$(ls /home/jdormit/Dropbox/pictures/desktop | shuf -n 1)\"")))
|
|
|
|
|
2019-11-13 03:59:12 +00:00
|
|
|
;; Keybindings
|
2019-12-04 13:20:43 +00:00
|
|
|
(define-key stumpwm:*root-map* (kbd "C-f") "firefox")
|
2020-02-29 13:29:57 +00:00
|
|
|
(define-key stumpwm:*root-map* (kbd "d") "exec rofi -show drun")
|
2019-11-13 03:59:12 +00:00
|
|
|
(define-key stumpwm:*root-map* (kbd "w") "exec rofi -show window")
|
|
|
|
(define-key stumpwm:*root-map* (kbd "P") "exec passmenu")
|
|
|
|
(define-key stumpwm:*root-map* (kbd "N") "exec networkmanager_dmenu")
|
2020-01-04 13:12:06 +00:00
|
|
|
(define-key stumpwm:*root-map* (kbd "M") "exec ~/bin/monitor_layout.sh")
|
2019-12-07 14:49:07 +00:00
|
|
|
(define-key stumpwm:*root-map* (kbd "L") "lock")
|
2020-01-03 01:20:22 +00:00
|
|
|
(define-key stumpwm:*root-map* (kbd "b") "battery")
|
2020-01-15 01:45:05 +00:00
|
|
|
(define-key stumpwm:*root-map* (kbd "C-o") "org-capture")
|
2020-01-23 02:14:58 +00:00
|
|
|
(define-key stumpwm:*root-map* (kbd "C-q") "quit-confirm")
|
2020-01-05 15:02:33 +00:00
|
|
|
(define-key *top-map* (kbd "M-TAB") "pull-hidden-next")
|
2019-11-15 05:30:07 +00:00
|
|
|
(define-key *top-map* (kbd "XF86MonBrightnessDown") "exec light -U 5")
|
|
|
|
(define-key *top-map* (kbd "XF86MonBrightnessUp") "exec light -A 5")
|
|
|
|
(define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec pavolume volup")
|
|
|
|
(define-key *top-map* (kbd "XF86AudioLowerVolume") "exec pavolume voldown")
|
|
|
|
(define-key *top-map* (kbd "XF86AudioMute") "exec pavolume mutetoggle")
|
2019-11-13 03:59:12 +00:00
|
|
|
|
|
|
|
;; X Windows config
|
|
|
|
(run-shell-command "xsetroot -cursor_name left_ptr")
|
2019-12-28 16:45:37 +00:00
|
|
|
(run-shell-command "setxkbmap -option caps:escape")
|
2019-11-13 03:59:12 +00:00
|
|
|
|
|
|
|
;; UI
|
|
|
|
(ql:quickload "clx-truetype")
|
|
|
|
(load-module "ttf-fonts")
|
2020-02-22 04:32:27 +00:00
|
|
|
(xft:cache-fonts)
|
2019-11-13 03:59:12 +00:00
|
|
|
(set-font
|
2020-02-27 01:54:15 +00:00
|
|
|
(make-instance 'xft:font :family "IBM Plex Mono" :subfamily "Regular" :size 12))
|
2019-11-13 03:59:12 +00:00
|
|
|
(set '*message-window-padding* 4)
|
|
|
|
|
2020-02-22 04:32:39 +00:00
|
|
|
;; Desktop background
|
2020-03-10 03:36:15 +00:00
|
|
|
(run-shell-command "feh --bg-scale ~/Dropbox/pictures/solarized-light-blank.png")
|
2020-02-22 04:32:39 +00:00
|
|
|
|
2019-11-13 03:59:12 +00:00
|
|
|
;; Notifications via Dunst
|
|
|
|
(run-shell-command "/usr/bin/dunst")
|
2020-03-10 03:36:15 +00:00
|
|
|
|
|
|
|
;; Picom compositor
|
|
|
|
(run-shell-command "picom -b")
|