brightness control, inhibit sleep, install fonts

This commit is contained in:
Rune Juhl (Atea) 2024-09-14 04:16:51 +02:00
parent 1ba93e4cad
commit 547d40ff46
3 changed files with 87 additions and 0 deletions

26
inhibit_sleep Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bb
(ns inhibit-sleep
(:require [clojure.java.shell :refer [sh]]))
(defn has-lock? []
(->> (sh "systemd-inhibit")
:out
(clojure.string/split-lines)
(filter #(re-find #"inhibit-sleep" %))
seq))
(case (some->> *command-line-args*
first)
"get" (if (boolean (has-lock?))
"inhibited"
"normal")
"toggle"
(if (has-lock?)
nil
(apply sh (clojure.string/split
"systemd-inhibit \
--what=handle-lid-switch:sleep \
--why=':inhibit-sleep' \
--mode=block cat" #"\s+"))))