diff --git a/common/graphics/sway.nix b/common/graphics/sway.nix index 200208e..9d67520 100644 --- a/common/graphics/sway.nix +++ b/common/graphics/sway.nix @@ -73,9 +73,10 @@ in { config = let + bar_conf_file = if (lib.isPath cfg.sway.bar.config) then cfg.sway.bar.config else pkgs.writers.writeJSON "config.json" cfg.sway.bar.config; waybar_full = pkgs.writeShellScriptBin "waybar-full" ( (lib.getExe config.programs.waybar.package) - + (lib.optionalString (!isNull cfg.sway.bar.config) " -c ${cfg.sway.bar.config}") + + (lib.optionalString (!isNull cfg.sway.bar.config) " -c ${bar_conf_file}") + (lib.optionalString (!isNull cfg.sway.bar.style) " -s ${cfg.sway.bar.style}") ); @@ -219,7 +220,7 @@ in }; config = mkOption { - type = types.nullOr types.path; + type = types.nullOr (types.either types.path types.attrs); default = null; description = "waybar config to use"; }; diff --git a/sway/bar/default.nix b/sway/bar/default.nix index e63f698..8b7702b 100644 --- a/sway/bar/default.nix +++ b/sway/bar/default.nix @@ -1,128 +1,127 @@ { config, lib, pkgs, ... }: let inherit (lib) getExe; - - config = with pkgs; { - backlight = { - format = "{percent}%"; - format-icons = [ "" "" "" "" "" "" "" "" "" ]; - }; - battery = { - format = "{capacity}% {icon}"; - format-alt = "{time} {icon}"; - format-charging = "{capacity}% "; - format-icons = [ "" "" "" "" "" ]; - format-plugged = "{capacity}% "; - on-click = "${getExe rmenu} -r powermenu --single-click true"; - states = { critical = 15; warning = 30; }; - }; - clock = { - format-alt = "{:%d.%m.%Y}"; - tooltip-format = "{:%Y %B}\n{calendar}"; - }; - cpu = { - format = "{usage}% "; - tooltip = false; - on-click = "${getExe xdg-terminal-exec} ${getExe btop}"; - }; - "custom/media" = { - escape = true; - exec = "${getExe waybar-mpris} --position --autofocus --pause ⏵ --play ⏸ --order SYMBOL:TITLE:ARTIST:ALBUM:POSITION "; - max-length = 40; - on-click = "${getExe waybar-mpris} --send toggle"; - on-scroll-down = "${getExe waybar-mpris} --send prev"; - on-scroll-up = "${getExe waybar-mpris} --send next"; - return-type = "json"; - }; - height = 30; - idle_inhibitor = { - format = "{icon}"; - format-icons = { activated = ""; deactivated = ""; }; - }; - keyboard-state = { - capslock = true; - format = "{name} {icon}"; - format-icons = { locked = ""; unlocked = ""; }; - numlock = true; - }; - memory = { format = "{}% "; }; - modules-center = [ - # "wlr/taskbar" - ]; - modules-left = [ "sway/workspaces" "sway/mode" "sway/scratchpad" ]; - modules-right = [ - "custom/media" - "idle_inhibitor" - "pulseaudio" - "network" - "cpu" - "memory" - "temperature" - "backlight" - "keyboard-state" - "battery" - "clock" - "tray" - ]; - network = { - format-alt = "{ifname}: {ipaddr}/{cidr}"; - format-disconnected = "Disconnected ⚠"; - format-ethernet = "{ipaddr}/{cidr} "; - format-linked = "{ifname} (No IP) "; - format-wifi = "{essid} ({signalStrength}%) "; - on-click-right = "nm-connection-editor"; - tooltip-format = "{ifname} via {gwaddr} "; - }; - position = "top"; - pulseaudio = { - format = "{volume}% {icon} {format_source}"; - format-bluetooth = "{volume}% {icon} {format_source}"; - format-bluetooth-muted = "{icon} {format_source}"; - format-icons = { - car = ""; - default = [ "" "" "" ]; - hands-free = ""; - headphone = ""; - headset = ""; - phone = ""; - portable = ""; - muted = "🔇"; - }; - format-muted = "{icon} {format_source}"; - format-source = "{volume}% "; - format-source-muted = ""; - on-click = "${getExe pwvucontrol}"; - }; - spacing = 4; - "sway/mode" = { format = "{}"; }; - "sway/scratchpad" = { - format = "{icon} {count}"; - format-icons = [ "" "" ]; - show-empty = false; - tooltip = true; - tooltip-format = "{app}: {title}"; - }; - temperature = { - critical-threshold = 80; - format = "{temperatureC}°C {icon}"; - format-icons = [ "" "" "" ]; - }; - tray = { spacing = 10; }; - "wlr/taskbar" = { - format = "{icon}"; - icon-size = 14; - ignore-list = [ ]; - on-click = "activate"; - on-click-middle = "close"; - rewrite = { "Firefox Web Browser" = "Firefox"; }; - tooltip-format = "{title}"; - }; - }; in { grimmShared.sway.bar = { enable = true; - config = pkgs.writers.writeJSON "config.json" config; + config = with pkgs; { + backlight = { + format = "{percent}%"; + format-icons = [ "" "" "" "" "" "" "" "" "" ]; + }; + battery = { + format = "{capacity}% {icon}"; + format-alt = "{time} {icon}"; + format-charging = "{capacity}% "; + format-icons = [ "" "" "" "" "" ]; + format-plugged = "{capacity}% "; + on-click = "${getExe rmenu} -r powermenu --single-click true"; + states = { critical = 15; warning = 30; }; + }; + clock = { + format-alt = "{:%d.%m.%Y}"; + tooltip-format = "{:%Y %B}\n{calendar}"; + }; + cpu = { + format = "{usage}% "; + tooltip = false; + on-click = "${getExe xdg-terminal-exec} ${getExe btop}"; + }; + "custom/media" = { + escape = true; + exec = "${getExe waybar-mpris} --position --autofocus --pause ⏵ --play ⏸ --order SYMBOL:TITLE:ARTIST:ALBUM:POSITION "; + max-length = 40; + on-click = "${getExe waybar-mpris} --send toggle"; + on-scroll-down = "${getExe waybar-mpris} --send prev"; + on-scroll-up = "${getExe waybar-mpris} --send next"; + return-type = "json"; + }; + margin-right = 4; + height = 30; + idle_inhibitor = { + format = "{icon}"; + format-icons = { activated = ""; deactivated = ""; }; + }; + keyboard-state = { + capslock = true; + format = "{name} {icon}"; + format-icons = { locked = ""; unlocked = ""; }; + numlock = true; + }; + memory = { format = "{}% "; }; + modules-center = [ + # "wlr/taskbar" + ]; + modules-left = [ "sway/workspaces" "sway/mode" "sway/scratchpad" ]; + modules-right = [ + "custom/media" + "idle_inhibitor" + "pulseaudio" + "network" + "cpu" + "memory" + "temperature" + "backlight" + "keyboard-state" + "battery" + "clock" + "tray" + ]; + network = { + format-alt = "{ifname}: {ipaddr}/{cidr}"; + format-disconnected = "Disconnected ⚠"; + format-ethernet = "{ipaddr}/{cidr} "; + format-linked = "{ifname} (No IP) "; + format-wifi = "{essid} ({signalStrength}%) "; + on-click-right = "nm-connection-editor"; + tooltip-format = "{ifname} via {gwaddr} "; + }; + position = "top"; + pulseaudio = { + format = "{volume}% {icon} {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = "{icon} {format_source}"; + format-icons = { + car = ""; + default = [ "" "" "" ]; + hands-free = ""; + headphone = ""; + headset = ""; + phone = ""; + portable = ""; + muted = "🔇"; + }; + format-muted = "{icon} {format_source}"; + format-source = "{volume}% "; + format-source-muted = ""; + on-click = "${getExe pwvucontrol}"; + }; + spacing = 4; + "sway/mode" = { format = "{}"; }; + "sway/scratchpad" = { + format = "{icon} {count}"; + format-icons = [ "" "" ]; + show-empty = false; + tooltip = true; + tooltip-format = "{app}: {title}"; + }; + temperature = { + critical-threshold = 80; + format = "{temperatureC}°C {icon}"; + format-icons = [ "" "" "" ]; + }; + tray = { spacing = 10; }; + "wlr/taskbar" = { + format = "{icon}"; + icon-size = 14; + ignore-list = [ ]; + on-click = "activate"; + on-click-middle = "close"; + rewrite = { "Firefox Web Browser" = "Firefox"; }; + tooltip-format = "{title}"; + }; + }; style = ./style.css; }; }