summaryrefslogtreecommitdiff
path: root/dotfiles/.dmd.d/init.scm
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/.dmd.d/init.scm')
-rw-r--r--dotfiles/.dmd.d/init.scm25
1 files changed, 18 insertions, 7 deletions
diff --git a/dotfiles/.dmd.d/init.scm b/dotfiles/.dmd.d/init.scm
index 99edf73..4effd13 100644
--- a/dotfiles/.dmd.d/init.scm
+++ b/dotfiles/.dmd.d/init.scm
@@ -8,6 +8,17 @@
(0 (begin body ...))
(pid pid)))
+(define (run-command command)
+ (zero? (status:exit-val (apply system* command))))
+
+(define (make-system-constructor command)
+ (lambda _
+ (run-command command)))
+
+(define (make-system-destructor command)
+ (lambda _
+ (not (run-command command))))
+
(define (simple-service program)
(make <service>
#:provides (list (string->symbol program))
@@ -22,9 +33,8 @@
(make <service>
#:provides '(emacs)
#:requires '()
- ;; FIXME: Stopping this service doesn't kill emacs because it was
- ;; daemonized.
- #:start (make-forkexec-constructor (list "emacs" "--daemon")))
+ #:start (make-system-constructor '("emacs" "--daemon"))
+ #:stop (make-system-destructor '("emacsclient" "--eval" "(kill-emacs)")))
;; Customize X key bindings.
(make <service>
#:provides '(xmodmap)
@@ -35,11 +45,12 @@
(make <service>
#:provides '(gpg-agent)
#:requires '()
- #:start (make-forkexec-constructor
- (list "gpg-agent"
- "--enable-ssh-support"
+ #:start (make-system-constructor
+ (list "gpg-agent" "--daemon" "--enable-ssh-support"
"--pinentry-program"
- (string-append %home "/.guix-profile/bin/pinentry-gtk-2"))))
+ (string-append %home "/.guix-profile/bin/pinentry-gtk-2")))
+ #:stop (make-system-destructor
+ '("gpg-connect-agent" "killagent" "/bye")))
;; Mailbox sync.
(make <service>
#:provides '(offlineimap)