--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/screenshot Fri Jun 14 14:45:49 2019 -0400
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+flameshot gui -p ~/screenshots
--- a/bin/screenshot-area Tue Jun 11 12:50:14 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-#!/usr/bin/env bash
-
-set -euo pipefail
-
-sleep 0.2 ; scrot 'screenshot_%Y-%m-%d_%H-%M-%S.png' -s -e 'mv $f ~/screenshots && echo -n ~/screenshots/$f' | xsel --clipboard --input
--- a/bin/screenshot-screen Tue Jun 11 12:50:14 2019 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-#!/usr/bin/env bash
-
-set -euo pipefail
-
-sleep 0.2 ; scrot 'screenshot_%Y-%m-%d_%H-%M-%S.png' -m -e 'mv $f ~/screenshots && echo -n ~/screenshots/$f' | xsel --clipboard --input
--- a/stumpwmrc Tue Jun 11 12:50:14 2019 -0400
+++ b/stumpwmrc Fri Jun 14 14:45:49 2019 -0400
@@ -1,6 +1,6 @@
(in-package :stumpwm-user)
-(ql:quickload '(:losh :split-sequence :alexandria) :silent t)
+(ql:quickload '(:losh :split-sequence :alexandria :parse-number) :silent t)
(use-package :losh)
@@ -95,6 +95,29 @@
(* hours 60 60))
+(define-stumpwm-type :integer (input prompt)
+ ;; Annoyingly, StumpWM's built-in :number type isn't actually number, but is
+ ;; actually just integers. Define a better-named type here.
+ (when-let ((n (or (argument-pop input)
+ (read-one-line (current-screen) prompt))))
+ (handler-case
+ (parse-integer n)
+ (parse-error (c)
+ (declare (ignore c))
+ (throw 'error "Integer required.")))))
+
+(define-stumpwm-type :real (input prompt)
+ (when-let ((n (or (argument-pop input)
+ (read-one-line (current-screen) prompt))))
+ (handler-case
+ (let ((result (parse-number:parse-number n)))
+ (assert (typep result 'real))
+ result)
+ (error (c)
+ (declare (ignore c))
+ (throw 'error "Real required.")))))
+
+
;;;; Posture ------------------------------------------------------------------
(defparameter *posture-thread* nil)
(defparameter *posture-should-stop* nil)
@@ -127,7 +150,7 @@
(message "Posture is now unpaused.")))
(defcommand posture-snooze (hours)
- ((:number "Snooze for how many hours? "))
+ ((:real "Snooze for how many hours? "))
(setf *posture-snooze* (+ (hours->seconds hours) (get-universal-time))))
(defun posture-update (delta)
@@ -139,10 +162,16 @@
(defcommand posture-answer-yes () ()
(message "Good work.")
+ (run-shell-command "echo $(epochseconds) 1.0 >> ~/.posture.log")
(posture-update 11/10))
+(defcommand posture-answer-meh () ()
+ (message "Better than nothing.")
+ (run-shell-command "echo $(epochseconds) 0.5 >> ~/.posture.log"))
+
(defcommand posture-answer-no () ()
(message "Try harder.")
+ (run-shell-command "echo $(epochseconds) 0.0 >> ~/.posture.log")
(posture-update 8/10))
(defun posture% ()
@@ -196,12 +225,8 @@
(load-module "pass")
;;;; Screenshotting -----------------------------------------------------------
-(defcommand screenshot-area () ()
- ;; todo why the hell do these not pick up my fuckin path?
- (run-shell-command "/home/sjl/src/dotfiles/bin/screenshot-area"))
-
-(defcommand screenshot-screen () ()
- (run-shell-command "/home/sjl/src/dotfiles/bin/screenshot-screen"))
+(defcommand screenshot () ()
+ (run-shell-command "screenshot"))
;;;; Brightness ---------------------------------------------------------------
@@ -284,7 +309,7 @@
(load "~/src/dotfiles/vim/bundle/vlime/lisp/start-vlime.lisp")
(message "Started VLIME"))
-(defcommand vlime-port (port) ((:number "Port: "))
+(defcommand vlime-port (port) ((:integer "Port: "))
"Start VLIME on the given port.
Good for bootstrapping a VLIME connection when you accidentally started a
@@ -389,13 +414,13 @@
(pop-timer))
(defcommand set-pop-timer (minutes seconds)
- ((:number "Minutes: ")
- (:number "Seconds: "))
+ ((:integer "Minutes: ")
+ (:integer "Seconds: "))
(setf *pop-timer-minutes* minutes
*pop-timer-seconds* seconds))
(defcommand tea-timer (seconds)
- ((:number "Seconds: "))
+ ((:integer "Seconds: "))
(run-shell-command (format nil "tea ~D" seconds)))
@@ -428,8 +453,7 @@
("H-B" "exec firefox")
("H-o" "spotify")
("H-q" "exec slock")
- ("H-y" "screenshot-area")
- ("H-Y" "screenshot-screen")
+ ("H-y" "screenshot")
("H-r" "loadrc")
("H-V" "vlime"))
@@ -495,6 +519,7 @@
("s-p" "posture-start")
("s-P" "posture-stop")
("s-y" "posture-answer-yes")
+ ("s-h" "posture-answer-meh")
("s-n" "posture-answer-no")
("s-\\" "posture-toggle-pause")
("s-o" "posture-snooze"))