added new widgets

This commit is contained in:
2025-03-08 17:44:11 +01:00
parent 6bab674c4d
commit e04868b5d0
15 changed files with 261 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
tooltip {
background: #2E3440;
color: #E5E6E7;
padding: 3px 1rem;
border-radius: 1.5rem 1rem;
border: 1px solid #6F7175;
}

View File

@@ -46,7 +46,8 @@
:space-evenly true
:spacing 5
:halign 'start'
(loremText :text "Workspaces")
(hypr_workspaces)
(hypr_active_window)
)
)
@@ -57,6 +58,7 @@
:space-evenly false
:spacing 5
(media)
(sysmon)
)
)
@@ -68,8 +70,10 @@
:spacing 5
:halign 'end'
(hyprsunset)
(volume)
(datetime)
(stray)
(swaync)
)
)

View File

@@ -0,0 +1,12 @@
#!/bin/sh
if command -v pamixer &>/dev/null; then
if [ true == $(pamixer --get-mute) ]; then
echo 0
exit
else
pamixer --get-volume
fi
else
amixer -D pulse sget Master | awk -F '[^0-9]+' '/Left:/{print $3}'
fi

View File

@@ -1,5 +1,10 @@
@import 'widgets/lorem-text';
@import 'widgets/media';
@import 'widgets/datetime.scss';
@import 'widgets/systray';
@import 'widgets/hyprsunset';
@import 'widgets/lorem-text';
@import 'widgets/hypr_activewindow.scss';
@import 'widgets/hypr_workspaces.scss';
@import 'widgets/sysmon.scss';
@import 'widgets/swaync.scss';
@import 'widgets/volume.scss';

View File

@@ -1,5 +1,10 @@
(include "widgets/lorem-text.yuck")
(include "widgets/media.yuck")
(include "widgets/datetime.yuck")
(include "widgets/systray.yuck")
(include "widgets/hyprsunset.yuck")
(include "widgets/lorem-text.yuck")
(include "widgets/hypr_workspaces.yuck")
(include "widgets/hypr_activewindow.yuck")
(include "widgets/sysmon.yuck")
(include "widgets/swaync.yuck")
(include "widgets/volume.yuck")

View File

@@ -0,0 +1,9 @@
.activewindow{
background: lightgreen;
color: black;
&--xwayland{
background: maroon;
color: white;
}
}

View File

@@ -0,0 +1,32 @@
(deflisten activewindow :initial "..." "hyprman -a 2>>/tmp/eww_hyprman_activewindow.log")
(defvar windowIcons
`{
"generic": "",
"spotify": "",
"mpv": "",
"firefox": "",
"chromium": "",
"zen": "",
"Alacritty": "",
"steam": "󰓓",
"discord": "󰙯"
}`)
(defwidget windowIcon []
(image
:icon-size: 12
:icon {activewindow.class}))
(defwidget hypr_active_window []
(tooltip
(label :text {activewindow.title})
(box
:class "activewindow${activewindow.xwayland == true ? '--xwayland' : ''}"
:halign "left"
:valign "center"
:spacing 3
(label
:limit-width 25
:unindent true
:text "${windowIcons[activewindow.class] ?: windowIcons['generic']} ${activewindow.class}"))))

View File

@@ -0,0 +1,35 @@
.workspaces {
/* Green */
$light: #bad012;
$dark: #53730a;
/* Orange */
//$light: #fde10e;
//$dark: #ff6520;
background: $dark;
padding: 3px 1rem;
&--ws {
border-radius: 50%;
font-family: 'Symbols Nerd Font Mono';
border: 1px solid blue;
color: black;
&--label {
font-size: 0.7rem;
}
&--active {
background: $light;
color: $dark;
border-color: $light;
}
&--inactive {
background: $dark;
color: $dark;
border-color: $light;
}
}
}

View File

@@ -0,0 +1,24 @@
(deflisten workspaces :initial "" "hyprman -w 2>>/tmp/eww_hyprman_workspaces.log")
(defvar workspaceIcons '{
"empty": "",
"full": "",
"focused": "󱓻"
}')
(defwidget hypr_workspaces []
(box
:class "workspaces"
:space-evenly false
:spacing 3
(for workspace in workspaces
(eventbox
:height 20
:width 20
:onclick "hyprctl dispatch workspace ${workspace.id}"
:cursor "pointer"
:tooltip "${workspace.name}"
:class "workspaces--ws ${workspace.active == true ? 'workspaces--ws--active' : 'workspaces--ws--inactive'}"
(label
:class "workspaces--ws--label"
:text "${workspace.windows > 0 ? workspaceIcons.full : workspaceIcons.empty}")))))

View File

