feat: eww font mixin

This commit is contained in:
hesam-init 2024-07-01 10:06:31 +03:30
parent 52100e0ece
commit 4a088d2f91
11 changed files with 154 additions and 152 deletions

View file

@ -1,3 +1,10 @@
.reveal-on-hover { .reveal-on-hover {
padding: 6px 0px; padding: 6px 0px;
} }
.reveal-on-click {
@include font("medium");
color: $surface2;
padding: 4px 0px;
}

View file

@ -1,3 +1,23 @@
@import "mixin";
.widget {
@include widget;
}
.panel-widget {
@include widget;
margin: 6px;
}
.icon {
@include icon;
}
.popup {
@include popup;
}
.border { .border {
border: 2px white solid; border: 2px white solid;
} }

View file

@ -1,26 +1,28 @@
@mixin font($size: "default") {
$sizes: (
"small": 16px,
"medium": 18px,
"large": 20px,
);
@if map-has-key($sizes, $size) {
font-size: map-get($sizes, $size);
} @else {
font-size: map-get($sizes, "large");
}
}
@mixin widget() { @mixin widget() {
padding: 0.6em; padding: 0.6em 0.4em;
margin: 4px 2px; margin: 4px 2px;
border-radius: 8px; border-radius: 8px;
background-color: $surface0; background-color: $surface0;
} }
.widget {
@include widget;
}
.panel-widget {
@include widget;
margin: 6px;
}
@mixin icon() { @mixin icon() {
font-size: 20px; @include font("medium");
font-family: "Symbols Nerd Font";
}
.icon { font-family: "Symbols Nerd Font";
@include icon;
} }
@mixin popup() { @mixin popup() {
@ -30,7 +32,3 @@
border-style: solid; border-style: solid;
margin: 10px; margin: 10px;
} }
.popup {
@include popup;
}

View file

@ -2,7 +2,7 @@
@include widget; @include widget;
label { label {
font-size: 20px; @include font;
} }
} }
@ -10,7 +10,7 @@
@include widget; @include widget;
label { label {
font-size: 18px; @include font("small");
} }
} }

View file

@ -4,12 +4,6 @@
background-color: $base; background-color: $base;
} }
.revealtouch {
font-size: 20px;
margin: 5px 0px;
color: $surface2;
}
.bat_scale trough { .bat_scale trough {
min-height: 50px; min-height: 50px;
min-width: 18px; min-width: 18px;

View file

@ -1,5 +1,4 @@
@import "./assets/scss/themes/fullerene.scss"; @import "./assets/scss/themes/fullerene.scss";
@import "./assets/scss/mixin";
@import "./assets/scss/native"; @import "./assets/scss/native";
@import "./assets/scss/global"; @import "./assets/scss/global";
@import "./assets/scss/modules"; @import "./assets/scss/modules";

View file

@ -9,13 +9,7 @@
:transition "slideleft" :transition "slideleft"
(children :nth 1)))) (children :nth 1))))
(defwidget RevealOnHover [var varname ?class ?duration ?transition] (defwidget RevealOnHover [var varname ?class ?duration ?transition ?icon]
(box
:class "${class}"
:orientation "v"
:space-evenly false
:valign "end"
(eventbox (eventbox
:onhover `${EWW_CMD} update ${varname}=true` :onhover `${EWW_CMD} update ${varname}=true`
:onhoverlost `${EWW_CMD} update ${varname}=false` :onhoverlost `${EWW_CMD} update ${varname}=false`
@ -23,27 +17,31 @@
(box (box
:space-evenly false :space-evenly false
:orientation "v" :orientation "v"
(children :nth 0) (label :class "icon" :text icon)
(revealer (revealer
:reveal var :reveal var
:transition {transition ?:"slidedown"} :transition {transition ?:"slidedown"}
:duration "500ms" :duration "500ms"
(box :class "reveal-on-hover" (children :nth 1)))))) (box :class "reveal-on-hover" (children :nth 0))))
) ))
(defwidget RevealOnClick [var varname ?class ?duration ?transition]
(defwidget ClickBox [var varname ?class ?duration ?transition] (box
(box :class "${class} clickbox" :orientation "h" :space-evenly false :orientation "v"
(button :onclick "eww update ${varname}=${ var ? false : true }" :class "widget"
(children :nth 0))
(revealer :reveal var
:transition {transition ?: "slideleft"}
:duration {duration ?: "500ms"}
(box :class "${class}"
:space-evenly false :space-evenly false
(children :nth 1)
(button :onclick "eww update ${varname}=false" :class "close" (label :text "Close"))))) (revealer
:reveal var
:transition "slideup"
:duration "500ms"
(box (children :nth 0)))
(eventbox
:cursor "pointer"
:onclick `${EWW_CMD} update ${varname}=${!var}`
(label :angle {var ? 90 : 270} :class "reveal-on-click" :tooltip "touch control" :text "")
) )
))

View file

@ -4,7 +4,7 @@
(box (box
:class "widget" :class "widget"
:orientation "v" :orientation "v"
:spacing 6 :spacing defaultSpacing
(eventbox (eventbox
:onclick "${EWW_CMD} open MusicPlayerPopup --toggle" :onclick "${EWW_CMD} open MusicPlayerPopup --toggle"

View file

@ -9,11 +9,12 @@
:class "workspaces" :class "workspaces"
:space-evenly false :space-evenly false
:orientation "v" :orientation "v"
:spacing 6 :spacing largeSpacing
(for workspace in {workspacesJson} (for workspace in {workspacesJson}
(button (button
:onclick "hyprctl dispatch workspace ${workspace.id}" :onclick "hyprctl dispatch workspace ${workspace.id}"
(box (box
:height 25 :height 25
:class "workspace ${workspace.id == currentWorkspace ? "workspacethingactive" : "workspacething"}" :class "workspace ${workspace.id == currentWorkspace ? "workspacethingactive" : "workspacething"}"

View file

@ -1,5 +1,11 @@
; Global ; Global Styles
(defvar animationDuration "500ms") (defvar animationDuration "500ms")
(defvar defaultSpacing 8)
(defvar largeSpacing 6)
(defvar mediumSpacing 4)
(defvar smallSpacing 2)
; Global
(deflisten kbLayout :initial "en" "./scripts/kb-layout/get-active") (deflisten kbLayout :initial "en" "./scripts/kb-layout/get-active")
(defpoll thour :initial "0" :interval "60s" "date +'%I'") (defpoll thour :initial "0" :interval "60s" "date +'%I'")
(defpoll tmin :initial "0" :interval "60s" "date +'%M'") (defpoll tmin :initial "0" :interval "60s" "date +'%M'")

View file

@ -26,7 +26,7 @@
(Logo) (Logo)
(Workspaces) (Workspaces)
;; (hiddenctl) (hiddenctl)
)) ))
(defwidget Middle [] (defwidget Middle []
@ -91,17 +91,9 @@
(label :text "${EWW_BATTERY.BAT0.capacity}%" :limit-width 3 :show-truncated false))) (label :text "${EWW_BATTERY.BAT0.capacity}%" :limit-width 3 :show-truncated false)))
(defwidget hiddenctl [] (defwidget hiddenctl []
(eventbox (RevealOnClick
:cursor "pointer" :var reveal3
:onclick {reveal3 ? "${EWW_CMD} update reveal3=false" : "${EWW_CMD} update reveal3=true"} :varname "reveal3"
(box
:orientation "v"
:class "widget"
:space-evenly false
(revealer
:reveal reveal3
:transition "slideup"
:duration "500ms"
(box (box
:class "touch" :class "touch"
:orientation "v" :orientation "v"
@ -112,31 +104,24 @@
(label :class "icon" :text "󰀻")) (label :class "icon" :text "󰀻"))
(button :onclick "./scripts/touchkey.sh" (button :onclick "./scripts/touchkey.sh"
(label :class "icon" :text "󰌌")))) (label :class "icon" :text "󰌌"))))
(label :angle {reveal3 ? 90 : 270} :class "revealtouch" :tooltip "touch control" :text "") )
(revealer
:reveal {!reveal3}
:transition "slidedown"
))))
(defwidget Sliders [] (defwidget Sliders []
(box (box
:class "widget" :class "widget"
:orientation "v" :orientation "v"
:space-evenly false :space-evenly false
:spacing 8 :spacing defaultSpacing
:valign "end" :valign "end"
(button :onclick "alacritty -e nmtui" :tooltip wifi_essid (button :onclick "alacritty -e nmtui" :tooltip wifi_essid
(label :class "icon" :style "font-size: 18px;" :text wifi_icon)) (label :class "icon" :text wifi_icon))
(RevealOnHover (RevealOnHover
:var revealVolume :var revealVolume
:varname "revealVolume" :varname "revealVolume"
(box :icon {volumemute == 'false' ? "󰕾" : "󰖁"}
:orientation "v"
:space-evenly false
:class "sound"
(label :class "icon" :text {volumemute == 'false' ? "󰕾" : "󰖁"}))
(scale (scale
:class "volslide" :class "volslide"
:value volume :value volume
@ -150,11 +135,8 @@
(RevealOnHover (RevealOnHover
:var revealMicrophone :var revealMicrophone
:varname "revealMicrophone" :varname "revealMicrophone"
(box :icon {volumemute == 'false' ? "" : "󰖁"}
:orientation "v"
:space-evenly false
:class "sound"
(label :class "icon" :text {volumemute == 'false' ? "" : "󰖁"}))
(scale (scale
:class "volslide" :class "volslide"
:value mic_volume :value mic_volume
@ -168,11 +150,8 @@
(RevealOnHover (RevealOnHover
:var revealBrightness :var revealBrightness
:varname "revealBrightness" :varname "revealBrightness"
(box :icon "󰃞"
:orientation "v"
:space-evenly false
:class "bright"
(label :class "icon" :text "󰃞"))
(scale (scale
:class "brislide" :class "brislide"
:onchange "brightnessctl set {}%" :onchange "brightnessctl set {}%"