Replacing waybar with eww

This commit is contained in:
Emmet
2025-01-25 17:54:53 -06:00
parent 238b1987c1
commit 2b5c68a6c6
3 changed files with 178 additions and 4 deletions

View File

@@ -0,0 +1,78 @@
.bar {
border-radius: 10px;
background: rgba({{base00-rgb-r}},{{base00-rgb-g}},{{base00-rgb-b}},0.35);
font-size: 18px;
}
.button {
background: rgba(0,0,0,0.0);
}
.active-workspace {
color: #{{base07-hex}};
background: rgba(0,0,0,0.0);
margin-right: -30px;
margin-left: -30px;
}
.inactive-workspace {
color: #{{base03-hex}};
background: rgba(0,0,0,0.0);
}
.inactive-workspace:hover {
color: #{{base0A-hex}};
}
.calendar_window {
background: rgba({{base01-rgb-r}},{{base01-rgb-g}},{{base01-rgb-b}},0.65);
font-size: 1.2em;
padding: 12px;
border-radius: 10px;
border-width: 0px;
}
.calendar_window:selected {
background: #{{base08-hex}};
}
.calendar_window.header {
background: rgba(0,0,0,0.0);
}
.time-box {
background: rgba(0,0,0,0.0);
margin-right: 5px;
}
.time-box:hover {
}
progressbar trough {
min-width: 30px;
background: #{{base05-hex}};
}
progressbar trough progress {
background: #{{base07-hex}};
}
.battery-text-normal {
color: #{{base07-hex}};
font-size: 10px;
}
.battery-text-danger {
color: #{{base08-hex}};
font-size: 10px;
}
.battery-icon-normal {
color: #{{base07-hex}};
font-size: 20px;
}
.battery-icon-danger {
color: #{{base08-hex}};
font-size: 20px;
}

View File

@@ -0,0 +1,72 @@
(defwindow bar [?monitor]
:monitor monitor
:geometry (geometry :x "0%"
:y "1%"
:width "99%"
:height "30px"
:anchor "top center")
:stacking "fg"
:reserve (struts :distance "5px" :side "top")
:windowtype "dock"
:wm-ignore false
:exclusive true
(bar-widget :monitor monitor))
(defvar workspaces "[1, 2, 3, 4, 5, 6, 7, 8, 9]")
(defvar workspacesreplace "[\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"]")
(defpoll workspaces-monitor-0 :interval "1s" "workspace-on-monitor 0")
(defpoll workspaces-monitor-1 :interval "1s" "workspace-on-monitor 1")
(defpoll workspaces-monitor-2 :interval "1s" "workspace-on-monitor 2")
(defvar maxbattery 80)
(defvar batteryicons "[\"\", \"\", \"\", \"\", \"\"]")
(defwidget bar-widget [?monitor]
(box :halign "expand"
(box :orientation "horizontal"
:halign "start"
:class "center-box"
(box :orientation "horizontal"
:spacing "10"
:halign "center"
:valign "center"
(label :text "")
(label :halign "center" :valign "center" :text {EWW_BATTERY.total_avg / maxbattery > 0.8 ? batteryicons[4] : EWW_BATTERY.total_avg / maxbattery > 0.6 ? batteryicons[3] : EWW_BATTERY.total_avg / maxbattery > 0.4 ? batteryicons[2] : EWW_BATTERY.total_avg / maxbattery > 0.2 ? batteryicons[1] : batteryicons[0]} :class {EWW_BATTERY.total_avg / maxbattery > 0.2 ? "battery-icon-normal" : "battery-icon-danger"})
(label :halign "center" :valign "center" :text "${round(EWW_BATTERY.total_avg,0)}%" :class {EWW_BATTERY.total_avg / maxbattery > 0.2 ? "battery-text-normal" : "battery-text-danger"})
)
)
(box :orientation "horizontal"
:spacing "-8"
:halign "center"
:class "center-box"
(for workspace in workspaces
(box :orientation "horizontal"
:halign "center"
:class "center-box"
(button :class {
monitor == 0 ? workspace == workspaces-monitor-0 ? "active-workspace" : "inactive-workspace" :
monitor == 1 ? workspace == workspaces-monitor-1 ? "active-workspace" : "inactive-workspace" : monitor == 2 ? workspace == workspaces-monitor-2 ? "active-workspace" : "inactive-workspace" : "inactive-workspace"} :onclick "hyprctl dispatch focusworkspaceoncurrentmonitor ${workspace}" {workspacesreplace[workspace - 1]})
)))
(box :orientation "horizontal"
:halign "end"
:class "center-box"
:spacing "5"
(button :onclick "eww open --toggle calendar_window --arg monitor=${monitor}" :class "time-box" :halign "end" time)
(systray :class "time-box" :icon-size "20" :spacing "2" :halign "end")
)))
(defvar time-visible false)
(defpoll time :interval "1s"
:initial "initial-value"
:run-while time-visible
`date +%H:%M:%S`)
(defwindow calendar_window [?monitor]
:monitor monitor
:geometry (geometry :width "500px" :height "500px" :x "1410" :y "1%")
:stacking "overlay"
:focusable false
:hexpand true
:vexpand true
:namespace "eww"
(calendar :show-details true))

