refactor: implement component-based architecture for enhanced maintainability

- Reorganize directory structure into core/, features/, and themes/
- Colocate application Nix logic, configs, scripts, and theme overrides
- Implement 'Inversion of Control' for theming: apps now pull theme-specific layouts
- Update flake.nix and shared library paths to match the new structure
- Document the new Feature-Centric architecture in README.md
This commit is contained in:
Bernardo Magri
2026-04-12 14:51:15 +01:00
parent a9ee79a5ce
commit bbdf34ced8
535 changed files with 119 additions and 127 deletions

View File

@@ -0,0 +1,174 @@
{
"reload_style_on_change": true,
"layer": "top",
"position": "top",
"spacing": 0,
"height": 26,
"modules-left": ["custom/nomarchy", "hyprland/workspaces"],
"modules-center": ["clock", "custom/update", "custom/voxtype", "custom/screenrecording-indicator", "custom/idle-indicator", "custom/notification-silencing-indicator"],
"modules-right": [
"group/tray-expander",
"bluetooth",
"network",
"pulseaudio",
"cpu",
"battery"
],
"hyprland/workspaces": {
"on-click": "activate",
"format": "{icon}",
"format-icons": {
"default": "",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7",
"8": "8",
"9": "9",
"10": "0",
"active": "󱓻"
},
"persistent-workspaces": {
"1": [],
"2": [],
"3": [],
"4": [],
"5": []
}
},
"custom/nomarchy": {
"format": "<span font='nomarchy'>a</span>",
"on-click": "nomarchy-menu",
"on-click-right": "xdg-terminal-exec",
"tooltip-format": "Nomarchy Menu\n\nSuper + Alt + Space"
},
"custom/update": {
"format": "",
"exec": "nomarchy-update-available",
"on-click": "nomarchy-launch-floating-terminal-with-presentation nomarchy-update",
"tooltip-format": "Nomarchy update available",
"signal": 7,
"interval": 21600
},
"cpu": {
"interval": 5,
"format": "󰍛",
"on-click": "nomarchy-launch-or-focus-tui btop",
"on-click-right": "alacritty"
},
"clock": {
"format": "{:L%A %H:%M}",
"format-alt": "{:L%d %B W%V %Y}",
"tooltip": false,
"on-click-right": "nomarchy-launch-floating-terminal-with-presentation nomarchy-tz-select"
},
"network": {
"format-icons": ["󰤯", "󰤟", "󰤢", "󰤥", "󰤨"],
"format": "{icon}",
"format-wifi": "{icon}",
"format-ethernet": "󰀂",
"format-disconnected": "󰤮",
"tooltip-format-wifi": "{essid} ({frequency} GHz)\n⇣{bandwidthDownBytes} ⇡{bandwidthUpBytes}",
"tooltip-format-ethernet": "⇣{bandwidthDownBytes} ⇡{bandwidthUpBytes}",
"tooltip-format-disconnected": "Disconnected",
"interval": 3,
"spacing": 1,
"on-click": "nomarchy-launch-wifi"
},
"battery": {
"format": "{capacity}% {icon}",
"format-discharging": "{icon}",
"format-charging": "{icon}",
"format-plugged": "",
"format-icons": {
"charging": ["󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"],
"default": ["󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"]
},
"format-full": "󰂅",
"tooltip-format-discharging": "{power:>1.0f}W↓ {capacity}%",
"tooltip-format-charging": "{power:>1.0f}W↑ {capacity}%",
"interval": 5,
"on-click": "nomarchy-menu power",
"states": {
"warning": 20,
"critical": 10
}
},
"bluetooth": {
"format": "",
"format-off": "󰂲",
"format-disabled": "󰂲",
"format-connected": "󰂱",
"format-no-controller": "",
"tooltip-format": "Devices connected: {num_connections}",
"on-click": "nomarchy-launch-bluetooth"
},
"pulseaudio": {
"format": "{icon}",
"on-click": "nomarchy-launch-audio",
"on-click-right": "pamixer -t",
"tooltip-format": "Playing at {volume}%",
"scroll-step": 5,
"format-muted": "",
"format-icons": {
"headphone": "",
"headset": "",
"default": ["", "", ""]
}
},
"group/tray-expander": {
"orientation": "inherit",
"drawer": {
"transition-duration": 600,
"children-class": "tray-group-item"
},
"modules": ["custom/expand-icon", "tray"]
},
"custom/expand-icon": {
"format": "",
"tooltip": false,
"on-scroll-up": "",
"on-scroll-down": "",
"on-scroll-left": "",
"on-scroll-right": ""
},
"custom/screenrecording-indicator": {
"on-click": "nomarchy-cmd-screenrecord",
"exec": "$OMARCHY_PATH/default/waybar/indicators/screen-recording.sh",
"signal": 8,
"return-type": "json"
},
"custom/idle-indicator": {
"on-click": "nomarchy-toggle-idle",
"exec": "$OMARCHY_PATH/default/waybar/indicators/idle.sh",
"signal": 9,
"return-type": "json"
},
"custom/notification-silencing-indicator": {
"on-click": "nomarchy-toggle-notification-silencing",
"exec": "~/.config/nomarchy/default/waybar/indicators/notification-silencing.sh",
"signal": 10,
"return-type": "json"
},
"custom/voxtype": {
"exec": "nomarchy-voxtype-status",
"return-type": "json",
"format": "{icon}",
"format-icons": {
"idle": "",
"recording": "󰍬",
"transcribing": "󰔟"
},
"tooltip": true,
"on-click-right": "nomarchy-voxtype-config",
"on-click": "nomarchy-voxtype-model"
},
"tray": {
"icon-size": 12,
"spacing": 17
}
}

