diff --git a/.config/eww/bars/horizontal-bspwm/eww.yuck b/.config/eww/bars/horizontal-bspwm/eww.yuck new file mode 100644 index 0000000..cdf5084 --- /dev/null +++ b/.config/eww/bars/horizontal-bspwm/eww.yuck @@ -0,0 +1,207 @@ +(defwindow horizontal-bspwm + :monitor 0 + :geometry (geometry :x "6px" + :y "6px" + :width "99.4%" + :height "40px" + :anchor "top left") + :stacking "fg" + :reserve (struts :distance "46px" :side "top") + :windowtype "normal" + :focusable true + :hexpand false + (centerbox + :class 'opaque bar ${binding_state.change}' + :space-evenly "false" + :visible {window.container.fullscreen_mode == 0} + :orientation 'h' + (h-top) + (empty) + (h-bottom) + ) +) + +(defpoll current-desktop + :interval "0.2s" + `bspc query -T --desktop`) + +(defwidget h-bottom [] + (box + + :orientation "h" + :halign "center" + :spacing 5 + :space-evenly "false" + :halign "end" + (h-widgets) + (h-times) + )) + +(defwidget h-top [] + (box + :space-evenly "false" + :spacing 10 + (h-workspaces) + (h-circles) + (tomato) + ) + ) + +(defwidget h-circles [] + (box + :orientation "h" + :spacing 10 + (circle-widget + :value {EWW_CPU.avg} + :class "cpu" + :name "CPU" + :icon "󰻠" + ) + (circle-widget + :value {EWW_RAM.used_mem_perc} + :class "ram" + :name "RAM" + :icon "󰘚") + (circle-widget + :value {EWW_DISK["/"].used_perc} + :class "disk" + :name "Disk" + :icon "󰋊" + ) + ) +) + +(defwidget tomato [] + (box + :class "tomato" + :valign "center" + :orientation "h" + {tomato-time} + ) + ) + +(defwidget h-workspaces [] + (box :class "h-workspaces" + :orientation "h" + :valign "center" + :halign "start" + (for ws in shown_workspaces + (button + :class {ws == current-desktop.name ? "active" : ""} + :onclick "bspc desktop -f ${ws}" + ) + ) + ) +) + +(defwidget h-widgets [] + (box :class "h-widgets" + :orientation "h" + :valign "center" + :spacing 20 + :halign "start" + :space-evenly "false" + (h-volume) + (h-brightness) + (h-bat) + (h-wifi) + )) + +(defwidget h-wifi [] + (box + :class "wifi widget" + :halign "center" + :tooltip `${wifi-name}` + `${wifi-icon}` + ) +) + +(defwidget h-bat [] + (box + :class "bat widget" + :tooltip `Battery: ${battery_per}%` + :valign "center" + :spacing 5 + :space-evenly "false" + {battery_icon} + (progress + :value {battery_per} + :orientation "h" + :valign "center" + ) + ) +) + + +(defwidget h-times [] + (box :class "h-time" + :orientation "h" + :valign "center" + :spacing 2 + :halign "end" + :tooltip {date} + (label :text {hour}) + (label :text {minute}) + (label :text {second}) + ) +) + + +(defwidget h-brightness [] + (box + :class "bright widget" + :orientation "h" + :spacing 5 + :space-evenly "false" + (label :text "") + (scale + :class "volbar" + :value {brightness} + :orientation "h" + :min 0 + :max 101 + :onchange "brightnessctl set {}%" + ) + ) +) + +(defwidget h-volume [] + (box + :class "vol widget" + :spacing 5 + :orientation "h" + :space-evenly "false" + (label :text "") + (scale + :class "vol scale" + :value {volume} + :orientation "h" + :min 0 + :max 101 + :onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%" + ) + ) + ) + +(defwidget circle-widget [value class name icon] + (overlay + :class {class} + :tooltip `${name} Usage: ${round(value,1)}%` + (circular-progress + :value {value} + :class "circle" + :thickness 4 + :start-at 25 + :height 30 + :width 30 + ) + (label :text {icon}) + ) + ) + + +(defwidget debug [] + (box + (label :text ``) + ) + ) diff --git a/.config/eww/bars/horizontal/eww.css b/.config/eww/bars/horizontal/eww.css index abe68a7..7d6c06e 100644 --- a/.config/eww/bars/horizontal/eww.css +++ b/.config/eww/bars/horizontal/eww.css @@ -14,6 +14,7 @@ } .h-time { min-width: 75px; + font-size: 14px; } .h-workspaces button { background-color: rgba(0, 0, 0, 0); @@ -79,6 +80,10 @@ progressbar trough progress { .vol { color: #74c7ec; } + +scale trough highlight { + background-color: #74c7ec; +} .vol scale trough highlight { background-color: #74c7ec; } diff --git a/.config/eww/bars/horizontal/eww.yuck b/.config/eww/bars/horizontal/eww.yuck index c9e407e..8b85651 100644 --- a/.config/eww/bars/horizontal/eww.yuck +++ b/.config/eww/bars/horizontal/eww.yuck @@ -6,10 +6,10 @@ :height "40px" :anchor "top left") :stacking "fg" - :reserve (struts :distance "40px" :side "top") + :reserve (struts :distance "46px" :side "top") :windowtype "dock" + :wm-ignore true :focusable false - :wm-ignore true :hexpand false (centerbox :class 'opaque bar ${binding_state.change}' @@ -41,7 +41,6 @@ (h-workspaces) (h-circles) (tomato) - (spotifyd) ) ) @@ -49,17 +48,17 @@ (box :orientation "h" :spacing 10 - (circle-widget - :value {EWW_RAM.used_mem_perc} - :class "ram" - :name "RAM" - :icon "󰘚") (circle-widget :value {EWW_CPU.avg} :class "cpu" :name "CPU" :icon "󰻠" ) + (circle-widget + :value {EWW_RAM.used_mem_perc} + :class "ram" + :name "RAM" + :icon "󰘚") (circle-widget :value {EWW_DISK["/"].used_perc} :class "disk" @@ -78,15 +77,6 @@ ) ) -(defwidget spotifyd [] - (box - :class "np" - :valign "center" - :orientation "h" - {spotifyd-playing == "Playing" ? spotifyd-music : ""} - ) - ) - (defwidget h-workspaces [] (box :class "h-workspaces" :orientation "h" diff --git a/.config/eww/bars/vertical/eww.yuck b/.config/eww/bars/vertical/eww.yuck index c48255e..ce8926d 100644 --- a/.config/eww/bars/vertical/eww.yuck +++ b/.config/eww/bars/vertical/eww.yuck @@ -6,10 +6,9 @@ :height "50%" :anchor "center left") :stacking "fg" - :reserve (struts :distance "40px" :side "top") + :reserve (struts :distance "40px" :side "left") :windowtype "dock" :focusable false - :wm-ignore true (centerbox :class 'opaque bar ${binding_state.change}' :orientation 'v' diff --git a/.config/eww/bars/wayland/eww.css b/.config/eww/bars/wayland/eww.css new file mode 100644 index 0000000..1e4f2ca --- /dev/null +++ b/.config/eww/bars/wayland/eww.css @@ -0,0 +1,4 @@ +.client { + background-color: #313244; + border-radius: 6px; +} diff --git a/.config/eww/bars/wayland/eww.yuck b/.config/eww/bars/wayland/eww.yuck new file mode 100644 index 0000000..2eccce7 --- /dev/null +++ b/.config/eww/bars/wayland/eww.yuck @@ -0,0 +1,114 @@ +(defpoll hyprmonitor :interval "0.2s" "hyprctl -j monitors") +(defpoll hyprclients :interval "0.3s" "hyprctl -j clients") + +(defwindow wayland + :monitor 0 + :geometry (geometry :x "0px" + :y "6px" + :width "99.4%" + :height "40px" + :anchor "top center") + :stacking "fg" + :exclusive true + :focusable false + :hexpand false + (centerbox + :class 'opaque bar ${binding_state.change}' + :space-evenly "false" + :visible {window.container.fullscreen_mode == 0} + :orientation 'h' + (hyprtop) + (empty) + (hyprbottom) + ) +) + +(defwidget hyprtop [] (box + :halign "start" + :space-evenly "false" + :spacing 10 + (h-workspaces) + (h-circles) + ) +) +(defwidget hyprbottom [] (box + :space-evenly "false" + :spacing 10 + :halign "end" + (h-volume) + (h-brightness) + (h-bat) + (h-wifi) + (h-times) + ) + ) +(defwidget clients [] (box + (box + (for data in hyprclients + (client :data data) + ) + ) + ) +) + +(defwidget client [data] (box + :visible "${data.monitor == 0}" + :height 40 + :width 40 + :class "" + "${data.class}")) + + +(defwidget h-workspaces [] + (box :class "h-workspaces" + :orientation "h" + :valign "center" + :halign "start" + (for ws in shown_workspaces + (button + :class {ws == hyprmonitor[0].activeWorkspace.id ? "active" : ""} + :onclick "hyprctl dispatch workspace ${ws}" + ) + ) + ) +) + +(defwidget hyprcircles [] + (box + :orientation "h" + :spacing 10 + (hyprcircle + :value {EWW_CPU.avg} + :class "cpu" + :name "CPU" + :icon "󰻠" + ) + (hyprcircle + :value {EWW_RAM.used_mem_perc} + :class "ram" + :name "RAM" + :icon "󰘚") + (hyprcircle + :value {EWW_DISK["/"].used_perc} + :class "disk" + :name "Disk" + :icon "󰋊" + ) + ) +) + +(defwidget hyprcircle [value class name icon] + (overlay + :class {class} + :tooltip `${name} Usage: ${round(value,1)}%` + (circular-progress + :value {value} + :class "circle" + :thickness 4 + :start-at 25 + :height 10 + :width 10 + ) + (label :text {icon}) + ) + ) diff --git a/.config/eww/cards/eww.css b/.config/eww/cards/eww.css new file mode 100644 index 0000000..e250f45 --- /dev/null +++ b/.config/eww/cards/eww.css @@ -0,0 +1,36 @@ +.card { + background-color: #1e1e2e; + border-radius: 8px; + padding: 10px; +} + +.album { + border-radius: 8px; +} +.duration { + font-family: "Jetbrains Mono NFM"; +} + +scale.songduration trough { + background-color: #313244; + min-height: 10px; + border-radius: 100px; + min-width: 400px; +} + +.title { + color: white; + font-weight: bold; + font-size: 16; +} +.artist { + color: white; + font-size: 16; +} + +.play, +.prev, +.next { + color: #cdd6f4; + font-size: 24px; +} diff --git a/.config/eww/cards/eww.yuck b/.config/eww/cards/eww.yuck new file mode 100644 index 0000000..1da8fd6 --- /dev/null +++ b/.config/eww/cards/eww.yuck @@ -0,0 +1,3 @@ +(include "cards/np/eww.yuck") + + diff --git a/.config/eww/cards/np/eww.yuck b/.config/eww/cards/np/eww.yuck index a541631..a7017ff 100644 --- a/.config/eww/cards/np/eww.yuck +++ b/.config/eww/cards/np/eww.yuck @@ -1,16 +1,103 @@ (defwindow np :monitor 0 - :geometry (geometry :x "-6px" - :y "-6px" - :width "100px" - :height "100px" - :anchor "bottom right") + :geometry (geometry :x "0px" + :y "6px" + :anchor "center top") :stacking "bg" - :windowtype "normal" - :wm-ignore false + :focusable false + :hexpand false (box - :class "bar" - :style "background: #2e2e2e" - (empty) + :width 550 + :height 150 + :valign "center" + :hexpand false + :space-evenly false + :class "card" + (box + :width 530 + :visible {playerstatus == "Stopped"} + (label :xalign 0.5 :text "Nothing is playing" ) + ) + (box + :space-evenly false + :spacing 10 + :visible {playerstatus != "Stopped"} + (controls) + (box + :space-evenly false + :spacing 15 + :orientation "v" + (data) + (playerprogress) + ) + ) + ) +) + +(defwidget controls [] + (box + :orientation "v" + (button + :onclick "playerctl previous" + (label :class "prev" :text "") + ) + (button + :onclick "playerctl play-pause" + (label :class "play" :text {playerstatus == "Playing" ? "" : ""}) + ) + (button + :onclick "playerctl next" + (label :class "next" :text "") + ) + ) + ) +;  + +(defwidget data [] + (box + :space-evenly false + :hexpand false + :orientation "h" + :spacing 10 + (image + :image-width 100 + :image-height 100 + :class "album" + :path "${albumart}" + ) + (box + :space-evenly false + :valign "center" + :halign "center" + :hexpand false + :orientation "v" + (label :limit-width 50 :xalign 0 :class "title" :text {title}) + (label :xalign 0 :class "artist" :text {artist}) + ) + ) + ) +(defwidget playerprogress [] + (box + :space-evenly false + :spacing 10 + :class "duration" + "${durposition}" + (scale + :min 0 + :class "songduration" + :value {position / 1000000} + :max {length / 1000000} + :onchange "playerctl position {}" ) + "${durlength}" ) +) + +(deflisten albumart :initial "" "scripts/art.sh") +(deflisten playerstatus :initial "Stopped" "playerctl --follow status" ) +(deflisten artist :initial "Artist" "playerctl --follow metadata --format '{{artist}}'" ) +(deflisten title :initial "Title" "playerctl --follow metadata --format '{{title}}'" ) +(deflisten length :initial "" "playerctl --follow metadata --format '{{mpris:length}}'" ) +(deflisten position :initial "" "playerctl --follow position --format '{{position}}'" ) +(deflisten durlength :initial "0:00" "playerctl --follow metadata --format '{{duration(mpris:length)}}'" ) +(deflisten durposition :initial "0:00" "playerctl --follow position --format '{{duration(position)}}'" ) diff --git a/.config/eww/eww.css b/.config/eww/eww.css index 7d6bdd4..9251e9b 100644 --- a/.config/eww/eww.css +++ b/.config/eww/eww.css @@ -2,6 +2,8 @@ @import "bars/center/eww.css"; @import "bars/vertical/eww.css"; @import "bars/horizontal/eww.css"; +@import "bars/wayland/eww.css"; +@import "cards/eww.css"; /* @import "catppuccin.css"; */ * { @@ -9,8 +11,9 @@ } .bar { - background-color: rgba(30, 30, 46, 0.8); + background-color: rgba(30, 30, 46, 0.7); transition: background-color 0.2s ease; + border-radius: 6px; } .bar.opaque { @@ -19,13 +22,13 @@ } .resize { - background-color: rgba(137, 220, 235, 0.8) + background-color: rgba(137, 220, 235, 0.8); } .bar.opaque.resize { - background-color: rgba(137, 220, 235, 1) + background-color: rgba(137, 220, 235, 1); } .volume { - padding: 20px + padding: 20px; } diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck index ce31ea2..0245565 100644 --- a/.config/eww/eww.yuck +++ b/.config/eww/eww.yuck @@ -3,7 +3,9 @@ (include 'bars/right-bat/eww.yuck') (include 'bars/vertical/eww.yuck') (include 'bars/horizontal/eww.yuck') -(include 'cards/np/eww.yuck') +(include 'bars/horizontal-bspwm/eww.yuck') +(include 'bars/wayland/eww.yuck') +(include 'cards/eww.yuck') ; Placeholder widget for centerboxes (defwidget empty [] @@ -70,10 +72,8 @@ (deflisten spotifyd-music :initial "" "playerctl --player=spotifyd --follow metadata --format '{{ artist }} - {{ title }}' || true") -(defpoll spotifyd-playing :interval "3s" "scripts/music.sh status") ;; (defpoll playpause :interval "5s" "scripts/music.sh statusicon") ;; (defpoll songtime :interval "1s" "scripts/getSongDuration") - (defpoll tomato-time :interval "1s" "tomato -t") diff --git a/.config/eww/scripts/art.sh b/.config/eww/scripts/art.sh new file mode 100755 index 0000000..67aebfe --- /dev/null +++ b/.config/eww/scripts/art.sh @@ -0,0 +1,7 @@ +COVER_URL="../album.png" + +playerctl --follow metadata mpris:artUrl | while read i +do + curl $i > "$COVER_URL.png" + echo "$COVER_URL.png" +done diff --git a/.config/eww/scripts/icon.sh b/.config/eww/scripts/icon.sh new file mode 100755 index 0000000..ce2dae8 --- /dev/null +++ b/.config/eww/scripts/icon.sh @@ -0,0 +1,7 @@ +#! /usr/bin/bash + +ICON_DIRECTORY="~/.local/share/icons/dracula-dark/scalable/apps" + +LC=$(echo "${1,,}") + +echo "$ICON_DIRECTORY/$LC.svg"