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

@ -15,7 +15,7 @@
:space-evenly false :space-evenly false
:orientation "v" :orientation "v"
(MediaPlayer :h 150 :permashow true) (MediaPlayer :height 150)
(box (box
:space-evenly false :space-evenly false
@ -36,7 +36,7 @@
(quote)) (quote))
))) )))
(defwidget duser [name tag pfp] (defwidget duser [name tag pfp]
(box (box
:orientation "h" :orientation "h"
:space-evenly false :space-evenly false
@ -54,7 +54,7 @@
(label :style "font-weight: bold; font-size: 18px;" :text "Hello, ${name}") (label :style "font-weight: bold; font-size: 18px;" :text "Hello, ${name}")
(label :halign "start" :text tag)))) (label :halign "start" :text tag))))
(defwidget dnotes [] (defwidget dnotes []
(box (box
:class "notes unbarwidget" :class "notes unbarwidget"
:space-evenly false :space-evenly false
@ -69,7 +69,7 @@
:vscroll true :vscroll true
(label :style "font-size: 16px;" :text notesc))))) (label :style "font-size: 16px;" :text notesc)))))
(defwidget dmpd [] (defwidget dmpd []
(overlay (overlay
(box (box
:class "mpdcover" :class "mpdcover"
@ -108,7 +108,7 @@
(button :onclick "./scripts/music_info --toggle" (label :text { pstatus == "Playing" ? "" : ""})) (button :onclick "./scripts/music_info --toggle" (label :text { pstatus == "Playing" ? "" : ""}))
(button :onclick "./scripts/music_info --next" (label :text "󰒭")))))) (button :onclick "./scripts/music_info --next" (label :text "󰒭"))))))
(defwidget dcal [] (defwidget dcal []
(box (box
:class "unbarwidget mincal" :class "unbarwidget mincal"
:height 190 :height 190
@ -121,7 +121,7 @@
:day calendar_day :day calendar_day
:year calendar_year))) :year calendar_year)))
(defwidget dbutt[] (defwidget dbutt[]
(box (box
:space-evenly true :space-evenly true
:orientation "h" :orientation "h"
@ -137,14 +137,14 @@
(button :class "dicons unbarwidget" :onclick "notify-send 'lock' 'but its impractical'" (label :text "")) (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 "󰍃"))))) (button :class "dicons unbarwidget" :onclick "notify-send 'log out' 'but its impractical'" (label :text "󰍃")))))
(defwidget theme [] (defwidget theme []
(button (button
:class "unbarwidget" :class "unbarwidget"
:vexpand true :vexpand true
:onclick "./scripts/toggletheme toggle" :onclick "./scripts/toggletheme toggle"
(label :style "font-size: 18px;" :text ""))) (label :style "font-size: 18px;" :text "")))
;; (defwidget dquote [] ;; (defwidget dquote []
;; (box ;; (box
;; :class "unbarwidget" ;; :class "unbarwidget"
;; :height "120" ;; :height "120"

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)