1fa04416fcdb

More
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 08 Sep 2020 11:30:23 -0400
parents 5e6b2fd0a0e1
children a7f0e08891c8
branches/tags (none)
files lisp/pick.lisp stumpwm/zoom.lisp stumpwmrc

Changes

--- a/lisp/pick.lisp	Wed Sep 02 12:12:39 2020 -0400
+++ b/lisp/pick.lisp	Tue Sep 08 11:30:23 2020 -0400
@@ -1,5 +1,5 @@
 (eval-when (:compile-toplevel :load-toplevel :execute)
-  (ql:quickload '(:adopt) :silent t))
+  (ql:quickload '(:adopt :with-user-abort) :silent t))
 
 (defpackage :pick
   (:use :cl)
@@ -149,22 +149,28 @@
                     *option-many*)))
 
 
+(defmacro exit-on-ctrl-c (&body body)
+  `(handler-case
+       (with-user-abort:with-user-abort (progn ,@body))
+     (with-user-abort:user-abort () (adopt:exit 130))))
+
 (defun toplevel ()
-  (handler-case
-      (multiple-value-bind (arguments options) (adopt:parse-options *ui*)
-        (cond ((gethash 'help options) (adopt:print-help-and-exit *ui* :option-width 24))
-              ((gethash 'version options) (write-line *version*) (adopt:exit)))
-        (with-open-file (*interactive-input* "/dev/tty" :direction :input)
-          (let ((*separator* (gethash 'separator options))
-                (*interactive-output* *error-output*)
-                (arguments (mapcan (lambda (arg)
-                                     (if (string= "-" arg)
-                                       (read-lines *standard-input*)
-                                       (list arg)))
-                                   arguments)))
-            (funcall (if (gethash 'one options)
-                       #'run-one
-                       #'run-many)
-                     arguments))))
-    (error (c) (adopt:print-error-and-exit c))))
+  (exit-on-ctrl-c
+    (handler-case
+        (multiple-value-bind (arguments options) (adopt:parse-options *ui*)
+          (cond ((gethash 'help options) (adopt:print-help-and-exit *ui* :option-width 24))
+                ((gethash 'version options) (write-line *version*) (adopt:exit)))
+          (with-open-file (*interactive-input* "/dev/tty" :direction :input)
+            (let ((*separator* (gethash 'separator options))
+                  (*interactive-output* *error-output*)
+                  (arguments (mapcan (lambda (arg)
+                                       (if (string= "-" arg)
+                                         (read-lines *standard-input*)
+                                         (list arg)))
+                                     arguments)))
+              (funcall (if (gethash 'one options)
+                         #'run-one
+                         #'run-many)
+                       arguments))))
+      (error (c) (adopt:print-error-and-exit c)))))
 
--- a/stumpwm/zoom.lisp	Wed Sep 02 12:12:39 2020 -0400
+++ b/stumpwm/zoom.lisp	Tue Sep 08 11:30:23 2020 -0400
@@ -38,22 +38,22 @@
                  :X 1452
                  :Y 0
                  :WIDTH 2348
-                 :HEIGHT 120
+                 :HEIGHT 40
                  :WINDOWS NIL
                  :CURRENT NIL)
               #S(FDUMP
                  :NUMBER 6
                  :X 1452
-                 :Y 120
-                 :WIDTH 2348
-                 :HEIGHT 1320
-                 :WINDOWS (23068677)
-                 :CURRENT 23068677)))
+                 :Y 40
+                 :WIDTH 2300
+                 :HEIGHT 1400
+                 :WINDOWS NIL
+                 :CURRENT NIL)))
             (#S(FDUMP
                 :NUMBER 3
-                :X 3800
+                :X 3752 
                 :Y 0
-                :WIDTH 660
+                :WIDTH 708 
                 :HEIGHT 1440
                 :WINDOWS NIL
                 :CURRENT NIL)
@@ -73,4 +73,4 @@
                  :HEIGHT 495
                  :WINDOWS NIL
                  :CURRENT NIL))))))
-   :CURRENT 6)
\ No newline at end of file
+   :CURRENT 6)
--- a/stumpwmrc	Wed Sep 02 12:12:39 2020 -0400
+++ b/stumpwmrc	Tue Sep 08 11:30:23 2020 -0400
@@ -1,6 +1,6 @@
 (in-package :stumpwm-user)
 
-(ql:quickload '(:losh :split-sequence :alexandria :parse-number :str :cl-ppcre) :silent t)
+(ql:quickload '(:losh :split-sequence :alexandria :parse-number :str :cl-ppcre :bordeaux-threads) :silent t)
 (use-package :losh)
 
 
@@ -386,6 +386,23 @@
 (defcommand describe-window () ()
   (show-window-properties))
 
+(defcommand unfuck-zoom-link () ()
+  (let ((url (pbpaste)))
+    (ppcre:register-groups-bind
+        (meeting-id meeting-pass)
+        ("^https://[a-zA-Z0-9]+[.]zoom[.]us/j/(\\d+)[?]pwd=([A-Za-z0-9]+)$" url)
+      (pbcopy meeting-id)
+      (message "Zoom meeting ID copied.")
+      (bt:make-thread (lambda ()
+                        (sleep 3)
+                        (pbcopy meeting-pass)
+                        (message "Zoom meeting password copied.")
+                        (sleep 5)
+                        (pbcopy ""))
+                      :name "Zoom Link Defuckulator")
+      (return-from unfuck-zoom-link))
+    (message "Clipboard doesn't seem to be a Zoom link.")))
+
 
 ;;;; Terminal Fonts -----------------------------------------------------------
 (defcommand reload-terminal-font-size ()
@@ -519,6 +536,7 @@
   ("H-B" "exec firefox")
   ("H-o" "spotify")
   ("H-z" "zoom")
+  ("H-Z" "unfuck-zoom-link")
   ("H-q" "exec lock-screen")
   ("H-y" "screenshot")
   ("H-g" "gcontrol")