calcite: switch to niri

This commit is contained in:
xinyangli 2024-11-12 21:17:20 +08:00
parent 62ca7ce8af
commit 3b393a74f5
Signed by: xin
SSH key fingerprint: SHA256:UU5pRTl7NiLFJbWJZa+snLylZSXIz5rgHmwjzv8v4oE
10 changed files with 473 additions and 123 deletions

View file

@ -0,0 +1,7 @@
{
imports = [
./niri.nix
./fuzzel.nix
./waybar.nix
];
}

View file

@ -0,0 +1,14 @@
{ config, lib, ... }:
let
inherit (lib) mkIf mkEnableOption;
cfg = config.custom-hm.gui.fuzzel;
in
{
options.custom-hm.gui.fuzzel = {
enable = mkEnableOption "fuzzel";
};
config = mkIf cfg.enable {
programs.fuzzel.enable = true;
};
}

View file

@ -0,0 +1,88 @@
{
config,
pkgs,
lib,
...
}:
let
inherit (lib) mkIf mkEnableOption;
cfg = config.custom-hm.gui.niri;
wallpaper = pkgs.fetchurl {
url = "https://github.com/NixOS/nixos-artwork/blob/master/wallpapers/nixos-wallpaper-catppuccin-mocha.png?raw=true";
hash = "sha256-fmKFYw2gYAYFjOv4lr8IkXPtZfE1+88yKQ4vjEcax1s=";
};
in
{
options.custom-hm.gui.niri = {
enable = mkEnableOption "niri";
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
xwayland-satellite
cosmic-files
];
home.pointerCursor = {
name = "Bibata-Modern-Ice";
size = 24;
package = pkgs.bibata-cursors;
gtk.enable = true;
};
gtk = {
enable = true;
theme = {
name = "Catppuccin-GTK-Dark";
package = pkgs.magnetic-catppuccin-gtk;
};
gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
};
services.network-manager-applet.enable = true;
systemd.user.services.swaybg = {
Install = {
WantedBy = [ "graphical-session.target" ];
};
Unit = {
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${lib.getExe pkgs.swaybg} -i ${wallpaper} -m fill";
Restart = "on-failure";
};
};
programs.swaylock = {
enable = true;
settings = {
show-failed-attempts = true;
daemonize = true;
scaling = "fill";
};
};
systemd.user.services.swayidle.Unit.After = [ "graphical-session.target" ];
services = {
swayidle = {
enable = true;
timeouts = [
{
timeout = 900;
command = "/run/current-system/systemd/bin/systemctl suspend";
}
];
events = [
{
event = "lock";
command = "${pkgs.swaylock}/bin/swaylock";
}
{
event = "before-sleep";
command = "/run/current-system/systemd/bin/loginctl lock-session";
}
];
};
};
};
}

View file

@ -0,0 +1,57 @@
* {
font-family: Ubuntu Nerd Font, Noto Sans CJK SC;
font-size: 14px;
font-weight: bold;
min-height: 14px;
}
window#waybar {
color: @text;
opacity: 0.95;
background-color: @crust;
padding: 2px;
}
#custom-nixos {
background-color: #24273a;
padding-left: 15px;
padding-right: 18px;
}
#custom-separator {
margin: 0 2px;
}
#workspaces {
border-radius: 0;
}
#workspaces button {
padding: 0 10px;
border-radius: 0;
}
#workspaces button.focused,
#workspaces button.active {
border-bottom: 4px solid #8aadf4;
}
#workspaces button.empty {
font-size: 0;
min-width: 0;
min-height: 0;
margin: 0;
padding: 0;
border: 0;
opacity: 0;
box-shadow: none;
}
#cpu,
#memory,
#pulseaudio,
#network,
#backlight,
#battery,
#tray {
margin-right: 15px;
}
#clock {
font-size: 16px;
}

View file

@ -0,0 +1,173 @@
{
config,
pkgs,
lib,
...
}:
let
inherit (lib) mkIf mkEnableOption readFile;
cfg = config.custom-hm.gui.waybar;
in
{
options.custom-hm.gui.waybar = {
enable = mkEnableOption "waybar";
};
config = mkIf cfg.enable {
programs.waybar = {
enable = true;
style = readFile ./waybar.css;
settings = {
main = {
margin = "2px 3px 2 3px";
height = 30;
layer = "top";
"custom/nixos" = {
format = "";
interval = "once";
tooltip = false;
};
"custom/separator" = {
format = " ";
interval = "once";
tooltip = false;
};
modules-left = [
"custom/nixos"
"niri/workspaces"
"custom/separator"
"niri/window"
];
modules-center = [
"clock"
];
modules-right = [
"network#speed"
"custom/separator"
"network#if"
"custom/separator"
"pulseaudio"
"custom/separator"
"memory"
"custom/separator"
"cpu"
"custom/separator"
"backlight"
"custom/separator"
"battery"
"custom/separator"
"tray"
];
"niri/workspaces" = {
all-outputs = true;
format = "{icon}";
format-icons = {
"terminal" = "";
"browser" = "";
"chat" = "";
"mail" = "󰇮";
};
};
"niri/window" = {
max-length = 50;
};
pulseaudio = {
format = "{icon} {volume}% {format_source}";
format-bluetooth = "{icon} {volume}% {format_source}";
format-bluetooth-muted = " {icon} {format_source}";
format-icons = {
car = "";
default = [
""
""
""
];
hands-free = "";
headphone = "";
headset = "";
phone = "";
portable = "";
};
format-muted = " {format_source}";
format-source = " {volume}%";
format-source-muted = "";
on-click = "${pkgs.pavucontrol}/bin/pavucontrol";
};
backlight = {
format = "󰖨 {percent}%";
on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl set 1%-";
on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl set +1%";
};
battery = {
interval = 10;
format = "{icon} {capacity}%";
format-charging = "{icon} {capacity}% 󱐋";
format-plugged = "{icon} {capacity}% ";
format-icons = [
""
""
""
""
""
];
};
clock = {
format = "{:%a %b %d %H:%M}";
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
};
memory = {
format = " {percentage}%";
};
"network#if" = {
format = "{ifname}";
format-disconnected = "󰌙";
format-ethernet = "󰌘";
format-linked = "{ifname} (No IP) 󰈁";
format-wifi = "{icon}";
format-icons = [
"󰤯"
"󰤟"
"󰤢"
"󰤥"
"󰤨"
];
interval = 10;
};
"network#speed" = {
format = "{ifname}";
format-disconnected = "󰌙";
format-ethernet = " {bandwidthDownBytes} {bandwidthUpBytes}";
format-linked = "";
format-wifi = " {bandwidthDownBytes} {bandwidthUpBytes}";
interval = 5;
max-length = 30;
tooltip-format = "{ipaddr}";
tooltip-format-disconnected = "󰌙 Disconnected";
tooltip-format-ethernet = "{ifname} 󰌘";
tooltip-format-wifi = "{essid} {icon} {signalStrength}%";
};
cpu = {
format = " {usage}%";
interval = 5;
};
tray = {
icon-size = 18;
spacing = 14;
};
};
};
systemd.enable = true;
};
systemd.user.targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = [ "graphical-session-pre.target" ];
};
};
};
}