2023-03-17 00:35:06 +01:00
|
|
|
;; -*- mode: lisp; -*-
|
|
|
|
(in-package :stumpwm-user)
|
|
|
|
|
|
|
|
(require 'swank)
|
|
|
|
|
|
|
|
(set-prefix-key (kbd "s-x"))
|
|
|
|
|
2023-03-17 06:13:22 +01:00
|
|
|
(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*)))
|
|
|
|
|
2023-04-22 09:32:05 +02:00
|
|
|
(defun vpn-connected-p ()
|
|
|
|
(probe-file "/sys/class/net/vpn"))
|
|
|
|
|
2023-03-17 06:13:22 +01:00
|
|
|
(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
|
2023-04-22 09:28:43 +02:00
|
|
|
*shell-program* '("-c" "i3lock --nofork --color=000000")
|
2023-03-17 06:13:22 +01:00
|
|
|
:wait nil
|
|
|
|
:status-hook #'run-screen-unlocked-hook))
|
|
|
|
|
2023-03-17 00:35:06 +01:00
|
|
|
(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")))
|
|
|
|
|
2023-03-17 06:13:22 +01:00
|
|
|
(define-key *top-map* (kbd "C-M-l") "lock-screen")
|
2023-03-17 00:35:06 +01:00
|
|
|
(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")
|
2023-04-22 09:29:14 +02:00
|
|
|
(define-key *top-map* (kbd "s-!") "exec rofi -show drun")
|
|
|
|
(define-key *top-map* (kbd "s-w") "exec rofi -show window")
|
2023-03-17 00:35:06 +01:00
|
|
|
|
|
|
|
(define-remapped-keys
|
2024-01-16 09:57:44 +01:00
|
|
|
`(("teams-for-linux"
|
|
|
|
;; Mute microphone in meetings.
|
|
|
|
("XF86Launch6" . "C-S-m"))
|
|
|
|
("[Ff]irefox"
|
|
|
|
;; Generally cancel action.
|
|
|
|
("XF86Launch6" . "ESC"))
|
|
|
|
("[Ee]macs"
|
|
|
|
;; Save document.
|
|
|
|
("XF86Launch5" . ("C-x" "C-s"))
|
2024-01-16 18:32:37 +01:00
|
|
|
;; Save some documents.
|
|
|
|
("S-XF86Launch5" . ("C-x" "s"))
|
2024-01-16 09:57:44 +01:00
|
|
|
;; Quit command.
|
|
|
|
("XF86Launch6" . "C-g")
|
|
|
|
;; Revert (reload) file.
|
|
|
|
("XF86Launch7" . ("C-x" "x" "g")))
|
|
|
|
;; Portal: Revolution
|
|
|
|
("revolution"
|
|
|
|
;; Quick Save
|
|
|
|
("XF86Launch5" . "F6")
|
|
|
|
;; Quick Load
|
|
|
|
("XF86Launch7" . "F7"))))
|
2023-03-17 00:35:06 +01:00
|
|
|
|
2023-04-22 09:32:20 +02:00
|
|
|
(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")
|
|
|
|
|
2023-03-17 06:47:48 +01:00
|
|
|
(setf *mode-line-background-color* "#5b6161"
|
2023-04-22 09:31:21 +02:00
|
|
|
*mode-line-foreground-color* "#bfbfbf")
|
|
|
|
(setf *screen-mode-line-format*
|
|
|
|
(list " [^B%n^b] "
|
2023-04-22 09:39:16 +02:00
|
|
|
"^[^(:bg \"#f17272\")^(:fg \"#222424\") "
|
2023-04-22 09:31:21 +02:00
|
|
|
'(:eval
|
|
|
|
(or (ignore-errors (window-title (current-window)))
|
|
|
|
"Unknown"))
|
2023-04-22 09:39:16 +02:00
|
|
|
" ^]^>"
|
2023-04-22 09:32:05 +02:00
|
|
|
'(:eval
|
|
|
|
(if (vpn-connected-p)
|
|
|
|
"^*5^B[VPN]^b^n "
|
|
|
|
""))
|
|
|
|
"%d "))
|
2024-07-01 23:17:30 +02:00
|
|
|
|
|
|
|
;;; Redefinition of the make mode-line window to add the Dock window type.
|
|
|
|
(defun stumpwm::make-mode-line-window (screen)
|
|
|
|
"Create a window suitable for a modeline."
|
|
|
|
(let ((window (xlib:create-window
|
|
|
|
:parent (screen-root screen)
|
|
|
|
:x 0 :y 0 :width 1 :height 1
|
|
|
|
:background (stumpwm::alloc-color screen *mode-line-background-color*)
|
|
|
|
:border (stumpwm::alloc-color screen *mode-line-border-color*)
|
|
|
|
:border-width *mode-line-border-width*
|
|
|
|
;; You can click the modeline
|
|
|
|
:event-mask (xlib:make-event-mask :button-press :exposure)
|
|
|
|
;; these windows are not controlled by the window manager
|
|
|
|
:override-redirect :on)))
|
|
|
|
(xlib:change-property
|
|
|
|
window :_NET_WM_WINDOW_TYPE
|
|
|
|
(list (xlib:find-atom *display* :_NET_WM_WINDOW_TYPE_DOCK))
|
|
|
|
:atom 32)
|
|
|
|
window))
|
|
|
|
|
2023-03-17 00:35:06 +01:00
|
|
|
(mode-line)
|
2023-03-17 06:47:48 +01:00
|
|
|
|
2023-07-15 10:30:43 +02:00
|
|
|
;;; Screenshots
|
|
|
|
|
|
|
|
(defvar *screenshot-bindings*
|
|
|
|
(let ((m (make-sparse-keymap)))
|
|
|
|
(define-key m (kbd "s") "exec flameshot gui")
|
|
|
|
(define-key m (kbd "c") "exec flameshot screen")
|
|
|
|
(define-key m (kbd "f") "exec flameshot full")
|
|
|
|
m))
|
|
|
|
|
2023-09-28 08:44:21 +02:00
|
|
|
(defvar *notification-bindings*
|
|
|
|
(let ((m (make-sparse-keymap)))
|
|
|
|
(define-key m (kbd "RET") "exec dunstctl action")
|
|
|
|
(define-key m (kbd "c") "exec dunstctl close")
|
|
|
|
(define-key m (kbd "S-c") "exec dunstctl close-all")
|
|
|
|
(define-key m (kbd "SPC") "exec dunstctl context")
|
|
|
|
(define-key m (kbd ",") "exec dunstctl history-pop")
|
|
|
|
(define-key m (kbd "p") "exec dunstctl set-paused toggle")
|
|
|
|
m))
|
|
|
|
|
2023-07-15 10:30:43 +02:00
|
|
|
(defvar *user-bindings*
|
|
|
|
(let ((m (make-sparse-keymap)))
|
2023-07-23 08:06:12 +02:00
|
|
|
(define-key m (kbd "s") '*screenshot-bindings*)
|
2023-09-28 08:44:21 +02:00
|
|
|
(define-key m (kbd "n") '*notification-bindings*)
|
2023-07-23 08:06:12 +02:00
|
|
|
m))
|
2023-07-15 10:30:43 +02:00
|
|
|
|
|
|
|
(define-key *top-map* (kbd "s-c") '*user-bindings*)
|
|
|
|
|
2023-03-17 00:35:06 +01:00
|
|
|
(restore-from-file "default")
|
2023-03-30 18:59:37 +02:00
|
|
|
|
|
|
|
(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))
|
|
|
|
|
2024-07-01 23:20:25 +02:00
|
|
|
(sb-ext:run-program *shell-program* '("-c" "feh --bg-center ~/pictures/wallpaper/5120x1440/wallhaven-v9ydgl.jpg"))
|
|
|
|
|
2023-03-17 00:35:06 +01:00
|
|
|
(swank:create-server :dont-close t)
|
2023-08-15 09:22:18 +02:00
|
|
|
|
|
|
|
(which-key-mode)
|