refactor: eww styles and widgets

This commit is contained in:
hesam-init 2024-07-03 17:02:28 +03:30
parent caf64be4bf
commit 8368678c3f
11 changed files with 175 additions and 184 deletions

View file

@ -80,7 +80,7 @@
;; (deflisten pside "playerctl -F metadata -f '{ \"volume\": {{volume*100}}, \"shuffle\": \"{{shuffle}}\", \"loop\": \"{{loop}}\" }'") ;; (deflisten pside "playerctl -F metadata -f '{ \"volume\": {{volume*100}}, \"shuffle\": \"{{shuffle}}\", \"loop\": \"{{loop}}\" }'")
; Controlpanel ; Controlpanel
(defvar revealControlpanel false) (defvar revealControlpanel true)
(defvar revealWeather false) (defvar revealWeather false)
(defpoll hostname :initial "idk" :interval "24h" 'echo "$(whoami)"') (defpoll hostname :initial "idk" :interval "24h" 'echo "$(whoami)"')
(defpoll uptime :initial "idk" :interval "1m" "uptime -p") (defpoll uptime :initial "idk" :interval "1m" "uptime -p")

View file

@ -6,18 +6,16 @@
@extend .widget; @extend .widget;
label { label {
@extend .icon;
color: $surface2; color: $surface2;
padding: 4px 0px; padding: 4px 0px;
} }
} }
.separator { .separator {
padding: get-token(padding, small); padding: 4px 8px;
.dot { .dot {
padding: 2px; padding: 3px;
border-radius: 100%; border-radius: 100%;
@ -51,9 +49,9 @@
.big-bar-slider { .big-bar-slider {
trough { trough {
background-color: $surface1;
margin: 5px;
min-width: 60px; min-width: 60px;
background-color: $surface1;
margin: get-token(margin);
border-radius: get-token(border-radius); border-radius: get-token(border-radius);
highlight { highlight {

View file

@ -4,7 +4,7 @@
.widget { .widget {
padding: get-token(padding, small); padding: get-token(padding, small);
margin: get-token(margin); margin: get-token(margin, small);
border-radius: get-token(border-radius, small); border-radius: get-token(border-radius, small);
background-color: $surface0; background-color: $surface0;
} }

View file

@ -2,7 +2,7 @@
@extend .widget; @extend .widget;
label { label {
font-size: get-token(font-sizes, large); font-size: 20px;
font-weight: bold; font-weight: bold;
} }
} }
@ -11,7 +11,7 @@
@extend .widget; @extend .widget;
label { label {
font-size: get-token(font-sizes); font-size: get-token(font-sizes, small);
font-weight: bold; font-weight: bold;
} }
} }
@ -36,10 +36,10 @@
padding: 12px; padding: 12px;
.workspace { .workspace {
@extend .animation;
min-height: 16px; min-height: 16px;
background-color: $surface2; background-color: $surface2;
border-radius: get-token(border-radius); border-radius: get-token(border-radius);
transition: all cubic-bezier(0.175, 0.885, 0.32, 1.275) 300ms;
&.current { &.current {
min-height: 42px; min-height: 42px;
@ -51,16 +51,12 @@
.bar-media-player { .bar-media-player {
@extend .widget; @extend .widget;
label {
font-size: get-token(font-sizes, large);
}
} }
.media-player { .media-player {
@extend .panel-widget; @extend .panel-widget;
padding: 0px; padding: 8px;
.player-cover { .player-cover {
transition: 600ms ease; transition: 600ms ease;

View file

@ -1,6 +1,6 @@
.control-panel { .control-panel {
padding: get-token(padding, small);
background-color: $base; background-color: $base;
padding: get-token(padding, small);
} }
.userinfo label { .userinfo label {

View file

@ -1,17 +1,19 @@
(defwidget VerticalBarSlider [var ?onchange] (defwidget VerticalBarSlider [var ?onchange ?visible]
(scale (scale
:value {var} :value {var}
:onchange {onchange} :onchange {onchange}
:class "vertical-bar-slider" :class "vertical-bar-slider"
:visible {visible}
:orientation "v" :orientation "v"
:tooltip "${var}%" :tooltip "${var}%"
:max 101 :max 101
:min 0 :min 0
:flipped true)) :flipped true))
(defwidget BigBarSlider [var ?icon ?onchange] (defwidget BigBarSlider [var ?icon ?onchange ?visible]
(box (box
:class "big-bar-slider" :class "big-bar-slider"
:visible {visible}
(overlay (overlay
(scale (scale

View file

@ -1,6 +1,7 @@
(defwidget SystemStatus [icon val] (defwidget SystemStatus [icon val ?visible]
(box (box
:class "system-status" :class "system-status"
:visible {visible}
(overlay (overlay
(circular-progress (circular-progress

View file

@ -22,17 +22,16 @@
(button :onclick "playerctl next" (button :onclick "playerctl next"
(label :class "icon" :text "󰒭"))))) (label :class "icon" :text "󰒭")))))
(defwidget MediaPlayer [h permashow] (defwidget MediaPlayer [height]
(box (box
:class "media-player" :class "media-player"
(overlay (overlay
(box (box
:orientation "v" :orientation "v"
:halign "fill" :halign "fill"
:height h :height {height}
:class { pcover != "" ? "player-cover" : ""} :class { pcover != "" ? "player-cover" : ""}
:style "background-image: url('${pcover}')" :style "background-image: url('${pcover}')")
:visible {permashow ? true : pcover != "" })
(box (box
:orientation "h" :orientation "h"

View file

@ -1,19 +1,17 @@
(defwidget ControlPanel [] (defwidget ControlPanel []
(box (box
:class "control-panel"
:space-evenly false
:orientation "v" :orientation "v"
:valign "fill" :space-evenly false
:vexpand true :class "control-panel"
:width 420
(User) (User)
(SystemMonitor) (SystemMonitor)
; (MediaPlayer :h 160 :permashow true) ; (MediaPlayer :height 140)
(box (box
:orientation "h" :orientation "h"
:space-evenly false
:height 180 :height 180
(Timer) (Timer)
@ -46,14 +44,14 @@
:orientation "h" :orientation "h"
:class "panel-widget" :class "panel-widget"
:height 140 :height 140
(SystemStatus :icon "󰻠" :val { EWW_CPU.avg }) (SystemStatus :icon "󰻠" :val { EWW_CPU.avg })
(SystemStatus :icon "󰍛" :val { EWW_RAM.used_mem_perc }) (SystemStatus :icon "󰍛" :val { EWW_RAM.used_mem_perc })
(SystemStatus :icon "󰈐" :val { gpu }) (SystemStatus :icon "󰈐" :val { gpu })
(SystemStatus :icon "" :val { EWW_BATTERY.BAT0.capacity }) (SystemStatus :icon "" :val { EWW_BATTERY.BAT0.capacity } :visible false)
)) ))
(defwidget User [] (defwidget User []
(box (box
:orientation "h" :orientation "h"
:space-evenly false :space-evenly false
@ -63,7 +61,8 @@
:valign "start" :valign "start"
:halign "fill" :halign "fill"
:hexpand true :hexpand true
(image :style "margin: 10px;" :image-width 80 :image-height 80 :path "./assets/image/fieshidle.gif")
(image :image-width 80 :image-height 80 :path "./assets/image/fieshidle.gif")
(scroll (scroll
:hscroll true :hscroll true
:vscroll false :vscroll false
@ -220,7 +219,8 @@
:orientation "v" :orientation "v"
:space-evenly false :space-evenly false
:valign "center" :valign "center"
:spacing 10 :spacing spacing-default
(label :halign "start" :text "${hour.FeelsLikeC}°C") (label :halign "start" :text "${hour.FeelsLikeC}°C")
(label :halign "start" :text "rain: ${hour.chanceofrain}%")))) (label :halign "start" :text "rain: ${hour.chanceofrain}%"))))
@ -256,7 +256,6 @@
:orientation "v" :orientation "v"
:class "panel-widget" :class "panel-widget"
:space-evenly false :space-evenly false
:width 200
(label :class "timer" :valign "center" :vexpand true :text timerdis) (label :class "timer" :valign "center" :vexpand true :text timerdis)
(box (box
@ -269,19 +268,16 @@
(defwidget BigSliders [] (defwidget BigSliders []
(box (box
:valign "fill"
:halign "fill"
:class "panel-widget" :class "panel-widget"
:hexpand true :spacing spacing-small
:space-evenly true
(BigBarSlider :var {volume} :icon {volumemute == 'false' ? "󰕾" : "󰖁"} (BigBarSlider :var { volume } :icon {volumemute == 'false' ? "󰕾" : "󰖁"}
:onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%") :onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%")
(BigBarSlider :var {mic_volume} :icon {volumemute == 'false' ? "" : "󰖁"} (BigBarSlider :var { mic_volume } :icon {volumemute == 'false' ? "" : "󰖁"}
:onchange "pactl set-source-volume @DEFAULT_SOURCE@ {}%") :onchange "pactl set-source-volume @DEFAULT_SOURCE@ {}%")
(BigBarSlider :var {brightness} :icon "󰃞" (BigBarSlider :visible false :var { brightness } :icon "󰃞"
:onchange "brightnessctl set {}%") :onchange "brightnessctl set {}%")
)) ))

View file

@ -1,153 +1,153 @@
(defwidget Dashboard [] (defwidget Dashboard []
(box
:class "dashboard"
:space-evenly false
:orientation "v"
(duser :name "Failed" :tag "failed.sh" :pfp "./assets/image/roundpfp.png")
(box (box
:space-evenly true :class "dashboard"
:orientation "h"
:vexpand true
(box
:space-evenly false :space-evenly false
:orientation "v" :orientation "v"
(MediaPlayer :h 150 :permashow true) (duser :name "Failed" :tag "failed.sh" :pfp "./assets/image/roundpfp.png")
(box (box
:space-evenly false :space-evenly true
:orientation "h" :orientation "h"
(box :vexpand true
:width 130
:space-evenly false (box
:orientation "v" :space-evenly false
(dbutt) :orientation "v"
(theme))
(dcal) (MediaPlayer :height 150)
))
(box
:space-evenly false
:orientation "h"
(box
:width 130
:space-evenly false
:orientation "v"
(dbutt)
(theme))
(dcal)
))
(box
:orientation "v"
:space-evenly false
(dnotes)
(quote))
)))
(box (defwidget duser [name tag pfp]
:orientation "v" (box
:orientation "h"
:space-evenly false :space-evenly false
(dnotes) :halign "start"
(quote)) :hexpand true
))) :class "unbarwidget"
:style "background-color: inherit;"
:spacing 15
(image :image-width 50 :image-height 50 :path pfp)
(label :text "|" :style "color: #262626; font-size: 30px;")
(box
:orientation "v"
:space-evenly true
:halign "start"
(label :style "font-weight: bold; font-size: 18px;" :text "Hello, ${name}")
(label :halign "start" :text tag))))
(defwidget duser [name tag pfp] (defwidget dnotes []
(box (box
:orientation "h" :class "notes unbarwidget"
:space-evenly false :space-evenly false
:halign "start" :orientation "v"
:hexpand true :vexpand true
:class "unbarwidget" (label :class "heading" :text "Agenda")
:style "background-color: inherit;" (box
:spacing 15 :vexpand true
(image :image-width 50 :image-height 50 :path pfp) :width 350
(label :text "|" :style "color: #262626; font-size: 30px;") (scroll
(box :hscroll true
:orientation "v" :vscroll true
:space-evenly true (label :style "font-size: 16px;" :text notesc)))))
:halign "start"
(label :style "font-weight: bold; font-size: 18px;" :text "Hello, ${name}")
(label :halign "start" :text tag))))
(defwidget dnotes [] (defwidget dmpd []
(box (overlay
:class "notes unbarwidget" (box
:space-evenly false :class "mpdcover"
:orientation "v" :style "background-image: url('${pcover}')"
:vexpand true :height 150)
(label :class "heading" :text "Agenda") (box
(box :orientation "v"
:vexpand true :space-evenly false
:width 350 :spacing 10
(scroll :valign "center"
:hscroll true (scroll
:vscroll true :hscroll true
(label :style "font-size: 16px;" :text notesc))))) :vscroll false
(label :style "font-size: 18px;" :text psong))
(scroll
:hscroll true
:vscroll false
(label :text partist))
;; (scale
;; :hexpand false
;; :width 60
;; :class "seektime"
;; :value current
;; :orientation "h"
;; :min -5
;; :max 100
;; :onscroll "mpc -q seek +1"
;; :tooltip "${ctime}/${ttime}")
(box
:orientation "h"
:space-evenly false
:spacing 40
:halign "center"
:class "dmpdcontrol"
(button :onclick "./scripts/music_info --prev" (label :text "󰒮"))
(button :onclick "./scripts/music_info --toggle" (label :text { pstatus == "Playing" ? "" : ""}))
(button :onclick "./scripts/music_info --next" (label :text "󰒭"))))))
(defwidget dmpd [] (defwidget dcal []
(overlay (box
(box :class "unbarwidget mincal"
:class "mpdcover" :height 190
:style "background-image: url('${pcover}')" :hexpand true
:height 150) (calendar
(box :show-details false
:orientation "v" :show-heading true
:space-evenly false :show-day-names false
:spacing 10 :show-week-numbers false
:valign "center" :day calendar_day
(scroll :year calendar_year)))
:hscroll true
:vscroll false
(label :style "font-size: 18px;" :text psong))
(scroll
:hscroll true
:vscroll false
(label :text partist))
;; (scale
;; :hexpand false
;; :width 60
;; :class "seektime"
;; :value current
;; :orientation "h"
;; :min -5
;; :max 100
;; :onscroll "mpc -q seek +1"
;; :tooltip "${ctime}/${ttime}")
(box
:orientation "h"
:space-evenly false
:spacing 40
:halign "center"
:class "dmpdcontrol"
(button :onclick "./scripts/music_info --prev" (label :text "󰒮"))
(button :onclick "./scripts/music_info --toggle" (label :text { pstatus == "Playing" ? "" : ""}))
(button :onclick "./scripts/music_info --next" (label :text "󰒭"))))))
(defwidget dcal [] (defwidget dbutt[]
(box (box
:class "unbarwidget mincal" :space-evenly true
:height 190 :orientation "h"
:hexpand true :height 130
(calendar (box
:show-details false :space-evenly true
:show-heading true :orientation "v"
:show-day-names false (button :class "dicons unbarwidget" :onclick "notify-send 'shutdown' 'but its impractical'" (label :text ""))
:show-week-numbers false (button :class "dicons unbarwidget" :onclick "notify-send 'restart' 'but its impractical'" (label :text "")))
:day calendar_day (box
:year calendar_year))) :space-evenly true
:orientation "v"
(button :class "dicons unbarwidget" :onclick "notify-send 'lock' 'but its impractical'" (label :text ""))
(button :class "dicons unbarwidget" :onclick "notify-send 'log out' 'but its impractical'" (label :text "󰍃")))))
(defwidget dbutt[] (defwidget theme []
(box (button
:space-evenly true :class "unbarwidget"
:orientation "h" :vexpand true
:height 130 :onclick "./scripts/toggletheme toggle"
(box (label :style "font-size: 18px;" :text "")))
:space-evenly true
:orientation "v"
(button :class "dicons unbarwidget" :onclick "notify-send 'shutdown' 'but its impractical'" (label :text ""))
(button :class "dicons unbarwidget" :onclick "notify-send 'restart' 'but its impractical'" (label :text "")))
(box
:space-evenly true
:orientation "v"
(button :class "dicons unbarwidget" :onclick "notify-send 'lock' 'but its impractical'" (label :text ""))
(button :class "dicons unbarwidget" :onclick "notify-send 'log out' 'but its impractical'" (label :text "󰍃")))))
(defwidget theme [] ;; (defwidget dquote []
(button ;; (box
:class "unbarwidget" ;; :class "unbarwidget"
:vexpand true ;; :height "120"
:onclick "./scripts/toggletheme toggle" ;; :valign "center"
(label :style "font-size: 18px;" :text ""))) ;; (literal
;; :content quoteliteral)))
;; (defwidget dquote []
;; (box
;; :class "unbarwidget"
;; :height "120"
;; :valign "center"
;; (literal
;; :content quoteliteral)))

View file

@ -5,7 +5,7 @@
:class "vbar" :class "vbar"
(revealer (revealer
:transition "slideleft" :transition "slideright"
:reveal revealControlpanel :reveal revealControlpanel
:duration animation-duration-fast :duration animation-duration-fast
@ -24,7 +24,6 @@
:orientation "v" :orientation "v"
:space-evenly false :space-evenly false
:valign "start" :valign "start"
:height 250
:vexpand false :vexpand false
(Logo) (Logo)