@@ -0,0 +1,13 @@
.swaync{
background: aqua;
color: black;
&--dnd{
background: rosybrown;
color: black;
}
&--inhib{
background: indianred;
color: black;
}
}

View File

@@ -0,0 +1,19 @@
(deflisten notification :initial '{ "count": 0, "dnd": false, "visible": false, "inhibited": false }' "swaync-client -s")
(defvar swaync_icon_act "󰀠")
(defvar swaync_icon_inh "󰚎")
(defvar swaync_icon_dnd "󰀣")
(defwidget swaync []
(eventbox
:class "swaync${notification.dnd == true ? " swaync--dnd" : ""}${notification.inhibited == true ? " swaync--inhib" : ""}"
:cursor "pointer"
:onclick "swaync-client -t"
:onmiddleclick "swaync-client -d"
:onrightclick "swaync-client -C"
(box
:orientation "horizontal"
:spacing 3
:space-evenly false
(label :text "${notification.dnd == true ? swaync_icon_dnd : notification.inhibited == true ? swaync_icon_inh : swaync_icon_act}")
(label :text "${notification.count}"))))

View File

@@ -0,0 +1,19 @@
.sysmon{
background: transparent;
color: black;
}
.danger{
color: red
}
.ram{
background: tan;
}
.disk{
background: mediumturquoise;
}
.cpu{
background: lightgreen;
}
.net{
background: plum;
}

View File

@@ -0,0 +1,51 @@
(defvar netiface "eno1")
(defwidget sysmon []
(box
:class 'sysmon'
:space-evenly false
:spacing 1
(cpu)
(ram)
(disk)
(net)))
(defwidget ram []
(tooltip
:class 'ram ${EWW_RAM.used_mem_perc > 90 ? 'danger' : ''}'
(label :text " ${round(EWW_RAM.free_swap/1000000000, 2)} GB/${round(EWW_RAM.total_swap/1000000000, 2)} GB")
(label :text " ${round(EWW_RAM.used_mem/1000000000, 2)} GB/${round(EWW_RAM.total_mem/1000000000, 2)} GB")))
(defwidget disk []
(tooltip
:class 'disk ${EWW_DISK["/"].used_perc > 90 ? 'danger' : ''}'
(label :text " ${round(EWW_DISK["/"].free/1000000000, 2)} GB /${round(EWW_DISK["/"].total/1000000000, 2)} GB")
(label :text " ${round(EWW_DISK["/"].used_perc,2)}%")))
(defwidget cpu []
(tooltip
:class 'cpu'
(box :orientation "vertical"
(for cpu in {EWW_CPU.cores}
(box
:orientation "horizontal"
:space-evenly false
:spacing 10
(circular-progress
:thickness 5
:start-at 75
:value {cpu.usage})
(label
:limit-width 6
:show-truncated false
:text "${cpu.core}: ")
(label :text "${cpu.freq} Hz ${cpu.usage}%"))))
(label :text " ${round(EWW_CPU.avg, 2)}%")))
(defwidget net []
(box
:class 'net'
:space-evenly false
(label :text "")
(label :text " ${round(EWW_NET[netiface].NET_UP * 8 / 1000000, 2)} Mbit")
(label :text " ${round(EWW_NET[netiface].NET_DOWN * 8 / 1000000, 2)} Mbit")))

View File

@@ -0,0 +1,12 @@
.sourcevol{
background: steelblue;
color: black;
}
.sinkvol{
background: slateblue;
color: black;
}
.muted{
background: tomato;
color: white;
}

View File

@@ -0,0 +1,17 @@
(defpoll sourcevol :interval "1s" `wpctl get-volume @DEFAULT_SOURCE@ | awk -F ' ' '{print $2}'`)
(defpoll sourcemute :interval "1s" `wpctl get-volume @DEFAULT_SOURCE@ | awk -F ' ' '{print $3}'`)
(defpoll sinkvol :interval "200ms" `wpctl get-volume @DEFAULT_SINK@ | awk -F ' ' '{print $2}'`)
(defpoll sinkmute :interval "1s" `wpctl get-volume @DEFAULT_SINK@ | awk -F ' ' '{print $3}'`)
(defwidget volume []
(box
:space-evenly false
:spacing 3
(eventbox
:class "sourcevol${sourcemute == "[MUTED]" ? " muted" : ""}"
:onclick "wpctl set-mute @DEFAULT_SOURCE@ toggle"
(label :text "${sourcemute == "[MUTED]" ? "󰍭" : "󰍬"} ${sourcevol}"))
(eventbox
:class "sinkvol${sinkmute == "[MUTED]" ? " muted" : ""}"
:onclick "wpctl set-mute @DEFAULT_SINK@ toggle"
(label :text "${sinkmute == "[MUTED]" ? "󰟎" : "󰋋"} ${sinkvol}"))))