margins & refactor

This commit is contained in:
Grimmauld 2024-05-05 18:23:46 +02:00
parent f4a943d189
commit 3f96acd255
Signed by: Grimmauld
GPG Key ID: C2946668769F91FB
2 changed files with 120 additions and 120 deletions

View File

@ -73,9 +73,10 @@ in
{ {
config = config =
let 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" ( waybar_full = pkgs.writeShellScriptBin "waybar-full" (
(lib.getExe config.programs.waybar.package) (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}") + (lib.optionalString (!isNull cfg.sway.bar.style) " -s ${cfg.sway.bar.style}")
); );
@ -219,7 +220,7 @@ in
}; };
config = mkOption { config = mkOption {
type = types.nullOr types.path; type = types.nullOr (types.either types.path types.attrs);
default = null; default = null;
description = "waybar config to use"; description = "waybar config to use";
}; };

View File

@ -1,7 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
inherit (lib) getExe; inherit (lib) getExe;
in
{
grimmShared.sway.bar = {
enable = true;
config = with pkgs; { config = with pkgs; {
backlight = { backlight = {
format = "{percent}%"; format = "{percent}%";
@ -34,6 +37,7 @@ let
on-scroll-up = "${getExe waybar-mpris} --send next"; on-scroll-up = "${getExe waybar-mpris} --send next";
return-type = "json"; return-type = "json";
}; };
margin-right = 4;
height = 30; height = 30;
idle_inhibitor = { idle_inhibitor = {
format = "{icon}"; format = "{icon}";
@ -118,11 +122,6 @@ let
tooltip-format = "{title}"; tooltip-format = "{title}";
}; };
}; };
in
{
grimmShared.sway.bar = {
enable = true;
config = pkgs.writers.writeJSON "config.json" config;
style = ./style.css; style = ./style.css;
}; };
} }