(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))))