From 43da9edb4598eef509c481ae0b305384418c45de Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 5 May 2023 19:41:58 -0700 Subject: home/profiles: move (almost) all modules to profiles This is a major refactor, similar to what was done for the hosts, but in a single commit. --- home/wm/waybar/default.nix | 67 -------------------------------------- home/wm/waybar/style.css | 69 ---------------------------------------- home/wm/waybar/waybar-systemd.sh | 22 ------------- 3 files changed, 158 deletions(-) delete mode 100644 home/wm/waybar/default.nix delete mode 100644 home/wm/waybar/style.css delete mode 100755 home/wm/waybar/waybar-systemd.sh (limited to 'home/wm/waybar') diff --git a/home/wm/waybar/default.nix b/home/wm/waybar/default.nix deleted file mode 100644 index 4a524a8..0000000 --- a/home/wm/waybar/default.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ config, lib, pkgs, ... }: -let - isEnabled = config.my.home.wm.windowManager == "sway"; - waybarSystemd = - pkgs.runCommandLocal "waybar-systemd" - { nativeBuildInputs = [ pkgs.makeWrapper ]; } - '' - makeWrapper ${./waybar-systemd.sh} $out/bin/waybar-systemd - ''; -in -{ - config = lib.mkIf isEnabled { - programs.waybar = { - enable = true; - systemd = { enable = true; }; - - settings = [{ - layer = "bottom"; - height = 25; - position = "top"; - margin-top = 0; - margin-left = 0; - margin-right = 0; - margin-bottom = 0; - modules-left = [ "sway/workspaces" "sway/mode" ]; - modules-right = [ "custom/systemd" "pulseaudio" "network" "battery" "clock" "tray" ]; - "sway/workspaces" = { - format = "{name}"; - disable-scroll = true; - }; - "sway/mode" = { format = "{}"; }; - tray = { spacing = 10; }; - clock = { format = "{: %a %b %d %R}"; }; - battery = { - states = { - warning = 30; - critical = 15; - }; - format = "ac:{capacity}%"; - tooltip = true; - tooltip-format = "{timeTo} ({capacity}%)"; - }; - "custom/systemd" = { - exec = "${waybarSystemd}/bin/waybar-systemd"; - return-type = "json"; - interval = 10; - }; - pulseaudio = { - format = "vol:{volume}%"; - format-bluetooth = "bt:{volume}%"; - format-bluetooth-muted = "bt:{volume}%"; - format-muted = "vol:{volume}%"; - on-click = "pavucontrol"; - }; - "network" = { - format-wifi = "{essid}:{signalStrength}%"; - format-ethernet = "{ipaddr}/{cidr}"; - format-linked = "{ifname} (No IP)"; - format-disconnected = "network unavailable"; - format-alt = "{ifname}: {ipaddr}/{cidr}"; - tooltip = false; - }; - }]; - style = (builtins.readFile ./style.css); - }; - }; -} diff --git a/home/wm/waybar/style.css b/home/wm/waybar/style.css deleted file mode 100644 index 1362cd5..0000000 --- a/home/wm/waybar/style.css +++ /dev/null @@ -1,69 +0,0 @@ -* { - border-radius: 0; - border: none; - margin: 0; - min-height: 0; - padding: 0; - font-family: Source Code Pro; - font-size: 15px; -} -window#waybar { - background-color: #282A36; - color: #eee; -} -#workspaces button { - padding: 0 3px; - background-color: transparent; - color: #eee; -} -#workspaces button.focused { - background-color: #285577; - border: 1px solid #4c7899; -} -#clock, -#battery, -#network, -#pulseaudio, -#tray, -#mode { - padding-left: 10px; - padding-right: 10px; -} -#mode { - /* No styles */ -} -#tray { - /* No styles */ -} -#clock { - /* No styles */ -} -#battery { - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; -} -#battery.discharging { - color: #90a1ad; -} -#battery.charging { - color: #fffff8; -} -#battery.warning { - border-bottom: 2px solid #ff9e21; -} -#battery.critical { - border-bottom: 2px solid #ff3121; -} -#network { - /* No styles */ -} -#network.disconnected { - color: orange; -} -#pulseaudio { - /* No styles */ -} -#pulseaudio.muted { - color: #90a1ad; -} diff --git a/home/wm/waybar/waybar-systemd.sh b/home/wm/waybar/waybar-systemd.sh deleted file mode 100755 index bf4e8b8..0000000 --- a/home/wm/waybar/waybar-systemd.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -failed_user="$(systemctl --plain --no-legend --user list-units --state=failed | awk '{ print $1 }')" -failed_system="$(systemctl --plain --no-legend list-units --state=failed | awk '{ print $1 }')" - -failed_systemd_count="$(echo -n "$failed_system" | grep -c '^')" -failed_user_count="$(echo -n "$failed_user" | grep -c '^')" - -text=$(( failed_systemd_count + failed_user_count )) - -if [ "$text" -eq 0 ]; then - printf '{"text": ""}\n' -else - tooltip="" - - [ -n "$failed_system" ] && tooltip="Failed system services:\n\n${failed_system}\n\n${tooltip}" - [ -n "$failed_user" ] && tooltip="Failed user services:\n\n${failed_user}\n\n${tooltip}" - - tooltip="$(printf "%s" "$tooltip" | perl -pe 's/\n/\\n/g' | perl -pe 's/(?:\\n)+$//')" - - printf '{"text": "%s", "tooltip": "%s" }\n' "$text" "$tooltip" -fi -- cgit 1.4.1