summaryrefslogtreecommitdiff
path: root/tw/home
diff options
context:
space:
mode:
authorTimo Wilken2023-09-12 21:16:20 +0200
committerTimo Wilken2023-09-12 21:20:19 +0200
commita082af65ad53e4703b9540647aff9a716fdda86b (patch)
tree4d18f2d547878caa4aec18e80fc7653a984338c7 /tw/home
parentd44b9efda2d387430e63c1d6cd426c88bcde2eda (diff)
Factor out common desktop services
Most of the code for setting desktop layouts is common between machines. Also, make the blueman-applet service reusable.
Diffstat (limited to 'tw/home')
-rw-r--r--tw/home/cern.scm37
-rw-r--r--tw/home/files/polybar.ini239
-rw-r--r--tw/home/lap.scm48
3 files changed, 29 insertions, 295 deletions
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 = <fontconfig pattern>;<vertical offset>
-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 = <ramp-volume> <label-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 = <label> <ramp-used>
-format-prefix = "RAM "
-format-prefix-foreground = ${colors.primary}
-format-warn-prefix = "RAM "
-format-warn-prefix-foreground = ${colors.primary}
-label = %used%
-label-warn = %free% left
-label-warn-foreground = ${colors.alert}
-label-warn-background = ${colors.background-alt}
-
-ramp-used-0 = โ–
-ramp-used-1 = โ–‚
-ramp-used-2 = โ–ƒ
-ramp-used-3 = โ–„
-ramp-used-4 = โ–…
-ramp-used-5 = โ–†
-ramp-used-6 = โ–‡
-ramp-used-7 = โ–ˆ
-ramp-used-0-foreground = ${colors.empty-bar}
-ramp-used-1-foreground = ${colors.primary}
-ramp-used-2-foreground = ${colors.primary}
-ramp-used-3-foreground = ${colors.primary}
-ramp-used-4-foreground = ${colors.primary}
-ramp-used-5-foreground = ${colors.alert}
-ramp-used-6-foreground = ${colors.alert}
-ramp-used-7-foreground = ${colors.alert}
-
-[module/cpu]
-type = internal/cpu
-interval = 1
-format = <ramp-coreload>
-format-prefix = "CPU "
-format-prefix-foreground = ${colors.primary}
-
-; Spacing (number of spaces, pixels, points) between individual per-core ramps
-ramp-coreload-spacing = 1
-ramp-coreload-0 = โ–
-ramp-coreload-1 = โ–‚
-ramp-coreload-2 = โ–ƒ
-ramp-coreload-3 = โ–„
-ramp-coreload-4 = โ–…
-ramp-coreload-5 = โ–†
-ramp-coreload-6 = โ–‡
-ramp-coreload-7 = โ–ˆ
-ramp-coreload-0-foreground = ${colors.empty-bar}
-ramp-coreload-1-foreground = ${colors.primary}
-ramp-coreload-2-foreground = ${colors.primary}
-ramp-coreload-3-foreground = ${colors.primary}
-ramp-coreload-4-foreground = ${colors.primary}
-ramp-coreload-5-foreground = ${colors.primary}
-ramp-coreload-6-foreground = ${colors.alert}
-ramp-coreload-7-foreground = ${colors.alert}
-
-[module/temp]
-type = internal/temperature
-; head /sys/class/thermal/thermal_zone*/type
-thermal-zone = 1
-format-prefix = "๐ŸŒก "
-format-prefix-foreground = ${colors.primary}
-format-warn-prefix = "๐ŸŒก "
-format-warn-prefix-foreground = ${colors.primary}
-label-warn-foreground = ${colors.alert}
-label-warn-background = ${colors.background-alt}
-
-[network-base]
-type = internal/network
-interval = 5
-format-connected = <label-connected>
-format-packetloss = <animation-packetloss> <label-connected>
-; Hide completely if disconnected.
-format-disconnected =
-
-animation-packetloss-0 = โš 
-animation-packetloss-0-foreground = ${colors.alert}
-animation-packetloss-0-background = ${colors.background-alt}
-animation-packetloss-1 = ๐Ÿ“ถ
-animation-packetloss-1-foreground = ${colors.alert}
-animation-packetloss-1-background = ${colors.background-alt}
-; Framerate in milliseconds
-animation-packetloss-framerate = 500
-; Don't display "B/s" suffix, only e.g. "5 K" for compactness.
-speed-unit =
-
-[module/wlan]
-inherit = network-base
-interface-type = wireless
-format-connected = <ramp-signal> <label-connected>
-label-connected = %essid% โ†“ %downspeed% โ†‘ %upspeed%
-; label-connected-foreground = ${colors.green}
-
-ramp-signal-0 = ๐Ÿ“ถ
-ramp-signal-1 = ๐Ÿ“ถ
-ramp-signal-2 = ๐Ÿ“ถ
-ramp-signal-0-foreground = ${colors.red}
-ramp-signal-1-foreground = ${colors.green}
-ramp-signal-2-foreground = ${colors.green}
-
-[module/eth]
-inherit = network-base
-interface-type = wired
-label-connected = โ†“ %downspeed% โ†‘ %upspeed%
-format-connected-prefix = "๐ŸŒ "
-format-connected-prefix-foreground = ${colors.green}
-
-[module/battery]
-type = internal/battery
-low-at = 25
-time-format = %-Hh%Mm
-format-discharging = <ramp-capacity> <label-discharging>
-label-discharging = %percentage%% %time% %consumption%W
-format-charging = <label-charging>
-format-charging-prefix = "๐Ÿ”Œ "
-format-charging-prefix-foreground = ${colors.green}
-label-charging = %percentage%% %time%
-format-full =
-
-ramp-capacity-0 = ๐Ÿ”‹
-ramp-capacity-1 = ๐Ÿ”‹
-ramp-capacity-2 = ๐Ÿ”‹
-ramp-capacity-0-foreground = ${colors.red}
-ramp-capacity-1-foreground = ${colors.yellow}
-ramp-capacity-2-foreground = ${colors.green}
-
-[module/date]
-type = internal/date
-interval = 1
-date = %a %e %b
-time = %H:%M
-date-alt = %Y-%m-%d
-time-alt = %H:%M:%S
-label = %date%, %time%
-
-[module/dunst]
-type = custom/script
-; Only show a "slience" emoji when notifications are paused; nothing otherwise.
-exec = "case $(dunstctl is-paused) in false) echo;; true) echo '๐Ÿ”•';; esac"
-format = <label>
-format-foreground = ${colors.alert}
-format-background = ${colors.background-alt}
diff --git a/tw/home/lap.scm b/tw/home/lap.scm
index ae5fb629..b00b8c20 100644
--- a/tw/home/lap.scm
+++ b/tw/home/lap.scm
@@ -38,6 +38,7 @@
#:use-module ((nongnu packages steam-client)
#:select (steam))
#:use-module (tw home)
+ #:use-module (tw services desktop)
#:use-module (tw services git)
#:use-module (tw services gnupg)
#:use-module (tw packages scanner)
@@ -169,38 +170,21 @@
(nighttime-brightness 0.7)
(extra-content "fade=0"))) ; with fade=1, restarting redshift causes flickering for a few secs
- (simple-service 'laptop-gui-services home-shepherd-service-type
- (list
- (shepherd-service
- (documentation "Blueman applet; provides a GUI for connection to bluetooth devices.")
- (provision '(blueman-applet))
- (start #~(make-forkexec-constructor
- (list #$(file-append blueman "/bin/blueman-applet"))))
- (stop #~(make-kill-destructor)))
-
- (polybar-service "eDP-1")
- (polybar-service "HDMI-1-1")
-
- (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" "eDP-1" "--auto"
- ;; Don't use --auto for this monitor. That
- ;; configures it at 60 Hz, which causes
- ;; it to briefly turn off every few minutes.
- "--output" "HDMI-1-1" "--mode" "2560x1440" "--rate" "120.00"
- "--right-of" "eDP-1")
- ;; 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 "HOME")
- "/pictures/Backgrounds/greece/IMG_20181201_104748_DRO.jpg")))))))
+ (service home-blueman-service-type)
+
+ (service home-desktop-layout-service-type
+ (home-desktop-layout-configuration
+ (desktop-background "~/pictures/Backgrounds/greece/IMG_20181201_104748_DRO.jpg")
+ (monitors
+ (list (home-monitor-configuration
+ (name "eDP-1")
+ (xrandr-options '("--auto")))
+ (home-monitor-configuration
+ (name "HDMI-1-1")
+ ;; Don't use --auto for this monitor. That configures it at 60
+ ;; Hz, which causes it to briefly turn off every few minutes.
+ (xrandr-options '("--mode" "2560x1440" "--rate" "120.00"
+ "--right-of" "eDP-1")))))))
;; On my private machine, I want to use my private PGP key normally, and
;; my work key only for work repositories.