aboutsummaryrefslogtreecommitdiffstats
path: root/oni/home/services/stumpwm/config
blob: ac26c9ff63ce843444a1d9fc5b55b31acf2792cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
;; -*- 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*)))

(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-remapped-keys
    '(("teams-for-linux"
       ("C-M-Break" . "C-S-m"))))

(mode-line)
(restore-from-file "default")
(swank:create-server :dont-close t)