feat: EWW power menu

This commit is contained in:
Kiana Sheibani 2025-02-25 00:48:57 -05:00
parent 99d593dfe5
commit 7a4b7cd6cc
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
5 changed files with 110 additions and 65 deletions

View file

@ -9,6 +9,7 @@ $accent: #f6a8cf;
* {
all: unset;
font-family: "Quicksand Medium";
}
@mixin segment {
@ -19,18 +20,17 @@ $accent: #f6a8cf;
.bar {
background-color: $background;
font-family: "Quicksand Medium";
color: $foreground;
font-size: 13px;
padding: 3px 10px;
padding: 3px 0px;
}
tooltip {
background-color: rgba(0,0,0,0.8);
font-family: "JetBrains Mono";
font-size: 12px;
background-color: rgba(22, 16, 30, 0.9);
border-radius: 5px;
font-size: 13px;
}
.detail {
@ -45,7 +45,7 @@ tooltip {
}
.bar-window {
margin-left: 4px;
margin-left: 14px;
.detail {
margin-top: 1px;
@ -71,12 +71,9 @@ tooltip {
.bar-music {
@include segment;
padding-left: 3px;
padding-right: 10px;
padding: 0px 2px;
.progress {
margin-right: 5px;
.back {
color: $background-scale;
}
@ -86,6 +83,12 @@ tooltip {
}
}
.symbol.stopped {
font-size: 15px;
color: $foreground-alt;
margin-left: -2px;
}
.symbol.paused {
font-size: 12px;
margin-left: 2px;
@ -96,6 +99,11 @@ tooltip {
margin-top: 1px;
}
.bar-music-meta {
margin-left: 6px;
margin-right: 10px;
}
.bar-artist {
margin-top: 1px;
margin-bottom: -2px;
@ -247,12 +255,19 @@ scale trough {
}
}
.bar-idleinhibit {
margin-left: 3px;
margin-right: 4px;
color: $disabled;
.bar-power {
font-size: 18px;
margin-left: 4px;
margin-right: 10px;
color: #f7768e;
}
&.active {
color: #f7768e;
.power {
font-size: 36px;
button > box {
background-color: $background;
border-radius: 8px;
margin: 5px;
}
}

View file

@ -28,13 +28,13 @@
(defwidget bar_workspace_button [workspace]
(eventbox :onclick "hyprctl dispatch workspace ${workspace.id}"
(overlay
(box :class "segment workspace-button ${workspace.id == current_workspace ? "current" : ""
(box :class "workspace-button ${workspace.id == current_workspace ? "current" : ""
} ${workspace.windows > 0 ? "occupied" : "empty"
} ${workspace.previous > 0 ? "previous-occupied" : "previous-empty"
} ${workspace.next > 0 ? "next-occupied" : "next-empty"}"
(label :text "${workspace.id}"))
(label :text {workspace.id}))
(box :visible {workspace.id == current_workspace}
(label :text "${workspace.id}")))))
(label :text {workspace.id})))))
(defwidget bar_workspaces []
(eventbox :onscroll "scripts/change-active-workspace {} ${current_workspace}"
@ -66,20 +66,17 @@
(deflisten mpris :initial "{}"
"scripts/mpris-metadata")
(defwidget bar_music [width artist-limit title-limit]
(defwidget bar_music [artist-limit title-limit]
(eventbox :onclick "playerctl play-pause"
(box :class "bar-music segment"
(box :class "bar-music"
:orientation "h"
:width width
:space-evenly false
(box :class "progress"
(overlay
(circular-progress :class "back"
:value 100
:width 25
:thickness 2
:start-at 75
:clockwise true)
:thickness 2)
(circular-progress :class "front"
:value {(mpris.position ?: 0) == 0 ||
(mpris.duration ?: 0) == 0 ? 0 :
@ -89,19 +86,24 @@
:thickness 2
:start-at 75
:clockwise true)
(label :class "symbol ${mpris.status == "Playing" ? "playing" : "paused"}"
:text {mpris.status == "Playing" ? "󰏤" : ""})))
(box :orientation "v"
:space-evenly false
:visible {(mpris.title ?: "") != "" && (mpris.status ?: "Stopped") != "Stopped"}
(label :class "bar-artist detail"
:halign "start"
:limit-width artist-limit
:text {mpris.artist ?: ""})
(label :halign "bar-title"
:limit-width title-limit
:text {mpris.title ?: ""})))))
(label :class "symbol ${(mpris.title ?: "") == "" || (mpris.status ?: "Stopped") == "Stopped" ? "stopped" :
mpris.status == "Playing" ? "playing" : "paused"}"
:text {(mpris.title ?: "") == "" || (mpris.status ?: "Stopped") == "Stopped" ? "" :
mpris.status == "Playing" ? "󰏤" : ""})))
(revealer :transition "slideright"
:duration "800ms"
:reveal {(mpris.title ?: "") != "" && (mpris.status ?: "Stopped") != "Stopped"}
(box :orientation "v"
:class "bar-music-meta"
:space-evenly false
(label :class "bar-artist detail"
:halign "start"
:limit-width artist-limit
:text {mpris.artist ?: ""})
(label :class "bar-title"
:halign "start"
:limit-width title-limit
:text {mpris.title ?: ""}))))))
;; Scales (Volume + Brightness)
@ -222,21 +224,67 @@
:tooltip {ethernet != "{}" ? "${ethernet.name} (${ethernet.device})" :
wifi != "{}" ? "${wifi.name} (${wifi.device})" : ""}
(label :class "symbol"
:text {wifi != "{}" ? "󰤨" : ethernet != "{}" ? "󰈁" : "󰤮"})))
:text {wifi != "{}" ? "󰤨" : ethernet != "{}" ? "󰈀" : "󰤮"})))
(defwidget bar_bluetooth []
(box :class "bar-bluetooth ${bluetooth == "{}" ? "disabled" : ""}"
(label :text {bluetooth != "{}" ? "󰂯" : "󰂲"})))
;; Idle Inhibitor
;; Power Menu
(defpoll idleinhibit :interval "10s" :initial "0"
"pgrep -c -f wayland\"\"-idle-inhibitor || true")
(defwidget bar_idleinhibit []
(eventbox :onclick "scripts/toggle-idle-inhibit && ${EWW_CMD} poll idleinhibit"
(box :class "bar-idleinhibit ${idleinhibit > 0 ? "active" : ""}"
(label :text {idleinhibit > 0 ? "󰈈" : "󰛑"}))))
(defwidget bar_power []
(eventbox :onclick "${EWW_CMD} active-windows | grep -q power \
&& ${EWW_CMD} close power || ${EWW_CMD} open power"
(box :class "bar-power"
(label :text "⏻"))))
(defwindow power
:monitor 0
:geometry (geometry
:width "375px"
:height "150px"
:anchor "top right")
:namespace "eww-bar"
:stacking "fg"
:exclusive false
:focusable false
(eventbox :onhoverlost "${EWW_CMD} close power"
(box :class "power"
:orientation "v"
(box :orientation "h"
(button :onclick "systemctl suspend"
:tooltip "Sleep"
(box :style "color: #9aa5ce;"
(label :text "󰤄")))
(button :onclick "hyprlock --immediate &"
:tooltip "Lock"
(box :style "color: #cfc9c2;"
(label :text "")))
(button :onclick "hyprctl dispatch exit"
:tooltip "Log Out"
(box :style "color: #7dcfff; padding-left: 0.3ex;"
(label :text "")))
(button :onclick "reboot"
:tooltip "Reboot"
(box :style "color: #e0af68;"
(label :text "")))
(button :onclick "poweroff"
:tooltip "Shutdown"
(box :style "color: #f7768e; font-size: 1.35em; padding-bottom: 0.15ex;"
(label :text "⏼"))))
(box
:orientation "h"
(box) (box) (box) (box)
(button :onclick "scripts/toggle-idle-inhibit && ${EWW_CMD} poll idleinhibit"
:tooltip "Idle Inhibitor: ${idleinhibit > 0 ? "On" : "Off"}"
(box :style "padding-right: 0.5ex; ${idleinhibit > 0 ?
"color: #ff9e64" :
"color: #565f89; padding-top: 0.3ex;"}"
(label :text {idleinhibit > 0 ? "󰈈" : "󰛑"})))))))
;; Separator
@ -290,7 +338,7 @@
(bar_ram)
(bar_battery)
(bar_sep)
(bar_idleinhibit)))
(bar_power)))
(defwidget fire_bar_layout []
(centerbox :class "bar"
@ -366,7 +414,7 @@
(defwindow fire_bar
:monitor 0
:geometry (geometry :width "100%"
:height "3%"
:height "35px"
:anchor "top center")
:namespace "eww-bar"
:stacking "fg"
@ -377,7 +425,7 @@
(defwindow earth_bar
:monitor 0
:geometry (geometry :width "100%"
:height "3%"
:height "35px"
:anchor "top center")
:namespace "eww-bar"
:stacking "fg"

View file

@ -93,7 +93,6 @@ in {
bind = [
"$mod, Return, exec, $terminal"
"$mod, D, exec, $menu"
"$mod Shift, E, exec, ${scripts}/exit"
"$mod, M, exec, hyprlock --immediate"
# Emacs Everywhere

View file

@ -1,4 +0,0 @@
#!/usr/bin/env bash
pkill -0 swaynag || \
swaynag -t exit -m "Do you really want to exit?" \
-B "Reboot" "reboot" -B "Shutdown" "poweroff" -b "Exit" "hyprctl dispatch exit"

View file

@ -9,19 +9,6 @@
imv
];
xdg.configFile."swaynag/config".text = ''
font=JetBrainsMono 10
layer=top
[exit]
background=111320D0
text=a9b1d6
border-bottom=7BC5E4
border-bottom-size=1
button-background=282E49F0
button-border-size=2
'';
# Hyprlock
programs.hyprlock.enable = true;