View File

@@ -0,0 +1,100 @@
@import "../nomarchy/current/theme/waybar.css";
* {
background-color: @background;
color: @foreground;
border: none;
border-radius: 0;
min-height: 0;
font-family: 'JetBrainsMono Nerd Font';
font-size: 12px;
}
.modules-left {
margin-left: 8px;
}
.modules-right {
margin-right: 8px;
}
#workspaces button {
all: initial;
padding: 0 6px;
margin: 0 1.5px;
min-width: 9px;
}
#workspaces button.empty {
opacity: 0.5;
}
#cpu,
#battery,
#pulseaudio,
#custom-nomarchy,
#custom-update {
min-width: 12px;
margin: 0 7.5px;
}
#tray {
margin-right: 16px;
}
#bluetooth {
margin-right: 17px;
}
#network {
margin-right: 13px;
}
#custom-expand-icon {
margin-right: 18px;
}
tooltip {
padding: 2px;
}
#custom-update {
font-size: 10px;
}
#clock {
margin-left: 8.75px;
}
.hidden {
opacity: 0;
}
#custom-screenrecording-indicator,
#custom-idle-indicator,
#custom-notification-silencing-indicator {
min-width: 12px;
margin-left: 5px;
margin-right: 0;
font-size: 10px;
padding-bottom: 1px;
}
#custom-screenrecording-indicator.active {
color: #a55555;
}
#custom-idle-indicator.active,
#custom-notification-silencing-indicator.active {
color: #a55555;
}
#custom-voxtype {
min-width: 12px;
margin: 0 0 0 7.5px;
}
#custom-voxtype.recording {
color: #a55555;
}

View File

@@ -0,0 +1,32 @@
{ config, pkgs, lib, ... }:
let
activeTheme = config.nomarchy.theme;
# Path to local theme files
themeDir = ./themes + "/${activeTheme}";
hasThemeConfig = builtins.pathExists (themeDir + "/config.jsonc");
hasThemeStyle = builtins.pathExists (themeDir + "/style.css");
# Default fallback files
defaultConfig = ./config/config.jsonc;
defaultStyle = ./config/style.css;
# Selected files
configFile = if hasThemeConfig then (themeDir + "/config.jsonc") else defaultConfig;
styleFile = if hasThemeStyle then (themeDir + "/style.css") else defaultStyle;
in
{
programs.waybar = {
enable = lib.mkDefault true;
systemd.enable = lib.mkDefault true;
settings = lib.mkDefault [ (builtins.fromJSON (builtins.readFile configFile)) ];
style = lib.mkDefault (builtins.readFile styleFile);
};
home.packages = lib.mkDefault (with pkgs; [
font-awesome
]);
}

View File

@@ -0,0 +1,2 @@
@define-color foreground #cdd6f4;
@define-color background #181824;

View File

@@ -0,0 +1,2 @@
@define-color foreground #d6e2ee;
@define-color background #213442;

View File

@@ -0,0 +1,3 @@
@define-color bg #00172e;
@define-color foreground #f6dcac;
@define-color background alpha(@bg, 0.8);

View File

