-
Notifications
You must be signed in to change notification settings - Fork 1
/
commands.lisp
31 lines (25 loc) · 1.01 KB
/
commands.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(in-package :stumpwm)
(export '(loadrc-forget
now-playing
sh-time
sdcv
set-backlight))
(defcommand loadrc-forget () () "Reload the @file{~/.stumpwmrc} file without remember current state."
(handler-case
(progn
(with-restarts-menu (load-rc-file nil)))
(error (c)
(message "^B^1*Error loading rc file:^n ~A" c))
(:no-error (&rest args)
(declare (ignore args))
(message "rc file loaded successfully."))))
(defcommand now-playing () ()
(message "~A" (run-shell-command "mpc --format \"[[%artist% - ]%title%]\"| head -1" T)))
(defcommand sh-time () ()
(message "~A" (run-shell-command "date \"+%H:%M [%e %b, %A]\"" T)))
(defcommand sdcv () ()
)
(defcommand set-backlight (level) ((:number "Set brightness level:"))
(with-open-file (sys-backlight-file "/sys/class/backlight/intel_backlight/brightness"
:direction :output :if-exists :overwrite)
(format sys-backlight-file "~a~%" (* 100 level))))