This commit is contained in:
nora 2025-08-01 18:35:15 +02:00
parent 09159584f3
commit 5874a94a21
3 changed files with 207 additions and 194 deletions

View file

@ -52,7 +52,7 @@
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.nora = import ./home-manager/home.nix; home-manager.users.nora = import ./home-manager/laptop.nix;
home-manager.extraSpecialArgs = { inherit inputs; }; home-manager.extraSpecialArgs = { inherit inputs; };
} }
]; ];

7
home-manager/laptop.nix Normal file
View file

@ -0,0 +1,7 @@
{ ... }: {
imports = [
./home.nix
];
is-laptop = true;
}

View file

@ -1,214 +1,220 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
home.file."${config.xdg.configHome}/waybar/config.jsonc" = { options.is-laptop = lib.mkEnableOption "whether the computer is a laptop";
text =
builtins.toJSON {
height = 35;
spacing = 4;
modules-left = [ config = {
"systemd-failed-units" home.file."${config.xdg.configHome}/waybar/config.jsonc" = {
"custom/music-back" text =
"mpris" builtins.toJSON {
"custom/music-next" height = 35;
]; spacing = 4;
modules-center = [
"clock"
];
modules-right = [
"bluetooth"
"privacy"
"pulseaudio"
"cpu"
"memory"
"tray"
] ++
(if (config.networking.hostName == "scrap") then [ "battery" ] else [ ]) ++
[
"custom/power"
];
systemd-failed-units = { modules-left = [
hide-on-ok = true; # Hide if there are zero failed units. "systemd-failed-units"
format = " {nr_failed}"; "custom/music-back"
format-ok = " systemd is ok but waybar is not"; "mpris"
system = true; # monitor sytem units "custom/music-next"
user = true; # monitor user units ];
}; modules-center = [
"custom/music-back" = { "clock"
format = ""; ];
tooltip = true; modules-right = [
tooltip-format = "Play previous song"; "bluetooth"
on-click = "${lib.getExe pkgs.playerctl} previous"; "privacy"
}; "pulseaudio"
mpris = { "cpu"
format = "{status_icon} {dynamic}"; "memory"
dynamic-order = [ "title" "artist" ]; "tray"
status-icons = { ] ++
paused = ""; (if (config.networking.hostName == "scrap") then
[ "network" "power-profiles-daemon" "battery" ]
else [ ]) ++
[
"custom/power"
];
systemd-failed-units = {
hide-on-ok = true; # Hide if there are zero failed units.
format = " {nr_failed}";
format-ok = " systemd is ok but waybar is not";
system = true; # monitor sytem units
user = true; # monitor user units
}; };
}; "custom/music-back" = {
"custom/music-next" = { format = "";
format = ""; tooltip = true;
tooltip = true; tooltip-format = "Play previous song";
tooltip-format = "Play next song"; on-click = "${lib.getExe pkgs.playerctl} previous";
on-click = "${lib.getExe pkgs.playerctl} next"; };
}; mpris = {
clock = { format = "{status_icon} {dynamic}";
interval = 1; dynamic-order = [ "title" "artist" ];
format = "{:%a %F %H:%M:%S}"; status-icons = {
tooltip-format = "<tt><small>{calendar}</small></tt>"; paused = "";
calendar = {
mode = "year";
mode-mon-col = 3;
weeks-pos = "right";
on-scroll = 1;
format = {
months = "<span color='#ffead3'><b>{}</b></span>";
days = "<span color='#ecc6d9'><b>{}</b></span>";
weeks = "<span color='#99ffdd'><b>W{}</b></span>";
weekdays = "<span color='#ffcc66'><b>{}</b></span>";
today = "<span color='#ff6699'><b><u>{}</u></b></span>";
}; };
}; };
actions = { "custom/music-next" = {
on-click-right = "mode"; format = "";
on-scroll-up = "shift_up"; tooltip = true;
on-scroll-down = "shift_down"; tooltip-format = "Play next song";
on-click = "${lib.getExe pkgs.playerctl} next";
}; };
}; clock = {
interval = 1;
bluetooth = { format = "{:%a %F %H:%M:%S}";
format = " {status}"; tooltip-format = "<tt><small>{calendar}</small></tt>";
format-disabled = ""; # an empty format will hide the module calendar = {
format-connected = " {num_connections} connected"; mode = "year";
on-click = lib.getExe pkgs.overskride; mode-mon-col = 3;
}; weeks-pos = "right";
pulseaudio = { on-scroll = 1;
# "scroll-step": 1, // %, can be a float format = {
"format" = "{volume}% {icon} {format_source}"; months = "<span color='#ffead3'><b>{}</b></span>";
"format-bluetooth" = "{volume}% {icon} {format_source}"; days = "<span color='#ecc6d9'><b>{}</b></span>";
"format-bluetooth-muted" = " {icon} {format_source}"; weeks = "<span color='#99ffdd'><b>W{}</b></span>";
"format-muted" = " {format_source}"; weekdays = "<span color='#ffcc66'><b>{}</b></span>";
"format-source" = "{volume}% "; today = "<span color='#ff6699'><b><u>{}</u></b></span>";
"format-source-muted" = ""; };
"format-icons" = { };
"headphone" = ""; actions = {
"hands-free" = ""; on-click-right = "mode";
"headset" = ""; on-scroll-up = "shift_up";
"phone" = ""; on-scroll-down = "shift_down";
"portable" = "";
"car" = "";
"default" = [ "" "" "" ];
};
"on-click" = lib.getExe pkgs.pavucontrol;
};
cpu = {
format = "{usage}% ";
tooltip = false;
};
memory = {
format = "{}% ";
};
tray = {
spacing = 10;
};
"custom/power" =
let
power-menu = pkgs.writeText "power_menu.xml" ''
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkMenu" id="menu">
<child>
<object class="GtkMenuItem" id="lock">
<property name="label">Lock 🔒</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="delimiter1"/>
</child>
<child>
<object class="GtkMenuItem" id="reboot">
<property name="label">Reboot </property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="poweroff">
<property name="label">Poweroff 💤</property>
</object>
</child>
</object>
</interface>
'';
in
{
"format" = "";
"tooltip" = false;
"menu" = "on-click";
"menu-file" = power-menu;
"menu-actions" = {
"lock" = "${lib.getExe pkgs.swaylock}";
"reboot" = "reboot";
"poweroff" = "poweroff";
}; };
}; };
};
};
home.file."${config.xdg.configHome}/waybar/style.css" = {
text = ''
${builtins.readFile ./default-waybar-style.css}
window#waybar { bluetooth = {
background: linear-gradient( format = " {status}";
to right, format-disabled = ""; # an empty format will hide the module
rgb(131, 80, 117) 15%, format-connected = " {num_connections} connected";
rgb(158, 103, 143) 30%, on-click = lib.getExe pkgs.overskride;
rgb(131, 80, 117) 45%, };
#db88c5 pulseaudio = {
); # "scroll-step": 1, // %, can be a float
color: black; "format" = "{volume}% {icon} {format_source}";
} "format-bluetooth" = "{volume}% {icon} {format_source}";
"format-bluetooth-muted" = " {icon} {format_source}";
"format-muted" = " {format_source}";
"format-source" = "{volume}% ";
"format-source-muted" = "";
"format-icons" = {
"headphone" = "";
"hands-free" = "";
"headset" = "";
"phone" = "";
"portable" = "";
"car" = "";
"default" = [ "" "" "" ];
};
"on-click" = lib.getExe pkgs.pavucontrol;
};
cpu = {
format = "{usage}% ";
tooltip = false;
};
memory = {
format = "{}% ";
};
tray = {
spacing = 10;
};
"custom/power" =
let
power-menu = pkgs.writeText "power_menu.xml" ''
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkMenu" id="menu">
<child>
<object class="GtkMenuItem" id="lock">
<property name="label">Lock 🔒</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="delimiter1"/>
</child>
<child>
<object class="GtkMenuItem" id="reboot">
<property name="label">Reboot </property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="poweroff">
<property name="label">Poweroff 💤</property>
</object>
</child>
</object>
</interface>
'';
in
{
"format" = "";
"tooltip" = false;
"menu" = "on-click";
"menu-file" = power-menu;
"menu-actions" = {
"lock" = "${lib.getExe pkgs.swaylock}";
"reboot" = "reboot";
"poweroff" = "poweroff";
};
};
};
};
home.file."${config.xdg.configHome}/waybar/style.css" = {
text = ''
${builtins.readFile ./default-waybar-style.css}
#systemd-failed-units { window#waybar {
padding-left: 30px; background: linear-gradient(
padding-right: 30px; to right,
background-color: red; rgb(131, 80, 117) 15%,
} rgb(158, 103, 143) 30%,
rgb(131, 80, 117) 45%,
#db88c5
);
color: black;
}
#mpris { #systemd-failed-units {
color: white; padding-left: 30px;
} padding-right: 30px;
background-color: red;
}
#custom-music-back, #custom-music-next { #mpris {
font-size: 20px; color: white;
color: white; }
}
#custom-music-back { #custom-music-back, #custom-music-next {
padding: 0 10px 0 15px; font-size: 20px;
} color: white;
#custom-music-next { }
padding: 0 10px;
}
#clock { #custom-music-back {
background: unset; padding: 0 10px 0 15px;
color: white; }
} #custom-music-next {
padding: 0 10px;
}
#privacy *, #pulseaudio, #cpu, #memory, #tray { #clock {
background-color: unset; background: unset;
color: black; color: white;
} }
#custom-power { #privacy *, #pulseaudio, #cpu, #memory, #tray {
padding-left: 15px; background-color: unset;
padding-right: 15px; color: black;
font-size: 30px; }
background-color: rebeccapurple;
color: white; #custom-power {
} padding-left: 15px;
''; padding-right: 15px;
font-size: 30px;
background-color: rebeccapurple;
color: white;
}
'';
};
}; };
} }