brightness control, inhibit sleep, install fonts
This commit is contained in:
parent
1ba93e4cad
commit
547d40ff46
3 changed files with 87 additions and 0 deletions
26
inhibit_sleep
Executable file
26
inhibit_sleep
Executable 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+"))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue