Eww: Modularized and improved CSS

This commit is contained in:
soraefir 2023-11-23 20:46:43 +01:00
parent 5e569bbb48
commit afaed60935
12 changed files with 207 additions and 139 deletions

View File

@ -1,8 +1,4 @@
.calendar-win { .calendar-win {
@include window;
background-color: $bg1;
color: $fg;
padding: .2em;
} }
calendar { calendar {
@ -50,5 +46,6 @@ calendar {
} }
.datetime { .datetime {
padding: $border-width; padding: $gaps-window;
} }

View File

@ -1,10 +1,7 @@
.radio-win { .radio-win {
@include window; //margin: $gaps-screen;
background-color: $bg1; //padding: .5em;
color: $fg;
margin: $gaps-screen;
padding: .5em;
} }
.album_art { .album_art {

View File

@ -65,11 +65,11 @@ color: $base0B;
} }
.sys-win { .sys-win {
@include window; // @include window;
background-color: $bg1; // background-color: $bg1;
color: $fg; // color: $fg;
margin: $gaps-screen; // margin: $gaps-screen;
padding: .5em; // padding: .5em;
} }
.sys-label { .sys-label {

View File

@ -1,20 +1,26 @@
@import 'css/colors'; @import 'css/colors';
@mixin rounding { /* MIXIN */
@mixin border-radius {
border-radius: $border-radius; border-radius: $border-radius;
} }
@mixin window { @mixin border-inactive {
border: $border-width solid $base04; border-width: $border-width;
margin: $gaps-screen $gaps-screen $gaps-screen; border-style: solid;
@include rounding; border-color: $base03;
} }
@import 'css/sys'; @mixin border-active {
@import 'css/net'; border-color: $base04;
@import 'css/clock'; }
@import 'css/radio';
@import 'css/powermenu'; @mixin test {
}
/* GENERAL */
* { * {
all: unset; all: unset;
@ -22,14 +28,6 @@
transition: 200ms ease; transition: 200ms ease;
} }
.bar {
color: $fg;
label {
font-size: 1.2rem;
}
}
tooltip { tooltip {
background: $base01; background: $base01;
border: $border-width solid $base04; border: $border-width solid $base04;
@ -43,33 +41,6 @@ tooltip {
.icon, .icon,
.icon label { font-family: Material Design Icons; } .icon label { font-family: Material Design Icons; }
.ws {
border-radius: $border-radius;
margin: $gaps-window;
}
.focused {
background-color: $bg1;
border-radius: 1rem;
margin: .3rem;
padding: .25rem;
}
.module {
background: $base01;
border-radius: $border-radius;
border-color: $base03;
border-style: solid;
border-width: $border-width;
border-right-style: none;
border-bottom-right-radius: 0;
border-top-right-radius: 0;
padding: $gaps-screen $gaps-window;
margin: $gaps-screen 0;
}
.grey { .grey {
background-color: $base02; background-color: $base02;
} }
@ -89,3 +60,73 @@ tooltip {
.blue { .blue {
background-color: $base0C; background-color: $base0C;
} }
/* WINDOW WRAPPER CSS */
.winevent {
background-color: $base01;
color: $base07;
@include border-radius;
@include border-inactive;
}
.winevent:hover {
@include border-active;
}
.wininner {
padding: $gaps-window;
}
.winouter {
margin: $gaps-screen;
}
/* MODULE WRAPPER CSS */
.modevent {
background-color: $base01;
color: $base07;
@include border-radius;
@include border-inactive;
border-right-style: none;
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
.modevent:hover {
@include border-active;
}
.modinner {
padding: $gaps-screen 0 $gaps-screen $gaps-window;
}
.modouter {
margin: $gaps-screen 0;
}
/* IMPORTS EXTERNAL */
@import 'css/sys';
@import 'css/net';
@import 'css/clock';
@import 'css/radio';
@import 'css/powermenu';
/* BAR */
.bar label {
font-size: 1.2rem;
}
/* WORKSPACE */
.ws {
border-radius: $border-radius;
margin: $gaps-window;
}
.focused {
background-color: $bg1;
border-radius: 1rem;
margin: .3rem;
padding: .25rem;
}

View File

@ -16,7 +16,7 @@
:orientation "v" :orientation "v"
:halign "end" :halign "end"
:valign "start" :valign "start"
(workspaces))) (workspace-mod)))
(defwidget right [] (defwidget right []
(box (box
@ -24,9 +24,9 @@
:orientation "v" :orientation "v"
:halign "end" :halign "end"
:valign "end" :valign "end"
(sys) (sys-mod)
(net) (net-mod)
(clock))) (clock-mod)))
(defwidget center [] (defwidget center []
(box (box
@ -34,7 +34,7 @@
:orientation "v" :orientation "v"
:halign "end" :halign "end"
:valign "center" :valign "center"
(radio-button))) (radio-mod)))
(defwidget bar-box [] (defwidget bar-box []
(centerbox (centerbox
@ -56,3 +56,30 @@
:stacking "fg" :stacking "fg"
:exclusive true :exclusive true
(bar-box)) (bar-box))
(defwidget window []
(box
:class "winouter"
(eventbox
:class "winevent"
(box
:class "wininner"
(children)
)
)
)
)
(defwidget module []
(box
:class "modouter"
(eventbox
:class "modevent"
(box
:class "modinner"
(children)
)
)
)
)

View File

@ -1,11 +1,12 @@
(defvar date_rev false) (defvar date_rev false)
(defwidget clock [] (defwidget clock-mod []
(box (module
:class "module datetime"
(eventbox (eventbox
:onhover "${EWW_CMD} update date_rev=true" :onhover "${EWW_CMD} update date_rev=true"
:onhoverlost "${EWW_CMD} update date_rev=false" :onhoverlost "${EWW_CMD} update date_rev=false"
(box
:class "datetime"
(overlay (overlay
(box (box
:orientation "v" :orientation "v"
@ -25,7 +26,13 @@
(button (button
:onclick "${EWW_CMD} open --toggle calendar" :onclick "${EWW_CMD} open --toggle calendar"
:onrightclick "${EWW_CMD} open --toggle powermenu" :onrightclick "${EWW_CMD} open --toggle powermenu"
:class "month" month))))))) :class "month" month))
)
)
)
)
)
)
(defpoll hour :interval "15s" "date '+%H'") (defpoll hour :interval "15s" "date '+%H'")
(defpoll minute :interval "15s" "date '+%M'") (defpoll minute :interval "15s" "date '+%M'")

View File

@ -1,8 +1,8 @@
(deflisten net :initial '{"name":"","icon":""}'"scripts/net/net") (deflisten net :initial '{"name":"","icon":""}'"scripts/net/net")
(defwidget net [] (defwidget net-mod []
(module
(box (box
:class "module"
:orientation "v" :orientation "v"
(button (button
:class "net" :class "net"
@ -13,4 +13,5 @@
:class "blt" :class "blt"
(label :class "icon-text" :text "B")) (label :class "icon-text" :text "B"))
) )
)
) )

View File

@ -4,11 +4,12 @@
(deflisten battery :initial '{"visible":false,"percentage":0.0,"color":"#FFFFFF"}' "scripts/sys/battery") (deflisten battery :initial '{"visible":false,"percentage":0.0,"color":"#FFFFFF"}' "scripts/sys/battery")
(defwidget sys [] (defwidget sys-mod []
(module
(button (button
:class "module"
:onclick "${EWW_CMD} open --toggle sys" :onclick "${EWW_CMD} open --toggle sys"
(box (box
:class "module"
:orientation "v" :orientation "v"
(circular-progress (circular-progress
:value {EWW_CPU.avg} :value {EWW_CPU.avg}
@ -38,4 +39,5 @@
(label :class "icon-text" :text "B")) (label :class "icon-text" :text "B"))
) )
) )
)
) )

View File

@ -1,6 +1,7 @@
(deflisten workspace :initial '[]' "scripts/workspaces") (deflisten workspace :initial '[]' "scripts/workspaces")
(defwidget workspaces [] (defwidget workspace-mod []
(module
(eventbox (eventbox
:onscroll "echo {} | sed -e \"s/up/-1/g\" -e \"s/down/+1/g\" | xargs hyprctl dispatch workspace" :onscroll "echo {} | sed -e \"s/up/-1/g\" -e \"s/down/+1/g\" | xargs hyprctl dispatch workspace"
(box (box
@ -13,4 +14,4 @@
; :tooltip {ws.tooltip} ; :tooltip {ws.tooltip}
(box (box
:class `${ws.focused ? "focused" : ""}` :class `${ws.focused ? "focused" : ""}`
:height 3)))))) :height 3)))))))

