From a082af65ad53e4703b9540647aff9a716fdda86b Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Tue, 12 Sep 2023 21:16:20 +0200 Subject: Factor out common desktop services Most of the code for setting desktop layouts is common between machines. Also, make the blueman-applet service reusable. --- tw/home/cern.scm | 37 +++---- tw/home/files/polybar.ini | 239 ---------------------------------------------- tw/home/lap.scm | 48 ++++------ 3 files changed, 29 insertions(+), 295 deletions(-) delete mode 100644 tw/home/files/polybar.ini (limited to 'tw/home') diff --git a/tw/home/cern.scm b/tw/home/cern.scm index 8c6ed7d5..b03a1348 100644 --- a/tw/home/cern.scm +++ b/tw/home/cern.scm @@ -30,6 +30,7 @@ #:use-module (tw packages catppuccin) #:use-module (tw packages xorg) #:use-module (tw gexp) + #:use-module (tw services desktop) #:use-module (tw services git) #:use-module (tw services gnupg) #:use-module (tw theme)) @@ -104,30 +105,18 @@ (nighttime-brightness 0.7) (extra-content "fade=0"))) ; with fade=1, restarting redshift causes flickering for a few secs - (simple-service 'xorg-setup-services home-shepherd-service-type - (list - (polybar-service "DP-2") - (polybar-service "DP-1-8") - - (shepherd-service - (documentation "Set up X displays on login.") - (provision '(xorg-setup)) - (one-shot? #t) - (start #~(lambda _ - (system* #$(file-append numlockx "/bin/numlockx") "on") - ;; Turn off the monitors if there is no input for 10 minutes. - (system* #$(file-append xset "/bin/xset") "dpms" "600" "600" "600") - (system* #$(file-append xrandr "/bin/xrandr") - "--output" "DP-2" "--primary" "--auto") - (system* #$(file-append xrandr "/bin/xrandr") - ;; This can do 4K but HiDPI is a pain. - "--output" "DP-1-8" "--mode" "1920x1080" "--rate" "60.00" - "--left-of" "DP-2") - ;; Set the desktop background picture. Hopefully doing this just after - ;; xrandr works and sets it for both screens. - (system* #$(file-append hsetroot "/bin/hsetroot") "-cover" - (string-append (getenv "XDG_CONFIG_HOME") - "/X11/ridge-view.jpg"))))))) + (service home-desktop-layout-service-type + (home-desktop-layout-configuration + (desktop-background "~/.config/X11/ridge-view.jpg") + (monitors + (list (home-monitor-configuration + (name "DP-2") + (xrandr-options '("--primary" "--auto"))) + (home-monitor-configuration + (name "DP-1-8") + ;; This can do 4K but HiDPI is a pain. + (xrandr-options '("--mode" "1920x1080" "--rate" "60.00" + "--left-of" "DP-2"))))))) ;; On my work machine, Git must always use my work PGP key. (service home-git-service-type diff --git a/tw/home/files/polybar.ini b/tw/home/files/polybar.ini deleted file mode 100644 index 201c5131..00000000 --- a/tw/home/files/polybar.ini +++ /dev/null @@ -1,239 +0,0 @@ -; -*- mode: conf-windows; -*- - -[global/wm] -include-file = catppuccin.ini - -[colors] -background = ${colors.base} -background-alt = ${colors.surface0} -primary = ${colors.blue} -alert = ${colors.yellow} -disabled = ${colors.overlay2} -empty-bar = ${colors.surface2} - -[settings] -screenchange-reload = true - -[bar/primary] -monitor = ${env:POLYBAR_MONITOR} -width = 100% -height = 24pt -radius = 0 -line-size = 3pt -line-color = ${colors.primary} -border-size = 0 -padding-left = 0 -padding-right = 2 -module-margin = 2 - -background = ${colors.background} -foreground = ${colors.text} - -; font-N = ; -font-0 = Fira Sans:size=11;2 -; Some workspace names have emojis in them. -; Using Noto Emoji means emojis would be much too big and colourful. -font-1 = OpenMoji:style=Black:size=11;3 -; Hermit is needed for Unicode block chars. -font-2 = Hermit:size=10;1 - -separator = ยท -separator-foreground = ${colors.disabled} - -modules-left = i3 xwindow -modules-right = wlan eth memory cpu temp xkeyboard pulseaudio dunst battery date -tray-position = right - -enable-ipc = true - -cursor-click = pointer -cursor-scroll = ns-resize - -[module/i3] -type = internal/i3 -pin-workspaces = false -show-urgent = true -strip-wsnumbers = true -index-sort = true -label-mode-foreground = ${colors.alert} -label-mode-background = ${colors.background-alt} -label-mode-padding = 2 -label-focused-overline = ${colors.primary} -label-focused-padding = 1 -label-urgent-foreground = ${colors.alert} -label-urgent-background = ${colors.background-alt} -label-urgent-padding = 1 -label-unfocused-padding = 1 -label-visible-padding = 1 - -[module/xwindow] -type = internal/xwindow -label = %title% -label-maxlen = 120 - -[module/pulseaudio] -type = internal/pulseaudio -format-volume = -label-volume = %percentage%% -label-muted = ๐Ÿ”‡ -label-muted-foreground = ${colors.disabled} - -ramp-volume-0 = ๐Ÿ”ˆ -ramp-volume-1 = ๐Ÿ”‰ -ramp-volume-2 = ๐Ÿ”Š -ramp-volume-0-foreground = ${colors.primary} -ramp-volume-1-foreground = ${colors.primary} -ramp-volume-2-foreground = ${colors.primary} - -[module/xkeyboard] -type = internal/xkeyboard -blacklist-0 = num lock -; hide xkeyboard module unless Caps Lock is pressed -label-layout = -label-indicator-padding = 1 -label-indicator-margin = 0 -label-indicator-foreground = ${colors.alert} -label-indicator-background = ${colors.background-alt} - -[module/memory] -type = internal/memory -interval = 1 -format =