working on eww

This commit is contained in:
2026-03-11 16:02:26 +01:00
parent f33211449f
commit 9e01d35ce4
9 changed files with 1038 additions and 330 deletions
+393 -330
View File
File diff suppressed because it is too large Load Diff
+48
View File
@@ -821,6 +821,8 @@ This is top file of this level which contains just an import statement for all r
{
imports = [
./wayland.nix
./eww.nix
# ./waybar.nix
./login-tuigreeter.nix
# ./login-lightdm.nix
];
@@ -828,6 +830,52 @@ This is top file of this level which contains just an import statement for all r
}
#+END_SRC
** =generated/system/core/eww.nix=
This file installs and configures eww
#+BEGIN_SRC nix :tangle generated/system/core/eww.nix :noweb tangle :mkdirp yes :eval never-html
{ lib, config, pkgs, flakeRoot, user, ... }:
let
ewwConfigDir = "${config.home-manager.users.${user.username}.xdg.configHome}/eww";
# Dynamically read all files in assets/system/conf/eww/
ewwConfs = lib.genAttrs (builtins.attrNames (builtins.readDir "${flakeRoot}/assets/system/conf/eww")) (name: {
text = builtins.readFile "${flakeRoot}/assets/system/conf/eww/${name}";
});
in
{
environment.systemPackages = with pkgs; [ eww ];
home-manager.users.${user.username} = {
home.file = {
"${ewwConfigDir}" = {
source = "${flakeRoot}/assets/system/conf/eww";
recursive = true;
};
};
home.sessionVariables = {
EWW_BIN = "${pkgs.eww}/bin/eww";
};
# Start eww with Hyprland/MangoWC
wayland.windowManager.hyprland.settings = lib.mkForce {
exec-once = [ "eww daemon" ];
exec = [ "eww open-many ${ewwConfigDir}/widgets" ]; # Adjust as needed
};
# For MangoWC, use:
# wayland.windowManager.mangowc.config = {
# exec = [ "eww daemon" ];
# exec-once = [ "eww open-many ${ewwConfigDir}/widgets" ];
# };
};
}
#+END_SRC
** =generated/system/core/waybar.nix=
This file installs and configures waybar
#+BEGIN_SRC nix :tangle generated/system/core/waybar.nix :noweb tangle :mkdirp yes :eval never-html
#+END_SRC
** =generated/system/core/login-tuigreeter.nix=
This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder
#+BEGIN_SRC nix :tangle generated/system/core/login-tuigreeter.nix :noweb tangle :mkdirp yes :eval never-html
+90
View File
@@ -0,0 +1,90 @@
(defvar colors
@(eww -c
(defvar base "#1E1E2E")
(defvar text "#CDD6F4")
(defvar lavender "#B4BEFE")
(defvar blue "#89B4FA")
(defvar green "#A6E3A1")
(defvar yellow "#F9E2AF")
(defvar red "#F38BA8")
(defvar surface0 "#313244")
(defvar surface1 "#45475A")
)
)
;; Main bar widget
(defwidget bar []
(box :class "bar" :orientation "h" :space-evenly false
;; Left: Workspaces (Hyprland)
(box :class "workspaces" :orientation "h"
(label :class "workspace" :id "workspace_1" :text "1")
(label :class "workspace" :id "workspace_2" :text "2")
(label :class "workspace" :id "workspace_3" :text "3")
(label :class "workspace" :id "workspace_4" :text "4")
(label :class "workspace" :id "workspace_5" :text "5")
)
;; Center: Empty (placeholder for alignment)
(box :halign "center" :hexpand true)
;; Right: System modules
(box :class "right-items" :orientation "h" :spacing 8
;; Idle inhibitor
(button :class "idle-inhibitor" :onclick "eww update idle_inhibitor_icon=' '; notify-send 'Idle inhibitor' 'Activated'"
:label (label :id "idle_inhibitor_icon" :text "󰒲"))
;; PulseAudio
(button :class "pulseaudio" :onclick "pavucontrol"
:label (label :id "pulseaudio_label" :text " 100%"))
;; Network
(button :class "network" :onclick "impala" :onclick-right "nm-connection-editor"
:label (label :id "network_label" :text "Disconnected ⚠"))
;; Battery
(button :class "battery" :label (label :id "battery_label" :text "100% 󰂄"))
;; Tray placeholder (requires external tray like waybar-tray)
(box :class "tray" :orientation "h" :spacing 4
(label :text "Tray"))
;; Clock
(button :class "clock" :onclick "flatpak run eu.betterbird.Betterbird -calendar"
:label (label :id "clock_label" :text "Mon, 01 Jan 2024 - 12:00"))
)
)
)
;; Window definition
(defwindow bar-window
:geometry (geometry :x 0 :y 0 :width 1920 :height 34 :anchor "top left")
:layer "top"
:exclusivity "ignore"
(bar)
)
;; Scripts to update dynamic content
(defpoll [1000] ;; Update every second
;; Update PulseAudio volume
(setq pulseaudio-volume (exec "pamixer --get-volume"))
(setq pulseaudio-muted (exec "pamixer --get-mute"))
(if (= pulseaudio-muted "true")
(eww update pulseaudio_label="")
(eww update pulseaudio_label=(strfmt "{}% {}" pulseaudio-volume (if (> (string->number pulseaudio-volume) 50) "" "")))
;; Update network status
(setq network-essid (exec "nmcli -t -f TYPE,NAME dev status | awk -F: '/wifi/{print $2}' | xargs -I {} sh -c 'nmcli -t -f SIGNAL dev wifi list ifname {} | awk -F: \"NR==2{print \\$1}\"'"))
(if (string-empty? network-essid)
(eww update network_label="Disconnected ⚠")
(eww update network_label=(strfmt " ({}%)" network-essid)))
;; Update clock
(eww update clock_label=(strftime "%a, %d %b %Y - %H:%M"))
;; Update battery status
(setq battery-capacity (exec "cat /sys/class/power_supply/BAT0/capacity"))
(setq battery-status (exec "cat /sys/class/power_supply/BAT0/status"))
(if (string= battery-status "Charging")
(eww update battery_label=(strfmt "{}% 󰂄" battery-capacity))
(eww update battery_label=(strfmt "{}% 󰁹" battery-capacity)))
)
@@ -0,0 +1,130 @@
/* Catppuccin Mocha theme for EWW */
:root {
--base: #1e1e2e;
--mantle: #181825;
--crust: #11111b;
--text: #cdd6f4;
--subtext1: #bac2de;
--subtext0: #a6adc8;
--overlay2: #9399b2;
--overlay1: #7f849c;
--overlay0: #6c7086;
--surface2: #585b70;
--surface1: #45475a;
--surface0: #313244;
--lavender: #b4befe;
--blue: #89b4fa;
--sapphire: #74c7ec;
--teal: #94e2d5;
--green: #a6e3a1;
--yellow: #f9e2af;
--peach: #fab387;
--maroon: #eba0ac;
--red: #f38ba8;
--mauve: #cba6f7;
--pink: #f5c2e7;
--flamingo: #f2cdcd;
--rosewater: #f5e0dc;
}
* {
all: unset;
font-family: "JetBrainsMono Nerd Font", monospace;
font-size: 12px;
color: var(--text);
}
window {
background-color: rgba(30, 30, 46, 0.9); /* --base with transparency */
border-radius: 8px;
padding: 0;
margin: 0;
border: 1px solid var(--surface0);
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
box {
background-color: transparent;
padding: 4px 8px;
spacing: 8px;
}
label {
color: var(--text);
padding: 2px 6px;
}
button {
color: var(--text);
background-color: var(--surface1);
border-radius: 4px;
padding: 2px 8px;
transition: all 0.2s ease;
}
button:hover {
background-color: var(--surface2);
color: var(--lavender);
}
button:active {
background-color: var(--blue);
color: var(--crust);
}
/* Workspace buttons */
.workspace {
color: var(--subtext1);
background-color: transparent;
border-radius: 4px;
padding: 2px 8px;
margin: 0 2px;
}
.workspace.active {
background-color: var(--blue);
color: var(--base);
}
.workspace.urgent {
background-color: var(--red);
color: var(--crust);
}
.workspace.focused {
background-color: var(--lavender);
color: var(--base);
}
/* Clock */
#clock {
color: var(--peach);
padding: 2px 8px;
background-color: transparent;
}
/* System stats */
#cpu,
#ram,
#temp {
color: var(--green);
padding: 2px 8px;
background-color: transparent;
}
#volume {
color: var(--mauve);
}
#battery {
color: var(--green);
}
#battery.discharging {
color: var(--yellow);
}
#battery.critical {
color: var(--red);
}
+113
View File
@@ -0,0 +1,113 @@
{
"layer": "top",
"height": 34,
//"modules-left": ["hyprland/window"],
"modules-center": ["hyprland/workspaces" ],
"modules-right": [
"idle_inhibitor",
"pulseaudio",
"network",
// "cpu",
// "memory",
// "temperature",
"battery",
"tray",
"clock",
"custom/notifications",
],
/*
"custom/notifications": {
"tooltip": false,
"return-type": "json",
"exec-if": "which swaync-client",
"exec": "swaync-client -swb",
"format": "{icon}",
"format-icons": {
"notification": "",
"none": "",
"dnd-notification": "󰂠",
"dnd-none": "󰪓",
},
"on-click": "swaync-client -t",
"on-click-right": "swaync-client -d",
"on-click-middle": "swaync-client -dn",
},
*/
"idle_inhibitor": {
"tooltip": true,
"format": "{icon}",
"format-icons": {
"activated": "  ",
"deactivated": " 󰒲 ",
},
"tooltip-format-activated": "Staying awake",
"tooltip-format-deactivated": "Might sleep....",
},
"pulseaudio": {
"format": "{volume}% {icon}",
"format-bluetooth": "{volume}% {icon}",
"format-muted": "",
"format-icons": {
"headphones": "",
"headset": "",
"phone": "",
"portable": "",
"default": ["", ""],
},
"on-click": "pavucontrol",
},
"network": {
"format-wifi": " ({bandwidthDownBits})",
"format-ethernet": " ({bandwidthDownBits})",
"format-disconnected": "Disconnected ⚠",
"tooltip-format-wifi": "{essid} ({signalStrength}%)",
"tooltip-format-ethernet": "{ifname}: {ipaddr}/{cidr}",
"on-click": "impala",
"on-click-right": "nm-connection-editor",
},
"cpu": {
"format": "{usage}%  ",
"tooltip": false,
},
"memory": {
"format": "{percentage}%  ",
},
"temperature": {
"format": "{temperatureC}°C ",
"tooltip": false,
},
"tray": {
"spacing": 10,
"icon-size": 14,
},
"clock": {
"format": "{:%a, %d %b %Y - %H:%M}",
"tooltip": false,
"on-click": "flatpak run eu.betterbird.Betterbird -calendar",
},
"battery": {
"bat": "BAT0",
"states": {
"good": 95,
"warning": 30,
"critical": 15,
},
"format": "{capacity}% {icon}",
"format-charging": "{capacity}% 󰂄",
"format-plugged": "{capacity}%  ",
"format-icons": ["󰁺", "󰁼", "󰁾", "󰂀", "󱈏 "],
},
}
@@ -0,0 +1,225 @@
/* --- Hyprland palette (ported) --- */
@define-color base rgba(30, 30, 46, 1.0); /* 1e1e2eff */
@define-color inactive rgba(89, 89, 89, 0.667); /* 595959aa */
@define-color blue rgba(51, 204, 255, 0.933); /* 33ccffee */
@define-color green rgba(0, 255, 153, 0.933); /* 00ff99ee */
/* extra colors you referenced but didnt define */
@define-color text rgba(255, 255, 255, 1.0);
@define-color surface1 rgba(255, 255, 255, 0.08);
@define-color subtext1 rgba(255, 255, 255, 0.35);
@define-color red rgba(255, 0, 0, 0.90);
@define-color overlay1 rgba(255, 255, 255, 0.35);
@define-color yellow rgba(255, 215, 0, 0.95);
* {
font-family:
Aporetic Sans Mono,
Iosevka Nerd Font,
Roboto,
Helvetica,
Arial,
sans-serif;
font-size: 13px;
}
window#waybar {
background-color: transparent;
color: @text;
transition-property: background-color;
border-bottom: 0px solid rgba(0, 0, 0, 0);
transition-duration: 0.5s;
}
#workspaces button {
padding: 0px 1px;
min-width: 80px;
background-color: transparent;
color: @text;
border: 2px solid @inactive;
border-radius: 10px;
}
#custom-notifications.empty {
color: @overlay1;
}
#custom-notifications.unread {
color: @yellow;
}
#workspaces button:hover {
background-color: @surface1;
color: @text;
}
#workspaces button.active {
padding: 0px 1px;
min-width: 80px;
color: @text;
border-radius: 10px;
font-weight: bold;
border: 1px solid transparent;
background:
linear-gradient(rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.15))
padding-box,
linear-gradient(45deg, @blue, @green) border-box;
}
#custom-hyprscroll_overflow.overflow {
padding: 0px 1px;
min-width: 80px;
color: @text;
border-radius: 10px;
font-weight: bold;
border: 1px dashed transparent;
background:
linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05))
padding-box,
linear-gradient(45deg, @blue, @green) border-box;
}
#custom-hyprscroll_overflow.overflow {
background:
linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05))
padding-box,
linear-gradient(45deg, @blue, @green) border-box;
}
#custom-hyprscroll_overflow.hidden {
padding: 0;
margin: 0;
min-width: 0;
border: 0;
background: transparent;
opacity: 0;
}
#clock,
#idle_inhibitor,
#battery,
#cpu,
#memory,
#temperature,
#network,
#pulseaudio,
#tray {
margin: 0 5px;
padding: 0 2px;
}
#idle_inhibitor.activated {
background-color: @green;
}
#battery.charging {
color: @green;
}
@keyframes blink {
to {
background-color: #ffffff;
color: black;
}
}
#battery.warning:not(.charging) {
color: white;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#window,
#workspaces {
margin: 0 4px;
}
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
#network.disconnected {
background-color: @red;
}
#temperature.critical {
background-color: @red;
}
/* =========================================================
* Notifications
* ========================================================= */
#custom-notifications {
margin: 0 4px;
padding: 0 4px;
min-width: 0;
}
#custom-notifications.empty {
color: @overlay1;
}
#custom-notifications.unread {
color: @yellow;
}
/* =========================================================
* Hyprscroll overflow indicator (custom/hyprscroll_overflow)
* States: .ok, .overflow, .error
* ========================================================= */
/* Default (no overflow): subtle pill, still hoverable for tooltip */
#custom-hyprscroll_overflow.ok {
padding: 0px 1px;
min-width: 80px;
color: @subtext1;
border-radius: 10px;
/* subtle outline so you know it's there */
border: 1px solid rgba(255, 255, 255, 0.12);
background: rgba(255, 255, 255, 0.03);
}
/* Make it feel interactive (hover) */
#custom-hyprscroll_overflow.ok:hover {
color: @text;
background-color: @surface1;
border: 1px solid rgba(255, 255, 255, 0.18);
}
/* Overflow state: you already have this; keep it.
Optional: add hover tweak so it "pops" a bit. */
#custom-hyprscroll_overflow.overflow:hover {
background:
linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1))
padding-box,
linear-gradient(45deg, @blue, @green) border-box;
}
/* Error state: clear but not screaming */
#custom-hyprscroll_overflow.error {
padding: 0px 1px;
min-width: 80px;
color: @text;
border-radius: 10px;
border: 1px solid rgba(255, 0, 0, 0.55);
background: rgba(255, 0, 0, 0.15);
font-weight: bold;
}
/* Optional: if you keep .hidden in the script for any reason */
#custom-hyprscroll_overflow.hidden {
padding: 0;
margin: 0;
min-width: 0;
border: 0;
background: transparent;
opacity: 0;
}
+36
View File
@@ -0,0 +1,36 @@
{ lib, config, pkgs, flakeRoot, user, ... }:
let
ewwConfigDir = "${config.home-manager.users.${user.username}.xdg.configHome}/eww";
# Dynamically read all files in assets/system/conf/eww/
ewwConfs = lib.genAttrs (builtins.attrNames (builtins.readDir "${flakeRoot}/assets/system/conf/eww")) (name: {
text = builtins.readFile "${flakeRoot}/assets/system/conf/eww/${name}";
});
in
{
environment.systemPackages = with pkgs; [ eww ];
home-manager.users.${user.username} = {
home.file = {
"${ewwConfigDir}" = {
source = "${flakeRoot}/assets/system/conf/eww";
recursive = true;
};
};
home.sessionVariables = {
EWW_BIN = "${pkgs.eww}/bin/eww";
};
# Start eww with Hyprland/MangoWC
wayland.windowManager.hyprland.settings = lib.mkForce {
exec-once = [ "eww daemon" ];
exec = [ "eww open-many ${ewwConfigDir}/widgets" ]; # Adjust as needed
};
# For MangoWC, use:
# wayland.windowManager.mangowc.config = {
# exec = [ "eww daemon" ];
# exec-once = [ "eww open-many ${ewwConfigDir}/widgets" ];
# };
};
}
+2
View File
@@ -2,6 +2,8 @@
{
imports = [
./wayland.nix
./eww.nix
# ./waybar.nix
./login-tuigreeter.nix
# ./login-lightdm.nix
];
@@ -0,0 +1 @@