~abcdw/rde

rde/rde/features/xdisorg.scm -rw-r--r-- 3.3 KiB
e98d6a8eAndrew Tropin rde: gnupg: Add copyright preamble. 19 hours 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
(define-module (rde features xdisorg)
  #:use-module (rde features)
  #:use-module (rde features predicates)
  #:use-module (rde features fontutils)
  #:use-module (rde packages)
  #:use-module (gnu packages xdisorg)
  #:use-module (gnu services)
  #:use-module (gnu services base)
  #:use-module (gnu home services)
  #:use-module (gnu home services shepherd)
  #:use-module (rde home services xdisorg)
  #:use-module (rde system services accounts)
  #:use-module (guix gexp)
  #:export (feature-rofi
            feature-ydotool))


;;;
;;; rofi.
;;;

(define* (feature-rofi
          #:key
          (rofi rofi-wayland)
          (theme "Arc")
          (show-icons? #t)
          (show-actions? #t)
          (default-application-launcher? #t))
  "Configure rofi."
  (ensure-pred any-package? rofi)
  (ensure-pred file-like-or-path? theme)

  (define (get-home-services config)
    (define font
      (and=> (get-value 'font-monospace config)
             font-specification))

    (list
     (service
      home-rofi-service-type
      (home-rofi-configuration
       (rofi rofi)
       (config-rasi
        `((configuration
           ((modi . "run,ssh,drun")
            (drun-show-actions . ,show-actions?)
            (show-icons . ,show-icons?)
            ,@(if font `((font . ,font)) '())
            (kb-row-tab . "")
            (kb-row-select . "Tab")
            (kb-secondary-paste . "Control+y")
            (kb-remove-word-forward . "Alt+d")
            (kb-remove-word-back . "Control+w,Control+BackSpace")
            (kb-clear-line . "Control+slash")
            (kb-page-next . "Control+v")
            (kb-page-prev . "Alt+v")))
          ,#~(format #f "@theme \"~a\"" #$theme)))))))

  (feature
   (name 'rofi)
   (values `((rofi . ,rofi)
             ,@(if default-application-launcher?
                   `((default-application-launcher .
                       ,(file-append rofi "/bin/rofi -show drun")))
                   '())))
   (home-services-getter get-home-services)))


;;;
;;; ydotool.
;;;

(define* (feature-ydotool
          #:key
          (ydotool ydotool))
  "Configure Ydotool."
  (ensure-pred file-like? ydotool)

  (define (get-home-services config)
    (list
     (simple-service
      'ydotool-add-ydotool-package
      home-profile-service-type
      (list ydotool))
     (simple-service
      'start-ydotoold-at-startup
      home-shepherd-service-type
      (list (shepherd-service
             (documentation "Run the ydotool daemon (ydotoold).")
             (provision '(ydotool))
             (requirement '())
             (start #~(make-forkexec-constructor
                       (list (string-append
                              #$ydotool "/bin/ydotoold"))))
             (one-shot? #f)
             (stop #~(make-kill-destructor)))))))

  (define (get-system-services _)
    (list
     (simple-service
      'ydotool-add-input-group-to-user
      rde-account-service-type
      (list "input"))
     (udev-rules-service
      'ydotool
      (udev-rule
       "80-uinput.rules"
       ;; TODO: Take it from ydotool package
       (string-append
        "KERNEL==\"uinput\", MODE==\"0660\", "
        "GROUP=\"input\", OPTIONS+=\"static_node=uinput\"")))))

  (feature
   (name 'ydotool)
   (values `((ydotool . ,ydotool)))
   (home-services-getter get-home-services)
   (system-services-getter get-system-services)))