1

Allow configuring waybar display

This commit is contained in:
2023-05-24 23:25:52 +02:00
parent a52a9e4d2e
commit 3105601a96
4 changed files with 17 additions and 5 deletions

View File

@ -1,8 +1,11 @@
[ [
{ {
"include": [
"~/.config/waybar/monitor.json"
],
"layer": "top", "layer": "top",
"position": "top", "position": "top",
"output": "HDMI-A-1",
"height": 40, "height": 40,
"spacing": 4, "spacing": 4,
@ -77,6 +80,6 @@
"icon-size": 20, "icon-size": 20,
"show-passive-items": true, "show-passive-items": true,
"spacing": 5 "spacing": 5
}, }
} }
] ]

View File

@ -88,6 +88,8 @@ rec {
protonup = true; protonup = true;
}; };
}; };
waybar.monitor = "HDMI-A-1";
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [

View File

@ -38,6 +38,8 @@ rec {
"eDP-1" = [1 2 3 4 5 6 7 8 9]; "eDP-1" = [1 2 3 4 5 6 7 8 9];
}; };
}; };
waybar.monitor = "eDP-1";
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [

View File

@ -11,7 +11,6 @@
with lib; with lib;
with mylib.modules; let with mylib.modules; let
cfg = config.modules.waybar; cfg = config.modules.waybar;
hypr = config.modules.hyprland;
in { in {
options.modules.waybar = import ./options.nix {inherit lib mylib;}; options.modules.waybar = import ./options.nix {inherit lib mylib;};
@ -61,13 +60,19 @@ in {
trap "${pkgs.procps}/bin/pkill waybar" EXIT trap "${pkgs.procps}/bin/pkill waybar" EXIT
while true; do while true; do
${waybar-hyprland}/bin/waybar -c $HOME/NixFlake/config/waybar/config -s $HOME/NixFlake/config/waybar/style.css & ${waybar-hyprland}/bin/waybar -c $HOME/NixFlake/config/waybar/config.json -s $HOME/NixFlake/config/waybar/style.css &
${pkgs.inotifyTools}/bin/inotifywait -e create,modify $HOME/NixFlake/config/waybar/config $HOME/NixFlake/config/waybar/style.css ${pkgs.inotifyTools}/bin/inotifywait -e create,modify $HOME/NixFlake/config/waybar/config.json $HOME/NixFlake/config/waybar/style.css
${pkgs.procps}/bin/pkill waybar ${pkgs.procps}/bin/pkill waybar
done done
''; '';
in [ in [
"${waybar-reload}" "${waybar-reload}"
]; ];
home.file.".config/waybar/monitor.json".text = ''
{
"output": "${cfg.monitor}"
}
'';
}; };
} }