From cabf188ae487120d4b9ac1fe21fff45403a787b4 Mon Sep 17 00:00:00 2001 From: Ryan Schanzenbacher Date: Mon, 24 Aug 2026 01:09:49 -0400 Subject: various fixes to guix --- flake.lock | 6 +- flake.nix | 2 + users/ryan/common.nix | 16 ++++- users/ryan/darwin.nix | 3 - users/ryan/linux.nix | 65 ++++++++--------- users/ryan/linux/foreign.nix | 25 +++++++ users/ryan/linux/guix.nix | 73 +++++++++++++++++++ users/ryan/linux/hypr/hyprland.conf | 56 +++++++-------- users/ryan/linux/hypr/scripts/autostart.sh | 2 - users/ryan/linux/waybar/config | 112 ++++++++++++++++++++--------- users/ryan/linux/waybar/modules/storage.sh | 77 +++++++++++++++----- users/ryan/linux/waybar/style.css | 2 +- users/ryan/linux/wpaperd/config.toml | 2 +- 13 files changed, 318 insertions(+), 123 deletions(-) create mode 100644 users/ryan/linux/foreign.nix create mode 100644 users/ryan/linux/guix.nix diff --git a/flake.lock b/flake.lock index 1a14c7f..4ff553b 100644 --- a/flake.lock +++ b/flake.lock @@ -293,11 +293,11 @@ ] }, "locked": { - "lastModified": 1785569296, - "narHash": "sha256-ux2+60xcjl4LloKPevqrkP+uY4DNZXhzVd+TYrfE2+w=", + "lastModified": 1785784141, + "narHash": "sha256-VG4SKltdvSWd6Y2ppsDdSZC8m3x9xtFevh5wndYqo08=", "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "945e834a12a97a5e3b08869960e35c7ccfde6f69", + "rev": "073be825a844ac51ece75ebfe9d82b5e2ee89a5c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 1fb7bff..3f110c1 100644 --- a/flake.nix +++ b/flake.nix @@ -88,6 +88,8 @@ inputs.zen-browser.homeModules.beta ./users/ryan/common.nix ./users/ryan/linux.nix + ./users/ryan/linux/foreign.nix + ./users/ryan/linux/guix.nix ]; }; }; diff --git a/users/ryan/common.nix b/users/ryan/common.nix index 58346e7..610a975 100644 --- a/users/ryan/common.nix +++ b/users/ryan/common.nix @@ -5,6 +5,9 @@ news.display = "silent"; + # Keep everything in lockstep + home.stateVersion = "26.05"; + # My own modules ryan.neovim.enable = true; @@ -143,6 +146,12 @@ then "sudo darwin-rebuild switch --flake ~/.config/nix/." else "home-manager switch --flake ~/.config/home-manager/#ryan"; }; + plugins = [ + { + name = "zsh-vi-mode"; + src = "${pkgs.zsh-vi-mode}/share/zsh-vi-mode"; + } + ]; }; # Shared across darwin and linux; the guix side already deferred these @@ -159,7 +168,7 @@ jq htop (pkgs.zathura.override { - plugins = [ pkgs.zathuraPkgs.zathura-pdf-mupdf ]; + plugins = [ pkgs.zathuraPkgs.zathura_pdf_mupdf ]; }) go pass @@ -177,6 +186,11 @@ kdePackages.kdenlive audacity blender + + nerd-fonts.anonymice + nerd-fonts.monofur + nerd-fonts.lilex + nerd-fonts.fira-code ]; xdg.configFile."aerc" = { diff --git a/users/ryan/darwin.nix b/users/ryan/darwin.nix index e721347..568306a 100644 --- a/users/ryan/darwin.nix +++ b/users/ryan/darwin.nix @@ -8,8 +8,6 @@ ./modules/ubersicht ]; - home.stateVersion = "26.05"; # Please read the comment before changing. - ryan.sketchybar.enable = true; programs.zen-browser = { @@ -30,7 +28,6 @@ home.packages = with pkgs; [ iina # Media player (frontend to mpv essentially) - nerd-fonts.anonymice jujutsu netbird-tui ]; diff --git a/users/ryan/linux.nix b/users/ryan/linux.nix index 5e6d767..3935de5 100644 --- a/users/ryan/linux.nix +++ b/users/ryan/linux.nix @@ -6,31 +6,36 @@ home.username = "ryan"; home.homeDirectory = "/home/ryan"; - home.stateVersion = "23.11"; # Please read the comment before changing. nixpkgs.config.allowUnfree = true; - xdg.configFile."nix/nix.conf".text = "experimental-features = nix-command flakes\n"; - xdg.configFile."nix/registry.json".text = builtins.toJSON { - version = 2; - flakes = [ - { - from = { type = "indirect"; id = "nixpkgs"; }; - to = { - type = "path"; - path = inputs.nixpkgs.outPath; - lastModified = inputs.nixpkgs.lastModified; - narHash = inputs.nixpkgs.narHash; - }; - } - ]; - }; - fonts.fontconfig.enable = true; fonts.fontconfig.defaultFonts = { monospace = [ "DejaVu Sans Mono" ]; - sansSerif = [ "DejaVu Sans" ]; - serif = [ "DejaVu Serif" ]; + sansSerif = [ "Noto Sans" "DejaVu Sans" ]; + serif = [ "Noto Serif" "DejaVu Serif" ]; + }; + + gtk = { + enable = true; + font = { + name = "Noto Sans"; + size = 10; + }; + theme = { + name = "Adwaita"; + package = pkgs.gnome-themes-extra; + }; + iconTheme = { + name = "Adwaita"; + package = pkgs.adwaita-icon-theme; + }; + colorScheme = "dark"; + }; + + qt = { + enable = true; + platformTheme.name = "gtk3"; }; home.pointerCursor = { @@ -47,6 +52,7 @@ wayland.windowManager.hyprland = { enable = true; package = pkgs.hyprland; + configType = "hyprlang"; portalPackage = pkgs.xdg-desktop-portal-hyprland; extraConfig = builtins.readFile ./linux/hypr/hyprland.conf; }; @@ -60,6 +66,7 @@ "hypr/scripts" = { source = ./linux/hypr/scripts; recursive = true; }; "hypr/family_guy.mp4".source = ./linux/hypr/family_guy.mp4; "hypr/subwaysurfer.webm".source = ./linux/hypr/subwaysurfer.webm; + "wallpapers".source = ../../files/Wallpapers; "waybar" = { source = ./linux/waybar; recursive = true; }; "alacritty" = { source = ./linux/alacritty; recursive = true; }; @@ -103,26 +110,16 @@ waybar fuzzel - nerd-fonts.anonymice - nerd-fonts.monofur - nerd-fonts.lilex - nerd-fonts.fira-code noto-fonts dejavu_fonts liberation_ttf noto-fonts-cjk-sans noto-fonts-color-emoji - # hyprlock built by nix needs Guix's PAM/fontconfig libs preloaded to run - # under the Guix system profile - same interop hack as before. - (pkgs.writeScriptBin "hyprlock" '' - #! ${pkgs.bash}/bin/bash - export LD_PRELOAD="/run/current-system/profile/lib/libpam.so.0:/run/current-system/profile/lib/libfontconfig.so:$LD_PRELOAD" - exec ${pkgs.hyprlock}/bin/hyprlock "$@" - '') - - # Guix's mesa doesn't match nixpkgs', so GL apps built by nix need nixGL. - inputs.nixgl.packages.${pkgs.system}.nixGLIntel - inputs.clipboard-sync.packages.${pkgs.system}.default + inputs.clipboard-sync.packages.${pkgs.stdenv.hostPlatform.system}.default + + # hyprlock itself is provided by the host-specific module (e.g. + # linux/guix.nix wraps it with an LD_PRELOAD shim; a plain NixOS host + # would just add pkgs.hyprlock here instead). ]; } diff --git a/users/ryan/linux/foreign.nix b/users/ryan/linux/foreign.nix new file mode 100644 index 0000000..b1b06ab --- /dev/null +++ b/users/ryan/linux/foreign.nix @@ -0,0 +1,25 @@ +{ inputs, ... }: + +# Applies to any standalone (non-NixOS) home-manager install, where +# home-manager owns the user profile on its own instead of being wired in +# via a NixOS module. NixOS manages nix.conf/the flake registry and doesn't +# need the genericLinux target at all, so this is skipped on NixOS hosts. +{ + targets.genericLinux.enable = true; + + xdg.configFile."nix/nix.conf".text = "experimental-features = nix-command flakes\n"; + xdg.configFile."nix/registry.json".text = builtins.toJSON { + version = 2; + flakes = [ + { + from = { type = "indirect"; id = "nixpkgs"; }; + to = { + type = "path"; + path = inputs.nixpkgs.outPath; + lastModified = inputs.nixpkgs.lastModified; + narHash = inputs.nixpkgs.narHash; + }; + } + ]; + }; +} diff --git a/users/ryan/linux/guix.nix b/users/ryan/linux/guix.nix new file mode 100644 index 0000000..acee0f3 --- /dev/null +++ b/users/ryan/linux/guix.nix @@ -0,0 +1,73 @@ +{ pkgs, inputs, ... }: + +# Workarounds specific to running home-manager on top of Guix System (as +# opposed to NixOS, or some other foreign distro). Keep this narrow - +# anything that would also apply to e.g. WSL belongs in ./foreign.nix +# instead. +{ + # Guix doesn't run a systemd user session the way home-manager expects, + # so activation shouldn't try to start/restart systemd user units. + systemd.user.startServices = false; + + # Guix Home's login shell (bash, via /etc/passwd) sources ~/.bash_profile + # -> ~/.profile, which runs ~/.guix-home/setup-environment and + # ~/.guix-home/on-first-login. The latter is what actually starts this + # user's shepherd instance (which manages pipewire/pulseaudio and other + # home services) if it isn't running yet. zsh has no equivalent of + # ~/.profile, so with zsh as the login shell that chain never runs and + # shepherd (and anything it starts, e.g. audio) never comes up. Replicate + # it in .zprofile, which - like .bash_profile - only runs for login shells. + programs.zsh.profileExtra = '' + if [ -f "$HOME/.guix-home/setup-environment" ]; then + HOME_ENVIRONMENT="$HOME/.guix-home" + . "$HOME_ENVIRONMENT/setup-environment" + "$HOME_ENVIRONMENT/on-first-login" + unset HOME_ENVIRONMENT + fi + ''; + + # gtk3.nix (see ../linux.nix's gtk.* config) mirrors GTK settings into + # dconf, which needs a session D-Bus during activation. This host has no + # /etc/dbus-1/session.conf and no session bus running at switch time, so + # dconf's dbus-run-session activation step fails. GTK is still themed via + # gtk-3.0/gtk-4.0 settings.ini; dconf mainly matters for GNOME/libadwaita + # apps, which aren't in play here. + dconf.enable = false; + + # Guix Home used to run gpg-agent as a shepherd service and export + # SSH_AUTH_SOCK into the whole session before Hyprland started. That + # service is disabled now, and zsh's SSH_AUTH_SOCK export (see + # programs.zsh in common.nix) only reaches shells, not apps Hyprland + # spawns directly - so launch the agent and push the socket path into + # Hyprland's own env here instead. A NixOS host would have a real + # systemd --user session doing this via gpg-agent.socket activation, + # so this only belongs on Guix. + wayland.windowManager.hyprland.extraConfig = '' + exec-once = sh -c 'gpgconf --launch gpg-agent; hyprctl setenv SSH_AUTH_SOCK "$(gpgconf --list-dirs agent-ssh-socket)"' + ''; + + # base-system.scm enables pcscd-service-type, so pcscd already owns the + # Yubikey's USB CCID interface. scdaemon's internal libusb CCID driver + # then fails to open the device (`ccid open error: skip`) and doesn't + # fall back to PC/SC on its own, so `gpg --card-status`/`--edit-card` + # report "No such device". Force scdaemon through pcscd instead. A NixOS + # host would only need this if it also runs services.pcscd itself. + programs.gpg.scdaemonSettings.disable-ccid = true; + + home.packages = [ + # hyprlock built by nix needs Guix's PAM libs preloaded to authenticate + # against Guix's PAM stack. Don't also preload Guix's libfontconfig.so + # here: it's a "fontconfig-minimal" build that lacks symbols (e.g. + # FcConfigSetDefaultSubstitute) which nix's pango expects, causing a + # symbol lookup error at startup. Let hyprlock use nix's own fontconfig + # from its normal closure instead. + (pkgs.writeScriptBin "hyprlock" '' + #! ${pkgs.bash}/bin/bash + export LD_PRELOAD="/run/current-system/profile/lib/libpam.so.0:$LD_PRELOAD" + exec ${pkgs.hyprlock}/bin/hyprlock "$@" + '') + + # Guix's mesa doesn't match nixpkgs', so GL apps built by nix need nixGL. + inputs.nixgl.packages.${pkgs.stdenv.hostPlatform.system}.nixGLIntel + ]; +} diff --git a/users/ryan/linux/hypr/hyprland.conf b/users/ryan/linux/hypr/hyprland.conf index e51b54c..42d8a52 100644 --- a/users/ryan/linux/hypr/hyprland.conf +++ b/users/ryan/linux/hypr/hyprland.conf @@ -113,7 +113,7 @@ animations { dwindle { # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more - pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + #pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below preserve_split = yes # you probably want this } @@ -130,9 +130,9 @@ device { } # Example windowrule v1 -# windowrule = float, ^(kitty)$ +# windowrule = float on, ^(kitty)$ # Example windowrule v2 -# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ +# windowrulev2 = float on,match:class ^(kitty)$,match:title ^(kitty)$ # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more @@ -147,8 +147,8 @@ bind = $mainMod SHIFT, E, exit bind = $mainMod SHIFT, Space, togglefloating bind = $mainMod SHIFT, Return, pin, active bind = $mainMod, D, exec, fuzzel --width=35 --font='Hack:weight=bold:size=12' --background-color='282a36fa' --selection-color='3d4460fa' --line-height=20 --border-radius=20 -bind = $mainMod, P, pseudo, # dwindle -bind = $mainMod, J, togglesplit, # dwindle +#bind = $mainMod, P, pseudo, # dwindle +#bind = $mainMod, J, togglesplit, # dwindle bind = $mainMod, F, fullscreen, 1 bind = $mainMod SHIFT, F, fullscreen bind = ,XF86MonBrightnessUp, exec, light -A 10 @@ -252,46 +252,46 @@ bind = $mainMod SHIFT CTRL ALT, L, exec, xdg-open https://linkedin.com # Window Rules # Firefox PiP -windowrulev2 = float, class:^(zen-beta)$, title:^(Picture-in-Picture)$ -windowrulev2 = pin, class:^(zen-beta)$, title:^(Picture-in-Picture)$ -windowrulev2 = size 22% 22%, class:^(zen-beta)$, title:^(Picture-in-Picture)$ -windowrulev2 = move 76% 8%, class:^(zen-beta)$, title:^(Picture-in-Picture)$ +windowrule = float on, match:class ^(zen-beta)$, match:title ^(Picture-in-Picture)$ +windowrule = pin on, match:class ^(zen-beta)$, match:title ^(Picture-in-Picture)$ +windowrule = size 22% 22%, match:class ^(zen-beta)$, match:title ^(Picture-in-Picture)$ +windowrule = move 76% 8%, match:class ^(zen-beta)$, match:title ^(Picture-in-Picture)$ # Firefox Sharing Indicator -windowrulev2 = float, class:^(firefox)$, title:^(Firefox — Sharing Indicator)$ -windowrulev2 = size 56 31, class:^(firefox)$, title:^(Firefox — Sharing Indicator)$ -windowrulev2 = move 50% 0, class:^(firefox)$, title:^(Firefox — Sharing Indicator)$ -windowrulev2 = suppressevent fullscreen maximize, class:^(firefox)$, title:^(Firefox — Sharing Indicator)$ +windowrule = float on, match:class ^(firefox)$, match:title ^(Firefox — Sharing Indicator)$ +windowrule = size 56 31, match:class ^(firefox)$, match:title ^(Firefox — Sharing Indicator)$ +windowrule = move 50% 0, match:class ^(firefox)$, match:title ^(Firefox — Sharing Indicator)$ +windowrule = suppress_event = fullscreen maximize, match:class ^(firefox)$, match:title ^(Firefox — Sharing Indicator)$ # Weather -windowrulev2 = float,class:^(ala-wttr)$ -windowrulev2 = size 822 1026, class:^(ala-wttr)$ +windowrule = float on,match:class ^(ala-wttr)$ +windowrule = size 822 1026, match:class ^(ala-wttr)$ # Floating terminal -windowrulev2 = float,class:^(float-foot)$ -windowrulev2 = size 930 680,class:^(float-foot)$ -windowrulev2 = center,class:^(float-foot)$ +windowrule = float on,match:class ^(float-foot)$ +windowrule = size 930 680,match:class ^(float-foot)$ +windowrule = center on,match:class ^(float-foot)$ # Change color of pinned windows -windowrulev2 = bordercolor rgba(bf0000ee) rgba(ab00adee) 45deg,pinned:1 +windowrule = border_color rgba(bf0000ee) rgba(ab00adee) 45deg,match:pin 1 # Fun Keybinds # Subway surfer bind = $mainMod CTRL SHIFT, S, exec, mpv ~/.config/hypr/subwaysurfer.webm -windowrulev2 = float,class:^(mpv)$, title:^(subwaysurfer.webm - mpv)$ -windowrulev2 = size 310 554,class:^(mpv)$, title:^(subwaysurfer.webm - mpv)$ -windowrulev2 = move 81% 46% ,class:^(mpv)$, title:^(subwaysurfer.webm - mpv)$ -windowrulev2 = pin,class:^(mpv)$, title:^(subwaysurfer.webm - mpv)$ +windowrule = float on,match:class ^(mpv)$, match:title ^(subwaysurfer.webm - mpv)$ +windowrule = size 310 554,match:class ^(mpv)$, match:title ^(subwaysurfer.webm - mpv)$ +windowrule = move 81% 46% ,match:class ^(mpv)$, match:title ^(subwaysurfer.webm - mpv)$ +windowrule = pin on,match:class ^(mpv)$, match:title ^(subwaysurfer.webm - mpv)$ # Family guy funny moments bind = $mainMod CTRL SHIFT, F, exec, mpv ~/.config/hypr/family_guy.mp4 -windowrulev2 = float,class:^(mpv)$, title:^(family_guy.mp4 - mpv)$ -windowrulev2 = size 595 336,class:^(mpv)$, title:^(family_guy.mp4 - mpv)$ -windowrulev2 = move 67% 5% ,class:^(mpv)$, title:^(family_guy.mp4 - mpv)$ -windowrulev2 = pin,class:^(mpv)$, title:^(family_guy.mp4 - mpv)$ +windowrule = float on,match:class ^(mpv)$, match:title ^(family_guy.mp4 - mpv)$ +windowrule = size 595 336,match:class ^(mpv)$, match:title ^(family_guy.mp4 - mpv)$ +windowrule = move 67% 5% ,match:class ^(mpv)$, match:title ^(family_guy.mp4 - mpv)$ +windowrule = pin on,match:class ^(mpv)$, match:title ^(family_guy.mp4 - mpv)$ # Satty windowrules -windowrulev2 = fullscreen,class:^(com.gabm.satty)$ +windowrule = fullscreen on,match:class ^(com.gabm.satty)$ exec-once = ~/.config/hypr/scripts/autostart.sh diff --git a/users/ryan/linux/hypr/scripts/autostart.sh b/users/ryan/linux/hypr/scripts/autostart.sh index 706f82f..080f6e9 100755 --- a/users/ryan/linux/hypr/scripts/autostart.sh +++ b/users/ryan/linux/hypr/scripts/autostart.sh @@ -6,8 +6,6 @@ mako & #swaybg -i ~/.config/hypr/Wallpapers/above-clouds.jpg & -nice -n13 swww init & - #~/.config/hypr/wallpaper-daemon.sh & wpaperd -d & diff --git a/users/ryan/linux/waybar/config b/users/ryan/linux/waybar/config index 62e6b20..4459ce7 100644 --- a/users/ryan/linux/waybar/config +++ b/users/ryan/linux/waybar/config @@ -5,50 +5,69 @@ "modules-left": ["hyprland/workspaces", "hyprland/submap"], "modules-center": ["hyprland/window"], - "modules-right": ["tray", "custom/spotify", "privacy", "custom/weather", "custom/mail", "custom/storage", "backlight", "bluetooth", "pulseaudio", "network", "idle_inhibitor", "battery", "battery#num2", "clock"], + "modules-right": ["tray", "privacy", "custom/weather", "custom/mail", "custom/storage", "backlight", "bluetooth", "pulseaudio", "network", "idle_inhibitor", "battery", "battery#num2", "clock"], + "hyprland/submap": { "format": " {}" }, + "hyprland/workspaces": { "format": "{id}", "all-outputs": false, "disable-scroll": true }, + "hyprland/window": { "max-length": 80, "tooltip": false, "separate-outputs": true }, + "clock": { "format": "{:%a %d %b %H:%M}", "tooltip": false }, + "battery": { "format": "{capacity}% {icon}", "format-alt": "{time} {icon}", - "format-icons": ["", "", "", "", ""], - "format-charging": "{capacity}% ", + "format-icons": [ + "󰁺", + "󰁻", + "󰁼", + "󰁽", + "󰁹" + ], + "format-charging": "{capacity}% 󰂄", "interval": 30, "states": { "warning": 25, "critical": 10 }, "tooltip": false, - "bat":"BAT0" + "bat": "BAT0" }, + "battery#num2": { "format": "{capacity}% {icon}", "format-alt": "{time} {icon}", - "format-icons": ["", "", "", "", ""], - "format-charging": "{capacity}% ", + "format-icons": [ + "󰁺", + "󰁻", + "󰁼", + "󰁽", + "󰁹" + ], + "format-charging": "{capacity}% 󰂄", "interval": 30, "states": { "warning": 25, "critical": 10 }, "tooltip": false, - "bat":"BAT1" + "bat": "BAT1" }, + "bluetooth": { "format": "󰂯", "format-disabled": "󰂲", @@ -56,60 +75,75 @@ "format-connected-battery": "󰂱 {device_battery_percentage}%", "on-click": "foot bluetui", "tooltip-format": "{controller_alias}\t{controller_address}\n\n{num_connections} connected", - "tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}", - "tooltip-format-enumerate-connected": "{device_alias}\t{device_address}", - "tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t{device_battery_percentage}%" + "tooltip-format-connected": "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}", + "tooltip-format-enumerate-connected": "{device_alias}\t{device_address}", + "tooltip-format-enumerate-connected-battery": "{device_alias}\t{device_address}\t{device_battery_percentage}%" }, + "network": { "format-alt": "{ipaddr}/{cidr} {icon} {bandwidthTotalBytes}󰹹", "format": "{ipaddr}/{cidr} {icon}", "format-alt-click": "click-right", "format-icons": { - "wifi": ["󰤟", "󰤢" ,"󰤥", "󰤨"], - "ethernet": [""], - "disconnected": ["󰤭"] + "wifi": [ + "󰤟", + "󰤢", + "󰤥", + "󰤨" + ], + "ethernet": [ + "󰈀" + ], + "disconnected": [ + "󰤭" + ] }, "on-click": "foot -t alacritty doas nmtui", "tooltip": false }, + "privacy": { - "icon-spacing":4, - "icon-size":18, - "transition-duration":250, + "icon-spacing": 4, + "icon-size": 18, + "transition-duration": 250, "modules": [ { - "type":"screenshare", - "tooltip":true, - "tooltip-icon-size":24 + "type": "screenshare", + "tooltip": true, + "tooltip-icon-size": 24 }, { - "type":"audio-in", - "tooltip":true, - "tooltip-icon-size":24 + "type": "audio-in", + "tooltip": true, + "tooltip-icon-size": 24 } ] }, + "pulseaudio": { "format-alt": "{icon}", "format": "{volume} {icon}", "format-alt-click": "click-right", "format-muted": "", "format-icons": { - "phone": [" ", " ", " ", " "], - "default": ["", "", "", ""] + "phone": [ + " ", + " ", + " ", + " " + ], + "default": [ + "", + "", + "", + "" + ] }, "scroll-step": 1, "on-click": "pavucontrol", "tooltip": false }, - "custom/spotify": { - "interval": 2, - "return-type": "json", - "exec": "~/.config/waybar/modules/spotify.sh", - "exec-if": "~/.config/waybar/modules/check-for-music.sh", - "escape": true, - "on-click": "playerctl play-pause" - }, + "custom/storage": { "format-alt": "{} ", "format": "{percentage}% ", @@ -118,14 +152,19 @@ "interval": 60, "exec": "~/.config/waybar/modules/storage.sh" }, + "backlight": { "format-alt": "{icon}", "format": "{percent}% {icon}", "format-alt-click": "click-right", - "format-icons": ["", ""], + "format-icons": [ + "", + "󰃞" + ], "on-scroll-up": "light -A 1", "on-scroll-down": "light -U 1" }, + "custom/weather_OLD": { "format-alt": "{}", "format": "{alt}: {}", @@ -136,14 +175,16 @@ "exec": "~/.config/waybar/modules/weather.sh", "exec-if": "ping wttr.in -c1" }, + "custom/weather": { "format": "{} °F", "tooltip": true, "interval": 3600, - "exec": "exit=101; while [ $exit = 101 ]; do wttrbar --main-indicator temp_F --fahrenheit; exit=$(echo $?); sleep 1; done", + "exec": "exit=101; while [ $exit = 101 ]; do wttrbar --main-indicator temp_F --fahrenheit --nerd; exit=$(echo $?); sleep 1; done", "on-click": "foot -a ala-wttr -H curl https://v2.wttr.in", "return-type": "json" }, + "idle_inhibitor": { "format": "{icon}", "format-icons": { @@ -152,6 +193,7 @@ }, "tooltip": false }, + "custom/mail": { "format": "", "format-alt": "{alt} ", @@ -161,7 +203,9 @@ "exec": "~/.config/waybar/modules/mail.py", "tooltip": false }, + "tray": { "icon-size": 18 } } + diff --git a/users/ryan/linux/waybar/modules/storage.sh b/users/ryan/linux/waybar/modules/storage.sh index 90cc3dc..7cb7249 100755 --- a/users/ryan/linux/waybar/modules/storage.sh +++ b/users/ryan/linux/waybar/modules/storage.sh @@ -1,25 +1,70 @@ #!/bin/sh -mount="/" +set -eu + +mountpoint="/" warning=20 critical=10 -df -h -P -l "$mount" | awk -v warning=$warning -v critical=$critical ' -/\/.*/ { - text=$4 - tooltip="Filesystem: "$1"\rSize: "$2"\rUsed: "$3"\rAvail: "$4"\rUse%: "$5"\rMounted on: "$6 - use=$5 - exit 0 +error() { + jq -cn --arg message "$1" '{ + text: "N/A", + percentage: 0, + tooltip: $message, + class: "critical" + }' + exit 0 } -END { - class="" - gsub(/%$/,"",use) - if ((100 - use) < critical) { + +line=$(df -hP -l "$mountpoint" 2>/dev/null | tail -n 1) || + error "Unable to read filesystem statistics" + +# df -P guarantees a single line per filesystem. +set -- $line + +[ "$#" -ge 6 ] || error "Unable to parse filesystem statistics" + +filesystem=$1 +size=$2 +used=$3 +available=$4 +use=${5%\%} +mounted=$6 + +case "$use" in + ''|*[!0-9]*) error "Invalid filesystem usage percentage: $use%" ;; +esac + +free=$((100 - use)) + +if [ "$free" -le "$critical" ]; then class="critical" - } else if ((100 - use) < warning) { +elif [ "$free" -le "$warning" ]; then class="warning" - } - print "{\"text\":\""text"\", \"percentage\":"use",\"tooltip\":\""tooltip"\", \"class\":\""class"\"}" -} -' +else + class="" +fi + +jq -cn \ + --arg text "${use}%" \ + --argjson percentage "$use" \ + --arg filesystem "$filesystem" \ + --arg size "$size" \ + --arg used "$used" \ + --arg available "$available" \ + --arg mounted "$mounted" \ + --arg class "$class" \ + '{ + text: $text, + percentage: $percentage, + tooltip: ( + "Filesystem: " + $filesystem + + "\rSize: " + $size + + "\rUsed: " + $used + + "\rAvail: " + $available + + "\rUse%: " + $text + + "\rMounted on: " + $mounted + ), + class: $class + }' diff --git a/users/ryan/linux/waybar/style.css b/users/ryan/linux/waybar/style.css index 682a14e..ac78984 100644 --- a/users/ryan/linux/waybar/style.css +++ b/users/ryan/linux/waybar/style.css @@ -1,7 +1,7 @@ * { border: none; border-radius: 0; - font-family: AnonymicePro Nerd Font; + font-family: FiraCode Nerd Font; font-size: 15px; box-shadow: none; text-shadow: none; diff --git a/users/ryan/linux/wpaperd/config.toml b/users/ryan/linux/wpaperd/config.toml index 9947370..9735c20 100644 --- a/users/ryan/linux/wpaperd/config.toml +++ b/users/ryan/linux/wpaperd/config.toml @@ -1,4 +1,4 @@ [default] duration = "30m" -path = "~/.config/hypr/Wallpapers/static/" +path = "/home/ryan/.config/wallpapers/" transition-time = 2000 -- cgit v1.3.1