From c0b5058b78438f52d9593e97b031fc6272c2f674 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Thu, 14 Jan 2021 17:30:29 +0100 Subject: configure user-level shepherd for redshift --- .gitignore | 1 + i3/i3/config | 5 ++--- shepherd/shepherd/init.d/redshift.scm | 16 ++++++++++++++++ shepherd/shepherd/init.scm | 19 +++++++++---------- 4 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 shepherd/shepherd/init.d/redshift.scm 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 + #: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 ') 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 '()) -- cgit v1.2.3