01b4fd763aab

More
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 08 Sep 2020 11:51:33 -0400
parents a7f0e08891c8
children dfb5e299d678 8c32f46d08e8
branches/tags (none)
files stumpwmrc

Changes

--- a/stumpwmrc	Tue Sep 08 11:31:09 2020 -0400
+++ b/stumpwmrc	Tue Sep 08 11:51:33 2020 -0400
@@ -62,16 +62,6 @@
   (stumpwm::tile-group-current-frame (current-group)))
 
 
-(defun debug-log (string &rest args)
-  (with-open-file (s "/home/sjl/stumpwm.debug.log"
-                     :direction :output
-                     :if-exists :append
-                     :if-does-not-exist :create)
-    (apply #'format s string args)
-    (fresh-line s))
-  (first args))
-
-
 (defun keywordize (string)
   (-<> string
     (string-trim (string #\newline) <>)
@@ -124,6 +114,16 @@
 
 
 (defun window-match-p (query window)
+  "Return whether `window` matches `query`.
+
+  `query` must be of the form `(query-type query-value)`.
+
+  `query-type` must be one of `:title` or `:class`.
+
+  `query-value` must either be a string (which must be matched exactly) or
+  a PPCRE scanner.
+
+  "
   (destructuring-bind (query-type query) query
     (let ((value (ecase query-type
                    (:title (window-title window))
@@ -133,12 +133,15 @@
         (function (ppcre:scan query value))))))
 
 (defun all-windows ()
+  "Return a fresh list of all windows on all screens.  Yes, all of them."
   (mapcan #'screen-windows *screen-list*))
 
 (defun find-window (query)
+  "Find and return the first window that matches `query` under `window-match-p`."
   (find-if (lambda (w) (window-match-p query w)) (all-windows)))
 
 (defun find-windows (query)
+  "Find and return a fresh list of all windows that match `query` under `window-match-p`."
   (remove-if-not (lambda (w) (window-match-p query w)) (all-windows)))
 
 
@@ -226,25 +229,6 @@
             :name "Posture thread"))))
 
 
-;;;; Regroup ------------------------------------------------------------------
-(defparameter *class-groups*
-  '(("jetbrains-idea-ce" . "ij"))
-  "An alist of window classes to be regrouped and their targets")
-
-(defun regroup (win)
-  "Regroup window by class."
-  (let* ((class (window-class win))
-         (target (cdr (assoc class *class-groups* :test #'string=))))
-    (when target
-      (let ((group (stumpwm::find-group (current-screen) target)))
-        (when group
-          (debug-log "Regrouping ~A window to ~A group.~%" class group)
-          (move-window-to-group win group)
-          (stumpwm::update-all-mode-lines))))))
-
-(add-hook *new-window-hook* 'regroup)
-
-
 ;;;; Load ---------------------------------------------------------------------
 (load-module "pass")
 
@@ -294,10 +278,16 @@
              (typep (current-group) 'stumpwm::float-group))
            (focus-first-frame ()
              (unless (in-float-p)
-               (dotimes (i 10)
-                 (move-focus (ecase direction
-                               (:left :right)
-                               (:right :left))))))
+               ;; After moving to a new group we don't know which frame is
+               ;; focused, and unfortunately Stump doesn't give us a nice way to
+               ;; say "focus the leftmost frame" so we'll just move the focus
+               ;; a bunch of times and hope it's enough.  Sigh.
+               (loop :repeat 15
+                     :until (eql (current-frame)
+                                 (progn (move-focus (ecase direction
+                                                      (:left :right)
+                                                      (:right :left)))
+                                        (current-frame))))))
            (next-group ()
              (ecase direction
                (:right (gnext))
@@ -314,25 +304,25 @@
 
 (defcommand screen-laptop () ()
   (only)
-  (loop with laptop = "eDP1"
-        with extern = "DP1"
-        for (output commands) in `((,laptop ("--auto"))
+  (loop :with laptop = "eDP1"
+        :with extern = "DP1"
+        :for (output commands) :in `((,laptop ("--auto"))
                                    (,laptop ("--primary"))
                                    (,extern ("--off")))
-        do (progn (uiop:run-program `("xrandr" "--output" ,output ,@commands)))))
+        :do (progn (uiop:run-program `("xrandr" "--output" ,output ,@commands)))))
 
 (defcommand screen-external () ()
   (only)
-  (loop with laptop = "eDP1"
-        with extern = "DP1"
-        for (output commands) in `(
-                                   (,laptop ("--off"))
-                                   (,extern ("--auto"))
-                                   (,extern ("--primary"))
-                                   ;; (,laptop ("--auto"))
-                                   ;; (,laptop ("--right-of" ,extern))
-                                   )
-        do (uiop:run-program `("xrandr" "--output" ,output ,@commands))))
+  (loop :with laptop = "eDP1"
+        :with extern = "DP1"
+        :for (output commands) :in `(
+                                     (,laptop ("--off"))
+                                     (,extern ("--auto"))
+                                     (,extern ("--primary"))
+                                     ;; (,laptop ("--auto"))
+                                     ;; (,laptop ("--right-of" ,extern))
+                                     )
+        :do (uiop:run-program `("xrandr" "--output" ,output ,@commands))))
 
 (defcommand vlime () ()
   (load "~/src/dotfiles/vim/bundle/vlime/lisp/start-vlime.lisp")
@@ -363,11 +353,6 @@
   (run-shell-command "genpass | pbc")
   (message "Generated a fresh password and copied it to the clipboard."))
 
-;; (defcommand pass-work () ()
-;;   (let ((pass:*password-store* "/home/sjl/.password-store-work/")
-;;         (pass:*pass* "/home/sjl/src/dotfiles/bin/pass-work"))
-;;     (pass:pass-copy)))
-
 (defcommand kill-and-remove () ()
   (run-commands "kill" "remove"))
 
@@ -407,7 +392,6 @@
   (message (run-shell-command "weather -H 36" t)))
 
 
-
 ;;;; Terminal Fonts -----------------------------------------------------------
 (defcommand reload-terminal-font-size ()
     ()
@@ -471,9 +455,8 @@
   (run-or-raise "gcontrol" '(:class "Gnome-control-center")))
 
 (defcommand zoom () ()
-  (let ((window (find-window `(:title ,(ppcre:create-scanner "^Zoom Meeting ID: .*")))))
-    (when window
-      (focus-window window t))))
+  (when-let ((window (find-window `(:title ,(ppcre:create-scanner "^Zoom Meeting ID: .*")))))
+    (focus-window window t)))
 
 
 ;;;; Timers -------------------------------------------------------------------
@@ -516,7 +499,7 @@
 
 ;;;; Key Mapping --------------------------------------------------------------
 ;;; Conventions:
-;;; 
+;;;
 ;;; * Hyper-dir: move focus
 ;;; * Hyper-Shift-dir: move window
 ;;; * Hyper-Shift-Control-dir: swap window
@@ -532,7 +515,7 @@
                               ,(second form)))))
 
 
-(define-top-keys ;; application shortcuts
+(define-top-keys ;; miscellaneous
   ("H-m" "terminal")
   ("H-SunPageUp" "st-font-up")
   ("H-SunPageDown" "st-font-down")
@@ -544,7 +527,6 @@
   ("H-O" "spotify")
   ("H-o" "files")
   ("H-z" "zoom")
-  ("H-Z" "unfuck-zoom-link")
   ("H-q" "exec lock-screen")
   ("H-y" "screenshot")
   ("H-g" "gcontrol")
@@ -557,7 +539,8 @@
 (define-top-keys ;; clipboard
   ("H-u" "generate-random-uuid")
   ("H-U" "bee-movie-script")
-  ("M-H-u" "urlize-jira-issue"))
+  ("M-H-u" "urlize-jira-issue")
+  ("H-Z" "unfuck-zoom-link"))
 
 (define-top-keys ;; movement
   ("H-h" "move-focus* left")
@@ -574,6 +557,8 @@
   ("H-2" "gmove 2")
   ("H-3" "gmove 3")
   ("H-4" "gmove 4")
+  ("H-5" "gmove 5")
+  ("H-6" "gmove 6")
 
   ("C-H-H" "exchange-direction left")
   ("C-H-J" "exchange-direction down")
@@ -601,17 +586,17 @@
 (define-top-keys ;; naming
   ("H-'" "title"))
 
+(define-top-keys ;; sound
+  ("H-F1" "mute")
+  ("H-F2" "exec amixer -q sset Master 5%-")
+  ("H-F3" "exec amixer -q sset Master 5%+"))
+
 (define-top-keys ;; screen
   ("H-F5" "rotate-brightness-down")
   ("H-F6" "rotate-brightness-up")
   ("H-F7" "screen-laptop")
   ("H-F8" "screen-external"))
 
-(define-top-keys ;; sound
-  ("H-F1" "mute")
-  ("H-F2" "exec amixer -q sset Master 5%-")
-  ("H-F3" "exec amixer -q sset Master 5%+"))
-
 (define-top-keys ;; layout
   ("s-H-m" "restore-from-file ~/src/dotfiles/stumpwm/dev.lisp")
   ("s-H-s" "restore-from-file ~/src/dotfiles/stumpwm/streaming.lisp")
@@ -637,11 +622,6 @@
   ("H-F11" "toggle-current-mode-line")
   ("H-F12" "refresh-heads"))
 
-(define-top-keys ;; mouse
-  ("F35" "next-in-frame")
-  ("F34" "prev-in-frame"))
-
-
 
 ;; (stumpwm::unbind-remapped-keys)
 (define-remapped-keys