nixos/home/hyprland/waybar/default.nix

266 lines
6.7 KiB
Nix
Raw Normal View History

2024-07-17 20:22:04 +00:00
{
pkgs,
lib,
osConfig,
...
}:
2024-04-21 09:46:33 +00:00
let
flakestat = pkgs.writeShellApplication {
name = "flakestat";
runtimeInputs = with pkgs; [
git
jq
];
text = builtins.readFile ./flakestat.sh;
};
2024-04-26 10:45:55 +00:00
arrhist = pkgs.stdenv.mkDerivation {
name = "arrhist";
propagatedBuildInputs = [
2024-07-17 20:22:04 +00:00
(pkgs.python3.withPackages (pythonPackages: with pythonPackages; [ requests ]))
2024-04-26 10:45:55 +00:00
];
src = ./arrhist.py;
dontUnpack = true;
installPhase = "install -Dm755 ${./arrhist.py} $out/bin/arrhist";
};
withArrhist = if (osConfig.system.name == "gunter") then true else false;
withBattery = if (osConfig.system.name == "magicman") then true else false;
2024-04-21 09:46:33 +00:00
in
{
2024-04-26 10:45:55 +00:00
sops.secrets."sonarr_base_url" = { };
sops.secrets."sonarr_api_key" = { };
sops.secrets."radarr_base_url" = { };
sops.secrets."radarr_api_key" = { };
2024-03-06 08:23:51 +00:00
xdg.configFile."waybar/macchiato.css" = {
2024-07-17 20:22:04 +00:00
source =
pkgs.fetchFromGitHub {
2024-03-06 08:23:51 +00:00
owner = "catppuccin";
repo = "waybar";
rev = "f74ab1eecf2dcaf22569b396eed53b2b2fbe8aff";
sha256 = "WLJMA2X20E5PCPg0ZPtSop0bfmu+pLImP9t8A8V4QK8=";
2024-07-17 20:22:04 +00:00
}
+ "/themes/macchiato.css";
2024-03-06 08:23:51 +00:00
};
2024-02-27 20:13:42 +00:00
programs.waybar = {
enable = true;
systemd = {
enable = false; # disable it,autostart it in hyprland conf
target = "graphical-session.target";
};
style = ''
2024-05-29 22:01:21 +00:00
@import "macchiato.css";
2024-02-27 20:13:42 +00:00
* {
2024-05-29 22:01:21 +00:00
border: none;
font-family: "JetbrainsMono Nerd Font";
font-size: 15px;
2024-02-27 20:13:42 +00:00
transition-property: background-color;
transition-duration: 0.5s;
2024-05-29 22:01:21 +00:00
color: @text;
2024-05-31 10:53:58 +00:00
border-radius: 10px;
min-height: 10px;
2024-02-27 20:13:42 +00:00
}
2024-05-29 22:01:21 +00:00
window#waybar {
2024-05-31 10:53:58 +00:00
background-color: @surface2;
border-radius: 0px;
2024-05-29 22:01:21 +00:00
}
window#waybar.hidden {
opacity: 0.2;
}
#window {
margin-top: 6px;
padding-left: 10px;
padding-right: 10px;
2024-05-31 10:53:58 +00:00
border-radius: 0px;
2024-05-29 22:01:21 +00:00
transition: none;
color: transparent;
2024-05-31 10:53:58 +00:00
background-color: @surface2;
2024-05-29 22:01:21 +00:00
}
2024-02-27 20:13:42 +00:00
@keyframes blink_red {
to {
2024-05-29 22:01:21 +00:00
background-color: @red;
2024-02-27 20:13:42 +00:00
}
}
.warning,
.critical,
.urgent {
animation-name: blink_red;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#workspaces {
2024-05-29 22:01:21 +00:00
padding-left: 12px;
padding-right: 12px;
background-color: @base;
2024-02-27 20:13:42 +00:00
}
#workspaces button {
2024-05-29 22:01:21 +00:00
padding-left: 12px;
padding-right: 12px;
2024-02-27 20:13:42 +00:00
}
#workspaces button.active {
2024-05-31 10:53:58 +00:00
background-color: @surface2;
2024-02-27 20:13:42 +00:00
}
#workspaces button.urgent {
2024-05-29 22:01:21 +00:00
color: alpha(@red, 0.4);
2024-02-27 20:13:42 +00:00
}
#workspaces button:hover {
2024-05-29 22:01:21 +00:00
background-color: @surface2;
2024-02-27 20:13:42 +00:00
}
tooltip {
2024-05-29 22:01:21 +00:00
background-color: @base;
2024-02-27 20:13:42 +00:00
}
tooltip label {
2024-05-29 22:01:21 +00:00
color: @text;
2024-02-27 20:13:42 +00:00
}
#custom-launcher {
2024-05-29 22:01:21 +00:00
font-size: 15px;
padding-left: 5px;
padding-right: 12px;
background-color: @base;
}
.modules-right {
background-color: @base;
2024-05-31 10:53:58 +00:00
border-radius: 10px 0px 0px 10px;
}
.modules-left {
background-color: @base;
border-radius: 0px 10px 10px 0px;
2024-02-27 20:13:42 +00:00
}
#mode,
#clock,
#memory,
#temperature,
#cpu,
#mpd,
#custom-wall,
#temperature,
#backlight,
#pulseaudio,
#network,
#battery,
#custom-powermenu,
2024-04-21 09:46:33 +00:00
#custom-flakestat,
2024-05-29 22:01:21 +00:00
#custom-arrhist {
padding-left: 12px;
padding-right: 12px;
2024-02-27 20:13:42 +00:00
}
#battery.charging,
#battery.full,
#battery.discharging {
2024-05-29 22:01:21 +00:00
color: @maroon;
2024-02-27 20:13:42 +00:00
}
#battery.critical:not(.charging) {
2024-05-29 22:01:21 +00:00
color: @red;
2024-02-27 20:13:42 +00:00
}
'';
2024-04-26 10:45:55 +00:00
settings = [
2024-07-05 10:16:07 +00:00
(
let
volInterval = if (osConfig.system.name == "gunter") then "5" else "1";
in
{
"layer" = "top";
"position" = "top";
modules-left = [ "custom/flakestat" ];
modules-center = [ "hyprland/workspaces" ];
2024-07-17 20:22:04 +00:00
modules-right = [
(lib.mkIf (withArrhist) "custom/arrhist")
"pulseaudio"
"pulseaudio#microphone"
"memory"
"cpu"
(lib.mkIf (withBattery) "battery")
"clock"
"tray"
];
2024-07-05 10:16:07 +00:00
"hyprland/workspaces" = {
"format" = "{name}";
"on-click" = "activate";
"on-scroll-up" = "hyprctl dispatch workspace e+1";
"on-scroll-down" = "hyprctl dispatch workspace e-1";
2024-04-26 10:45:55 +00:00
};
2024-07-05 10:16:07 +00:00
"pulseaudio" = {
"scroll-step" = 5;
"format" = "{icon} {volume}%";
"format-muted" = "";
2024-07-17 20:22:04 +00:00
"format-icons" = {
"default" = [
""
""
""
];
};
2024-07-05 10:16:07 +00:00
"on-scroll-up" = "pamixer -i ${volInterval}";
"on-scroll-down" = "pamixer -d ${volInterval}";
"on-click" = "pamixer -t";
};
"pulseaudio#microphone" = {
"format" = "{format_source}";
"format-source" = " {volume}%";
"format-source-muted" = "";
"on-click" = "pamixer --default-source -t";
"on-scroll-up" = "pamixer --default-source -i ${volInterval}";
"on-scroll-down" = "pamixer --default-source -d ${volInterval}";
"scroll-step" = 5;
"on-click-right" = "pavucontrol";
};
"clock" = {
"interval" = 1;
"format" = "{:%H:%M %A %b %d}";
"tooltip" = true;
};
"memory" = {
"interval" = 3;
"format" = " {percentage}%";
2024-07-17 20:22:04 +00:00
"states" = {
"warning" = 85;
};
2024-07-05 10:16:07 +00:00
};
"cpu" = {
"interval" = 3;
"format" = " {usage}%";
};
"tray" = {
"icon-size" = 15;
"spacing" = 6;
};
"battery" = {
"interval" = 60;
"states" = {
"warning" = 20;
"critical" = 5;
};
"format" = "{icon} {capacity}%";
"format-icons" = [
""
""
""
""
""
];
};
"custom/flakestat" = {
"exec" = "${flakestat}/bin/flakestat";
"format" = " {}";
"return-type" = "json";
"interval" = 600;
};
2024-07-17 20:22:04 +00:00
}
// lib.optionalAttrs (withArrhist) {
2024-07-05 10:16:07 +00:00
"custom/arrhist" = {
"exec" = "${arrhist}/bin/arrhist";
"return-type" = "json";
"interval" = 600;
};
}
)
2024-04-26 10:45:55 +00:00
];
2024-02-27 20:13:42 +00:00
};
}