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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
(define-module (ruther home dwl wm)
#:use-module (gnu packages)
#:use-module (gnu packages wm)
#:use-module (gnu packages xorg)
#:use-module (gnu packages bash)
#:use-module (gnu packages emacs)
#:use-module (gnu packages xdisorg)
#:use-module (gnu packages terminals)
#:use-module (gnu packages hardware)
#:use-module (gnu packages image)
#:use-module (gnu packages base)
#:use-module (gnu packages gnome)
#:use-module (ruther packages wayland)
#:use-module (ruther home passwords)
#:use-module (ruther home emacs)
#:use-module (guix build-system trivial)
#:use-module (guix packages)
#:use-module (guix profiles)
#:use-module (guix build union)
#:use-module (guix gexp)
#:use-module (guix utils)
#:use-module (guix download)
#:use-module (guix git-download))
;; TODO mako progress bar?
(define-public mako-mine
(package
(inherit mako)
(name "mako-mine")
(source
(origin
(inherit (package-source mako))
(patches
(list
(local-file "mako-keep-style.patch")))))))
(define-public waybar-mine
(package
(inherit waybar)
(name "waybar-mine")
(source
(origin
(inherit (package-source waybar))
(patches
(cons* (local-file "dwl-ipc-waybar.patch")
(origin-patches (package-source waybar))))))))
(define-public (make-dwl-xwayland dwl)
(package/inherit dwl
(inputs
(modify-inputs (package-inputs dwl)
(append xcb-util-wm libx11 xorg-server-xwayland)))
(arguments (substitute-keyword-arguments (package-arguments dwl)
((#:make-flags original-flags)
#~(append '("XWAYLAND = -DXWAYLAND"
"XLIBS = xcb xcb-icccm")
#$original-flags))))))
;; TODO: make this a guile script
;; but I am too lazy for now.
(define brightness-script-builder
(with-imported-modules '((guix build utils))
#~(begin
(use-modules (guix build utils))
(set-path-environment-variable
"PATH" (list "bin")
(list #$brillo
#$libnotify))
(apply invoke
(cons* #$(file-append bash "/bin/sh")
#$(local-file "scripts/brightness.sh")
(cdr (program-arguments)))))))
(define-public brightness-script
(program-file
"brightness-script"
brightness-script-builder))
;; TODO: make this a guile script
;; but I am too lazy for now.
(define printscreen-script-builder
(with-imported-modules
'((guix build utils))
#~(begin
(use-modules (guix build utils))
(set-path-environment-variable
"PATH" (list "bin")
(list #$slurp
#$grim
#$wl-clipboard
#$coreutils-minimal))
(apply invoke
(cons*
#$(file-append bash "/bin/bash")
#$(local-file "scripts/print.sh")
(cdr (program-arguments)))))))
(define-public printscreen-script
(program-file
"printscreen-script"
printscreen-script-builder))
(define-public dwl-mine-unwrapped
(let ((base (make-dwl-xwayland dwl-0.7)))
(package
(inherit base)
(name "dwl-mine-unwrapped")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://git.ditigal.xyz/~ruther/dwl")
(commit "a8e46f319f574876ce697a7097eb47a2080b1a87")))
(sha256
(base32 "1jkyqwnc6x48bcjcyn1ha69vwql18ib1w47jx6bxz7wg7bvidm01"))))
(arguments (substitute-keyword-arguments (package-arguments base)
((#:phases original-phases)
#~(modify-phases #$original-phases
(add-after 'unpack 'add-config
(lambda _
(copy-file #$(local-file "config.h") "config.h")
(substitute* "config.h"
(("\"foot\"") (string-append "\"" #$foot "/bin/foot\""))
(("\"rofi\"") (string-append "\"" #$rofi-wayland "/bin/rofi\""))
(("\"mew\"") (string-append "\"" #$mew "/bin/mew\""))
(("\"mew-run\"") (string-append "\"" #$mew "/bin/mew-run\""))
(("\"dmenu-wl\"") (string-append "\"" #$dmenu-wl "/bin/dmenu-wl\""))
(("\"passmenu\"") (string-append "\"" #$password-store-wl "/bin/passmenu\""))
(("\"passmenu-totp\"") (string-append "\"" #$password-store-passmenus "/bin/passmenu-totp\""))
(("\"passmenu-multi\"") (string-append "\"" #$password-store-passmenus "/bin/passmenu-multi\""))
(("\"emacsclient\"") (string-append "\"" #$(emacs-for-wayland) "/bin/emacsclient\""))
(("%brightness%") #$brightness-script)
(("%printscreen%") #$printscreen-script)))))))))))
(define xdg-data-dirs-package
(package
(name "xdg-data-dirs")
(version "0")
(source #f)
(build-system trivial-build-system)
(arguments
(list
#:builder #~(mkdir #$output)))
(native-search-paths
(list (search-path-specification
(variable "XDG_DATA_DIRS")
(files '("share")))))
(description "Get XDG_DATA_DIRS search path")
(synopsis "Get XDG_DATA_DIRS search path")
(home-page #f)
(license #f)))
;; Packages I use when in the WM, it's dependent on those.
(define wm-packages
(concatenate-manifests
(list
(packages->manifest
(list
(emacs-for-wayland)
xdg-data-dirs-package))
(specifications->manifest
'("brillo"
"wlr-randr"
"dwlmsg"
;; TODO make a proper service,
;; replace in dwl with correct path to sequence detector
"sequence-detector"
"mpris-ctl"
"password-store-wl"
"pass-otp")))))
(define dwl-mine-gexp
(with-imported-modules '((guix build utils)
(guix build union))
#~(begin
(use-modules (guix build utils)
(guix build union))
(union-build #$output (list #$dwl-mine-unwrapped)
#:create-all-directories? #t)
(let ((target-file (string-append #$output "/bin/dwl"))
(wrapped-file (string-append #$output "/bin/.dwl-real"))
(wm-profile #$(profile (content wm-packages))))
(rename-file target-file wrapped-file)
(call-with-output-file target-file
(lambda (port)
(format port
"#!~a~%~a~%exec -a \"$0\" \"~a\" \"$@\"~%"
(string-append #$bash "/bin/bash")
(string-append "source " wm-profile "/etc/profile")
(canonicalize-path wrapped-file))))
(chmod target-file #o755)))))
(define-public dwl-mine
(package/inherit dwl-mine-unwrapped
(name "dwl-mine")
(source #f)
(build-system trivial-build-system)
(arguments
(list
#:builder dwl-mine-gexp))))