View File

@ -1,8 +1,3 @@
(defwidget calendar-win []
(box
:class "calendar-win"
(calendar)))
(defwindow calendar (defwindow calendar
:monitor 0 :monitor 0
:geometry (geometry :geometry (geometry
@ -11,4 +6,4 @@
:anchor "bottom right" :anchor "bottom right"
:width "0px" :width "0px"
:height "0px") :height "0px")
(calendar-win)) (window (calendar)))

View File

@ -1,11 +1,6 @@
(deflisten radio :initial '{"is_paused":1,"song":{"artist":"","song":"","image600":"https://www.radiorecord.ru/upload/stations_images/record_image600_white_fill.png"},"stations":[]}' "scripts/radio") (deflisten radio :initial '{"is_paused":1,"song":{"artist":"","song":"","image600":"https://www.radiorecord.ru/upload/stations_images/record_image600_white_fill.png"},"stations":[]}' "scripts/radio")
(defvar radio_rev false) (defvar radio_rev false)
(defwidget radio-win []
(box
:class "radio-win"
(radio)))
(defwindow radio (defwindow radio
:monitor 0 :monitor 0
:geometry (geometry :geometry (geometry
@ -14,10 +9,10 @@
:anchor "bottom right" :anchor "bottom right"
:width "0px" :width "0px"
:height "0px") :height "0px")
(radio-win)) (window (radio-win)))
(defwidget radio [] (defwidget radio-win []
(box (box
:space-evenly false :space-evenly false
:orientation "h" :orientation "h"
@ -100,10 +95,14 @@
) )
) )
(defwidget radio-button [] (defwidget radio-mod []
(module
(box
:orientation "v"
(button (button
:onclick "${EWW_CMD} open --toggle --no-daemonize radio" :onclick "${EWW_CMD} open --toggle --no-daemonize radio"
(box "󰎆"
:class "module" )
:orientation "v" )
"󰎆"))) )
)

View File

@ -114,10 +114,11 @@
(defwindow sys (defwindow sys
:monitor 0 :monitor 0
:stacking "overlay"
:geometry (geometry :geometry (geometry
:x "0%" :x "0%"
:y "0%" :y "0%"
:anchor "bottom right" :anchor "bottom right"
:width "0px" :width "0px"
:height "0px") :height "0px")
(sys-win)) (window (sys-win)))