# HG changeset patch # User Steve Losh # Date 1756409429 14400 # Node ID 4ffd09c459f61d253211a27faa0c20e1b4dd44e1 # Parent 87ff0514c83bee8b42d6767af554be3c11d58177 More diff -r 87ff0514c83b -r 4ffd09c459f6 bin/vpn-connect --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/vpn-connect Thu Aug 28 15:30:29 2025 -0400 @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# exec /opt/cisco/anyconnect/bin/vpn connect umvpn.umnet.umich.edu/umvpn-all-traffic-alt +exec /opt/cisco/anyconnect/bin/vpn connect umvpn.umnet.umich.edu/umvpn-split-tunnel-alt diff -r 87ff0514c83b -r 4ffd09c459f6 bin/vpn-disconnect --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/vpn-disconnect Thu Aug 28 15:30:29 2025 -0400 @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -euo pipefail + +exec /opt/cisco/anyconnect/bin/vpn disconnect diff -r 87ff0514c83b -r 4ffd09c459f6 stumpwm/applications.lisp --- a/stumpwm/applications.lisp Wed Aug 27 16:17:11 2025 -0400 +++ b/stumpwm/applications.lisp Thu Aug 28 15:30:29 2025 -0400 @@ -26,6 +26,47 @@ (format nil "st -f 'Ubuntu Mono:size=~D' env -C '~A' fish" ; todo actually escape this *terminal-font-size* path))) +(defun window-pid (&optional (window (current-window))) + (let ((window-id (xlib:window-id (window-xwin (current-window))))) + (first (xlib:get-property (window-xwin window) :_net_wm_pid)))) + +(defclass* process () + (pid command-line cwd children)) + +(defmethod print-object ((o process) s) + (print-unreadable-object (o s :type t) + (format s "~D ~S (~D child(ren))" (pid o) (command-line o) (length (children o))))) + +(defun process-info (pid) + (make-instance 'process + :pid pid + :command-line (_ (format nil "/proc/~D/cmdline" pid) + alexandria:read-file-into-string + (str:split #\nul _ :end (1- (length _)))) + :cwd (sb-posix:readlink (format nil "/proc/~D/cwd" pid)) + :children (gathering + (dolist (thread (list-directory (format nil "/proc/~D/task" pid))) + (dolist (child (_ thread + namestring + (format nil "~A/children" _) + alexandria:read-file-into-string + (str:split #\space _ :omit-nulls t) + (mapcar #'parse-integer _))) + (gather (process-info child))))))) + + +(defun dwim-cwd (&optional (window (current-window))) + (recursively ((proc (process-info (window-pid window))) + (depth 0)) + (or (first (mapcar (lambda (child) + (recur child (1+ depth))) + (children proc))) + (cwd proc)))) + +(defcommand terminal-here () () + (terminal-in (dwim-cwd))) + + (defcommand terminal-apl () () (run-shell-command "st -f 'BQN386 Unicode:style=Regular:size=12'")) diff -r 87ff0514c83b -r 4ffd09c459f6 stumpwm/key-mapping.lisp --- a/stumpwm/key-mapping.lisp Wed Aug 27 16:17:11 2025 -0400 +++ b/stumpwm/key-mapping.lisp Thu Aug 28 15:30:29 2025 -0400 @@ -25,7 +25,7 @@ (define-top-keys ;; miscellaneous ("H-m" "terminal") - ("H-M" "toggle-zoom-mute") + ("H-M" "terminal-here") ("H-SunPageUp" "st-font-up") ("H-SunPageDown" "st-font-down") ("H-z" "fullscreen") @@ -79,6 +79,9 @@ ("H-4" "gselect 4") ("H-5" "gselect 5") ("H-6" "gselect 6") + ("H-7" "gselect 7") + ("H-8" "gselect 8") + ("H-9" "gselect 9") ("KP_Insert" "vgroups") ("KP_End" "gselect 1") @@ -97,6 +100,9 @@ ("H-$" "gmove 4") ("H-%" "gmove 5") ("H-^" "gmove 6") + ("H-&" "gmove 7") + ("H-(" "gmove 8") + ("H-)" "gmove 9") ("C-H-H" "exchange-direction left") ("C-H-J" "exchange-direction down") @@ -110,11 +116,9 @@ ("H-N" "pull-hidden-next") ("H-," "pull-from-windowlist") - ("H-less" "title") + ("H-." "ggo") - ("H-." "ggo") - ("H-greater" "grename") - ) + ("H-SPC" "gother")) (define-top-keys ;; splitting ("H-s" "sane-vsplit") @@ -129,8 +133,10 @@ ("H-Delete" "gkill")) (define-top-keys ;; naming - ("H-'" "title") - ("H-\"" "grename")) + ("H-'" "title") + ("H-\"" "grename") + ("H-less" "title") + ("H-greater" "grename")) (define-top-keys ;; sound ("H-F1" "mute")