summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2021-01-14 17:30:29 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2021-01-14 17:30:29 +0100
commitc0b5058b78438f52d9593e97b031fc6272c2f674 (patch)
treec204f9c9c7a6e4ae12ed3ed2ba36072cef1303dc
parent5e995529f7b522452ff1c6798c7a0ff3d0bf4c3c (diff)
configure user-level shepherd for redshift
-rw-r--r--.gitignore1
-rw-r--r--i3/i3/config5
-rw-r--r--shepherd/shepherd/init.d/redshift.scm16
-rw-r--r--shepherd/shepherd/init.scm19
4 files changed, 28 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 7681394..97d9740 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ nvim/nvim/bundle/
nvim/nvim/shada/
nvim/nvim/swap/
nvim/nvim/undo/
+*.log
diff --git a/i3/i3/config b/i3/i3/config
index b599bdd..e425978 100644
--- a/i3/i3/config
+++ b/i3/i3/config
@@ -196,6 +196,5 @@ bindsym Shift+Print exec --no-startup-id maim --select | xclip -selection clipbo
bindsym $mod+Shift+t exec xinput --enable 12
bindsym $mod+t exec xinput --disable 12
-
-# Keyboard layout change
-# bindsym $mod+x exec setxkbmap ru
+# Start user-level service cotrol with shepherd
+exec --no-startup-id shepherd
diff --git a/shepherd/shepherd/init.d/redshift.scm b/shepherd/shepherd/init.d/redshift.scm
new file mode 100644
index 0000000..d17474f
--- /dev/null
+++ b/shepherd/shepherd/init.d/redshift.scm
@@ -0,0 +1,16 @@
+(define redshift
+ (make <service>
+ #:provides '(redshift)
+ #:docstring "Redshift adjusts the color temperature of your screen
+ according to your surroundings. This may help your eyes hurt less if you are
+ working in front of the screen at night."
+ #:start (make-forkexec-constructor '("redshift")
+ #:log-file (string-append
+ (or (getenv "XDG_CONFIG_HOME")
+ (string-append (getenv "HOME") "/.config"))
+ "/redshift/redshift.log"))
+ #:stop (make-kill-destructor)
+ #:respawn? #t))
+(register-services redshift)
+
+(start redshift)
diff --git a/shepherd/shepherd/init.scm b/shepherd/shepherd/init.scm
index 8ef2166..126684b 100644
--- a/shepherd/shepherd/init.scm
+++ b/shepherd/shepherd/init.scm
@@ -1,14 +1,13 @@
-;; init.scm -- default shepherd configuration file.
+(use-modules (shepherd service)
+ ((ice-9 ftw) #:select (scandir)))
-;; Services known to shepherd:
-;; Add new services (defined using 'make <service>') to shepherd here by
-;; providing them as arguments to 'register-services'.
-(register-services)
+;; Load all the files in the directory 'init.d' with a suffix '.scm'.
+(for-each
+ (lambda (file)
+ (load (string-append "init.d/" file)))
+ (scandir (string-append (dirname (current-filename)) "/init.d")
+ (lambda (file)
+ (string-suffix? ".scm" file))))
;; Send shepherd into the background
(action 'shepherd 'daemonize)
-
-;; Services to start when shepherd starts:
-;; Add the name of each service that should be started to the list
-;; below passed to 'for-each'.
-(for-each start '())