~ruther/guix-config

9ecf8144589f978ae5df50e4afcce05d45c9c427 — Rutherther 6 months ago e584929
feat: support printscreen and brightness scripts in dwl
M home/home-configuration.scm => home/home-configuration.scm +0 -2
@@ 132,8 132,6 @@
                    ;; TODO the services should be started by shepherd
                    (".start-dwl" ,(start-dwl #:dwl dwl-mine #:waybar waybar-mine))

                    (".config/dwl/scripts/print.sh" ,(local-file "dotfiles/dwl/print.sh"))

                    (".config/gammastep/config.ini" ,(local-file "dotfiles/gammastep.ini"))

                    (".config/zsh/direnv/direnv" ,direnv)

M home/modules/ruther/home/dwl/config.h => home/modules/ruther/home/dwl/config.h +5 -4
@@ 227,11 227,12 @@ static const Key keys[] = {
	{ 0,                         Key_XF86AudioPlay2,         spawn, SHCMD(SEQUENCE_DETECTOR "-g mpris play") },
	{ 0,                         Key_XF86AudioNext,         spawn, SHCMD(SEQUENCE_DETECTOR "-g mpris next") },
	{ 0,                         Key_XF86AudioPrev,         spawn, SHCMD(SEQUENCE_DETECTOR "-g mpris prev") },
	{ 0,                         Key_XF86MonBrightnessUp,   spawn, SHCMD("$HOME/.config/dwl/scripts/brightness.sh up") },
	{ 0,                         Key_XF86MonBrightnessDown, spawn, SHCMD("$HOME/.config/dwl/scripts/brightness.sh down") },
	{ 0,                         Key_Print,                 spawn, SHCMD("$HOME/.config/dwl/scripts/print.sh -s") },
	{ 0,                         Key_XF86MonBrightnessUp,   spawn, SHCMD("%brightness% up") },
	{ 0,                         Key_XF86MonBrightnessDown, spawn, SHCMD("%brightness% down") },
	{ 0,                         Key_Print,                 spawn, SHCMD("%printscreen% -s") },

	{ MODKEY,                    Key_y,          spawn,      SHCMD("emacs-anywhere") },
	/* { MODKEY,                    Key_y,          spawn,      SHCMD("emacs-anywhere") }, */
  // todo better passmenu with totp etc.
	{ MODKEY,                    Key_p,          spawn,      SHCMD("passmenu") },

	{ MODKEY,                    Key_c,          togglesticky,   {0} },

A home/modules/ruther/home/dwl/scripts/brightness.sh => home/modules/ruther/home/dwl/scripts/brightness.sh +17 -0
@@ 0,0 1,17 @@
#!/usr/bin/env sh

function send_notification() {
    brightness=$(printf "%.0f\n" $(brillo -G))
    dunstify -a "brightness" -u low -r 9991 -h int:value:"$brightness" -i "brightness-$1" "Brightness: $brightness %"
}

case $1 in
    up)
        brillo -A 2 -q
        ;;
    down)
        brillo -U 2 -q
        ;;
esac

send_notification $1

M home/modules/ruther/home/dwl/scripts/print.sh => home/modules/ruther/home/dwl/scripts/print.sh +1 -1
@@ 1,4 1,4 @@
#!/usr/bin/env -S guix shell slurp grim wl-clipboard -- bash
#!/usr/bin/env bash

out="$HOME/screens/$(date +%Y/%Y%m%d_%H%M%S).png"


M home/modules/ruther/home/dwl/wm.scm => home/modules/ruther/home/dwl/wm.scm +45 -1
@@ 6,6 6,8 @@
  #: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 (ruther packages wayland)
  #:use-module (ruther home passwords)


@@ 43,6 45,46 @@
                              "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))

        (invoke #$(file-append bash "/bin/sh")
                #$(local-file "scripts/brightness.sh")))))

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

        (invoke #$(file-append bash "/bin/bash")
                #$(local-file "scripts/print.sh")))))

(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


@@ 66,7 108,9 @@
                              (("\"foot\"") (string-append "\"" #$foot "/bin/foot\""))
                              (("\"rofi\"") (string-append "\"" #$rofi-wayland "/bin/rofi\""))
                              (("\"passmenu\"") (string-append "\"" #$password-store-wl "/bin/passmenu\""))
                              (("\"emacsclient\"") (string-append "\"" #$emacs-pgtk "/bin/emacsclient\""))))))))))))
                              (("\"emacsclient\"") (string-append "\"" #$emacs-pgtk "/bin/emacsclient\""))
                              (("%brightness%") #$brightness-script)
                              (("%printscreen%") #$printscreen-script)))))))))))

;; Packages I use when in the WM, it's dependent on those.
(define wm-packages

Do not follow this link