dotfiles/oni/home/services/stumpwm/config

88 lines
2.5 KiB
Common Lisp

;; -*- mode: lisp; -*-
(in-package :stumpwm-user)
(require 'swank)
(set-prefix-key (kbd "s-x"))
(defvar *screen-locking-hook* nil
"Hook that gets called right before the screen gets locked.")
(defvar *screen-unlocked-hook* nil
"Hook that gets called right after the screen is unlocked.")
(defun run-screen-unlocked-hook (process)
"Run `*screen-unlocked-hook* if PROCESS' status is `:exited'."
(when (eq (sb-ext:process-status process) :exited)
(run-hook *screen-unlocked-hook*)))
(defun vpn-connected-p ()
(probe-file "/sys/class/net/vpn"))
(defcommand lock-screen () ()
"Lock the screen using i3lock.
Run `*screen-locking-hook*' before locking it and run `*screen-unlocked-hook*'
after it has been unlocked."
(run-hook *screen-locking-hook*)
(sb-ext:run-program
*shell-program* '("-c" "i3lock --nofork --color=000000")
:wait nil
:status-hook #'run-screen-unlocked-hook))
(defcommand raise-browser () ()
"Open or show my browser"
(run-or-raise "firefox" '(:class "firefox")))
(defcommand raise-emacs () ()
"Open or show Emacs"
(run-or-raise "emacsclient -c" '(:class "Emacs")))
(defcommand raise-terminal () ()
"Open or show my terminal"
(run-or-raise "kitty" '(:class "kitty")))
(define-key *top-map* (kbd "C-M-l") "lock-screen")
(define-key *top-map* (kbd "s-b") "raise-browser")
(define-key *top-map* (kbd "s-e") "raise-emacs")
(define-key *top-map* (kbd "s-t") "raise-terminal")
(define-key *top-map* (kbd "s-!") "exec rofi -show drun")
(define-key *top-map* (kbd "s-w") "exec rofi -show window")
(define-remapped-keys
'(("teams-for-linux"
("C-M-Break" . "C-S-m"))))
(set-bg-color "#222424")
(set-border-color "#3f4242")
(set-fg-color "#bfbfbf")
(set-float-focus-color "#5b6161")
(set-float-unfocus-color "#3f4242")
(set-focus-color "#ff9800")
(set-unfocus-color "#3f4242")
(setf *mode-line-background-color* "#5b6161"
*mode-line-foreground-color* "#bfbfbf")
(setf *screen-mode-line-format*
(list " [^B%n^b] "
'(:eval
(or (ignore-errors (window-title (current-window)))
"Unknown"))
"^>"
'(:eval
(if (vpn-connected-p)
"^*5^B[VPN]^b^n "
""))
"%d "))
(mode-line)
(restore-from-file "default")
(define-frame-preference "Default"
(0 t nil :class "kitty")
(1 t nil :class "Emacs")
(3 t nil :class "firefox"))
(define-frame-preference "teams"
(0 t t :class "teams-for-linux" :create t))
(swank:create-server :dont-close t)