nixos/home/hyprland/waybar/default.nix

259 lines
6.5 KiB
Nix
Raw Normal View History

2024-04-22 20:34:14 +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 = [
(pkgs.python3.withPackages (pythonPackages: with pythonPackages; [
requests
]))
];
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" = {
source = pkgs.fetchFromGitHub
{
owner = "catppuccin";
repo = "waybar";
rev = "f74ab1eecf2dcaf22569b396eed53b2b2fbe8aff";
sha256 = "WLJMA2X20E5PCPg0ZPtSop0bfmu+pLImP9t8A8V4QK8=";
} + "/themes/machiatto.css";
};
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-03-02 21:20:09 +00:00
font-family: "FiraCodeNerdFont-Regular";
2024-02-27 20:13:42 +00:00
font-size: 14px;
font-weight: bold;
border-radius: 0px;
transition-property: background-color;
transition-duration: 0.5s;
}
@keyframes blink_red {
to {
background-color: rgb(242, 143, 173);
color: rgb(26, 24, 38);
}
}
.warning,
.critical,
.urgent {
animation-name: blink_red;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
window#waybar {
background-color: transparent;
}
window > box {
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
border-bottom: 2px solid @color1;
background-color: @background;
}
#workspaces {
padding-left: 0px;
padding-right: 4px;
}
#workspaces button {
padding-top: 5px;
padding-bottom: 5px;
padding-left: 6px;
padding-right: 6px;
color: @color1;
}
#workspaces button.active {
background-color: @color1;
color: rgb(26, 24, 38);
}
#workspaces button.urgent {
color: rgb(26, 24, 38);
}
#workspaces button:hover {
background-color: #b38dac;
color: rgb(26, 24, 38);
}
tooltip {
background: #3b4253;
}
tooltip label {
color: #e4e8ef;
}
#custom-launcher {
font-size: 20px;
padding-left: 8px;
padding-right: 6px;
color: #7ebae4;
}
#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-04-26 10:45:55 +00:00
#custom-arrhist,
2024-02-27 20:13:42 +00:00
#custom-cava-internal {
padding-left: 10px;
padding-right: 10px;
color: @color1;
}
#network.disconnected {
color: #cccccc;
}
#battery.charging,
#battery.full,
#battery.discharging {
color: #cf876f;
}
#battery.critical:not(.charging) {
color: #d6dce7;
}
#custom-powermenu {
color: #bd6069;
}
#tray {
padding-right: 8px;
padding-left: 10px;
}
#tray menu {
background: #3b4252;
color: #dee2ea;
}
#mpd.paused {
color: rgb(192, 202, 245);
font-style: italic;
}
#mpd.stopped {
background: transparent;
}
#mpd {
color: #e4e8ef;
}
#custom-cava-internal {
font-family: "Hack Nerd Font";
}
'';
2024-04-26 10:45:55 +00:00
settings = [
({
"layer" = "top";
"position" = "top";
2024-04-29 09:51:25 +00:00
modules-left = [ "custom/flakestat" "hyprland/workspaces" ];
2024-04-26 10:45:55 +00:00
modules-center = [ "clock" ];
modules-right =
[
(lib.mkIf (withArrhist) "custom/arrhist")
"pulseaudio"
"pulseaudio#microphone"
"memory"
"cpu"
"tray"
(lib.mkIf (withBattery) "battery")
];
"hyprland/workspaces" = {
"format" = "{name}";
"on-click" = "activate";
"on-scroll-up" = "hyprctl dispatch workspace e+1";
"on-scroll-down" = "hyprctl dispatch workspace e-1";
};
"pulseaudio" = {
"scroll-step" = 5;
"format" = "{icon} {volume}%";
"format-muted" = "";
"format-icons" = { "default" = [ "" "" "" ]; };
"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 5";
"on-scroll-down" = "pamixer --default-source -d 5";
"scroll-step" = 5;
"on-click-right" = "pavucontrol";
};
"clock" = {
"interval" = 1;
"format" = "{:%H:%M %A %b %d}";
"tooltip" = true;
2024-04-21 09:46:33 +00:00
};
2024-04-26 10:45:55 +00:00
"memory" = {
"interval" = 3;
"format" = " {percentage}%";
"states" = { "warning" = 85; };
};
"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";
2024-04-29 09:51:25 +00:00
"format" = " {}";
"return-type" = "json";
2024-04-26 10:45:55 +00:00
"interval" = 600;
};
} // lib.optionalAttrs (withArrhist) {
"custom/arrhist" = {
"exec" = "${arrhist}/bin/arrhist";
"return-type" = "json";
2024-04-29 09:51:25 +00:00
"interval" = 600;
2024-04-26 10:45:55 +00:00
};
})
];
2024-02-27 20:13:42 +00:00
};
}