~ruther/guix-exprs

ref: acce45fe35b22f08be1edcbbb52a90c8ae52ff10 guix-exprs/ruther/home/services/kanshi.scm -rw-r--r-- 3.2 KiB
acce45fe — Rutherther chore: update wlroots, dwl git versions 28 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
(define-module (ruther home services kanshi)
  #:use-module (guix gexp)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu services)
  #:use-module (gnu services configuration)
  #:use-module (gnu services shepherd)
  #:use-module (srfi srfi-26)
  #:use-module (srfi srfi-1)
  #:use-module (gnu home services)
  #:use-module (gnu home services shepherd)
  #:use-module (ruther home services wayland)
  #:export (home-kanshi-configuration
            home-swayidle-configuration))

(define-public (serialize-kanshi-configuration config)
  (apply
   mixed-text-file
   "config"
   ((@@ (rde home services wm) serialize-sway-config) config)))

(define-public (serialize-swayidle-configuration config)
  (apply
   mixed-text-file
   "config"
   ((@@ (rde home services wm) serialize-sway-config) config)))

(define sway-config? (@ (rde home services wm) sway-config?))

(define-configuration/no-serialization home-kanshi-configuration
  (kanshi (file-like kanshi) "Kanshi package to use.")
  (config sway-config "Configuration of the kanshi program itself. Goes into .config/kanshi/config. See `man 5 kanshi`"))

(define (home-kanshi-shepherd-services config)
  (list
   (shepherd-service
    (documentation "Run the kanshi daemon for managing outputs.")
    (provision '(kanshi))
    (requirement '(wayland-display))
    (start #~(make-forkexec-constructor
              (list #$(file-append
                       (home-kanshi-configuration-kanshi config)
                       "/bin/kanshi")
                    "-c"
                    #$(serialize-kanshi-configuration (home-kanshi-configuration-config config)))))
    (stop #~(make-kill-destructor)))))

(define-public home-kanshi-service-type
  (service-type
   (name 'home-kanshi)
   (description "A service for configuring and running kanshi through Shepherd")
   (extensions
    (list (service-extension home-shepherd-service-type
                             home-kanshi-shepherd-services)
          (service-extension home-wayland-display-service-type
                             (const #f))))))

(define-configuration/no-serialization home-swayidle-configuration
  (swayidle (file-like swayidle) "Swayidle package to use.")
  (config sway-config "Configuration of the swayidle program itself. Goes into .config/swayidle/config. See `man 5 swayidle`"))

(define (home-swayidle-shepherd-services config)
  (list
   (shepherd-service
    (documentation "Run the swayidle daemon for managing commands executed when idle.")
    (provision '(swayidle))
    (requirement '(wayland-display))
    (start #~(make-forkexec-constructor
              (list #$(file-append
                       (home-swayidle-configuration-swayidle config)
                       "/bin/swayidle")
                    "-wC"
                    #$(serialize-swayidle-configuration (home-swayidle-configuration-config config)))))
    (stop #~(make-kill-destructor)))))

(define-public home-swayidle-service-type
  (service-type
   (name 'home-swayidle)
   (description "A service for configuring and running swayidle through Shepherd")
   (extensions
    (list (service-extension home-shepherd-service-type
                             home-swayidle-shepherd-services)
          (service-extension home-wayland-display-service-type
                             (const #f))))))
Do not follow this link