View File

@@ -58,7 +58,8 @@ in
exec-once = blueman-applet
exec-once = GOMAXPROCS=1 syncthing --no-browser
exec-once = protonmail-bridge --noninteractive
exec-once = waybar
#exec-once = waybar
exec-once = eww open-many bar:first bar:second bar:third --arg first:monitor=0 --arg second:monitor=1 --arg third:monitor=2
exec-once = emacs --daemon
exec-once = hypridle
@@ -333,12 +334,19 @@ in
windowrulev2 = opacity 0.85,initialTitle:^(Notes)$,initialClass:^(Brave-browser)$
layerrule = blur,waybar
layerrule = xray,waybar
layerrule = xray 1,waybar
blurls = waybar
layerrule = ignorezero, eww
layerrule = xray 1,eww
layerrule = blur,launcher # fuzzel
blurls = launcher # fuzzel
layerrule = blur,gtk-layer-shell
layerrule = xray,gtk-layer-shell
layerrule = xray 1,gtk-layer-shell
layerrule = ignorezero, gtk-layer-shell
layerrule = blur,eww
layerrule = xray 1,eww
layerrule = ignorezero, eww
layerrule = animation popin 80%, eww
blurls = gtk-layer-shell
layerrule = blur,~nwggrid
layerrule = xray 1,~nwggrid
@@ -420,6 +428,7 @@ in
feh
killall
polkit_gnome
eww
nwg-launchers
papirus-icon-theme
(pkgs.writeScriptBin "nwggrid-wrapper" ''
@@ -469,6 +478,10 @@ in
pavucontrol
pamixer
tesseract4
(pkgs.writeScriptBin "workspace-on-monitor" ''
#!/bin/sh
hyprctl monitors -j | jq ".[$1] | .activeWorkspace.id"
'')
(pkgs.writeScriptBin "screenshot-ocr" ''
#!/bin/sh
imgname="/tmp/screenshot-ocr-$(date +%Y%m%d%H%M%S).png"
@@ -619,8 +632,19 @@ in
'';
services.swayosd.enable = true;
services.swayosd.topMargin = 0.5;
programs.waybar = {
services.cbatticon = {
enable = true;
iconType = "symbolic";
};
home.file.".config/eww/eww.yuck".source = ./eww/eww.yuck;
home.file = {
".config/eww/eww.scss".source = config.lib.stylix.colors {
template = builtins.readFile ./eww/eww.scss.mustache;
extension = ".scss";
};
};
programs.waybar = {
enable = false;
package = pkgs.waybar.overrideAttrs (oldAttrs: {
postPatch = ''
# use hyprctl to switch workspaces