@@ -0,0 +1,122 @@
{
"margin-top": 0,
"margin-left": 120,
"margin-bottom": 0,
"margin-right": 120,
"height": 61,
"layer": "top",
"position": "top",
"spacing": 15,
"modules-left": ["custom/launcher", "clock", "clock#date"],
"modules-center": ["hyprland/workspaces"],
"modules-right": ["idle_inhibitor", "pulseaudio", "custom/battery", "backlight", "tray", "custom/powermenu"],
"hyprland/workspaces": {
"disable-scroll": true,
"all-outputs": true,
"on-click": "activate",
"on-scroll-up": "hyprctl dispatch workspace r+1",
"on-scroll-down": "hyprctl dispatch workspace r-1",
"persistent_workspaces": {
"1": [],
"2": [],
"3": [],
"4": [],
"5": [],
"6": [],
"7": [],
"8": [],
"9": [],
"10": []
}
},
"tray": {
"icon-size": 20,
"spacing": 5
},
"custom/launcher": {
"interval": "once",
"format": "",
"on-click": "pkill rofi || rofi -show drun",
"tooltip-format": "Application Launcher"
},
"backlight": {
"max-length": "4",
"format": "{icon} {percent}%",
"tooltip-format": "{percent}%",
"format-icons": ["󱩎","󱩏","󱩐","󱩑", "󱩓", "󱩔", "󰛨"],
"on-click": "",
"on-scroll-up": "brightnessctl set 10%-",
"on-scroll-down": "brightnessctl set +10%"
},
"memory": {
"interval": 30,
"format": " {}%",
"format-alt":" {used:0.1f}G",
"max-length": 10
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": " 󰅶 ",
"deactivated": " 󰾪 "
}
},
"pulseaudio": {
"scroll-step": 5,
"format": "{icon} {volume}%",
"format-bluetooth": "{icon} {volume}%",
"format-bluetooth-muted": " {icon}",
"format-muted": " muted",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
"on-click": "mute-vol",
"on-click-middle": "audio-menu",
"on-click-right": "pavucontrol",
"tooltip-format": "{icon} {desc} | {volume}%"
},
"network": {
"format-wifi": " {signalStrength}%",
"format-ethernet": " {signalStrength}%",
"format-disconnected": "󰤭",
"on-click": ""
},
"custom/battery": {
"interval": 30,
"format": "{}",
"exec": "waybar-battery-status",
"on-click": "power-menu"
},
"clock": {
"format": " {:%H:%M}",
"tooltip": false
},
"clock#date": {
"format": " {:%A, %B %d, %Y}",
"on-click": "kitty calcurse",
"tooltip-format": "Open calendar"
},
"custom/powermenu": {
"format": "",
"on-click": "wlogout",
"tooltip": false
}
}

View File

@@ -0,0 +1,122 @@
@define-color bg_dim #232a2e;
@define-color bg0 #2d353b;
@define-color bg1 #343f44;
@define-color bg2 #3d484d;
@define-color bg3 #475258;
@define-color bg4 #4f585e;
@define-color bg5 #56635f;
@define-color bg_visual #543a48;
@define-color bg_red #514045;
@define-color bg_green #425047;
@define-color bg_blue #3a515d;
@define-color bg_yellow #4d4c43;
@define-color fg #d3c6aa;
@define-color red #e67e80;
@define-color orange #e69875;
@define-color yellow #dbbc7f;
@define-color green #a7c080;
@define-color aqua #83c092;
@define-color blue #7fbbb3;
@define-color purple #d699b6;
@define-color grey0 #7a8478;
@define-color grey1 #859289;
@define-color grey2 #9da9a0;
/* margin: top right bottom left */
/* Spacing outside the element */
/* padding: top right bottom left */
/* Spacing inside the element */
* {
font-family: JetBrainsMono Nerd Font, FontAwesome;
font-size: 13px;
font-weight: bold;
}
window#waybar {
background-color: @fg;
color: @bg0;
transition-property: background-color;
transition-duration: 0.5s;
border-radius: 0px 0px 15px 15px;
transition-duration: .5s;
border-bottom-width: 5px;
border-bottom-color: #7d6a40;
border-bottom-style: solid;
}
#backlight,
#tray,
#custom-launcher,
#clock,
#clock-date,
#workspaces,
#pulseaudio,
#idle_inhibitor,
#custom-battery,
#custom-powermenu {
background-color: @bg0;
color: @fg;
padding-left: 10px;
padding-right: 10px;
margin-top: 7px;
margin-bottom: 12px;
border-radius: 10px;
border-bottom-width: 5px;
border-bottom-color: #161a1d;
border-bottom-style: solid;
}
#tray > .active {
color: @fg;
}
#tray > .needs-attention {
color: @green;
}
#workspaces {
padding: 0px;
}
#workspaces button.active {
background-color: @blue;
color: @bg0;
border-radius: 10px;
margin-bottom: -5px;
border-bottom-width: 5px;
border-bottom-color: #366660;
border-bottom-style: solid;
}
#custom-launcher {
background-color: @green;
color: @bg0;
border-bottom-color: #556a35;
margin-left: 15px;
padding-left: 20px;
padding-right: 21px;
font-size: 20px;
}
#custom-powermenu {
background-color: @red;
color: @bg0;
border-bottom-color: #951c1f;
margin-right: 15px;
padding-left: 20px;
padding-right: 23px;
}
#custom-battery.preservation {
color: @green;
}
#idle_inhibitor {
padding-left: 10px;
padding-right: 10px;
font-size: 20px;
}