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

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

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'")
@ -57,13 +63,13 @@
; Notifications ; Notifications
(deflisten notifications :initial '{ (deflisten notifications :initial '{
"count": 0, "count": 0,
"dnd": false, "dnd": false,
"notifications": [], "notifications": [],
"popups": [] "popups": []
}' }'
"./scripts/notif.py" "./scripts/notif.py"
) )
; Playerctl ; Playerctl
(deflisten pstatus :initial "" "playerctl status -F") (deflisten pstatus :initial "" "playerctl status -F")
@ -72,9 +78,9 @@
(deflisten pcover "./scripts/pollcover.sh") (deflisten pcover "./scripts/pollcover.sh")
(deflisten ptime (deflisten ptime
:initial '{ :initial '{
"position": 0, "position": 0,
"duration": 0, "duration": 0,
"readable": "0:00" "readable": "0:00"
}' }'
"playerctl -F metadata -f '{ \"position\": {{position/1000000}}, \"duration\": {{mpris:length/1000000}}, \"readable\": \"{{duration(position)}}/{{duration(mpris:length)}}\" }'") "playerctl -F metadata -f '{ \"position\": {{position/1000000}}, \"duration\": {{mpris:length/1000000}}, \"readable\": \"{{duration(position)}}/{{duration(mpris:length)}}\" }'")
;; (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}}\" }'")
@ -87,34 +93,34 @@
(defpoll uptime :initial "idk" :interval "1m" "uptime -p") (defpoll uptime :initial "idk" :interval "1m" "uptime -p")
(defpoll weatherjson (defpoll weatherjson
:initial '{ :initial '{
"FeelsLikeC": "0", "FeelsLikeC": "0",
"FeelsLikeF": "0", "FeelsLikeF": "0",
"cloudcover": "0", "cloudcover": "0",
"humidity": "0", "humidity": "0",
"localObsDateTime": "2000-00-00 07:27 AM", "localObsDateTime": "2000-00-00 07:27 AM",
"observation_time": "07:27 AM", "observation_time": "07:27 AM",
"precipInches": "0.0", "precipInches": "0.0",
"precipMM": "0.0", "precipMM": "0.0",
"pressure": "0", "pressure": "0",
"pressureInches": "0", "pressureInches": "0",
"temp_C": "0", "temp_C": "0",
"temp_F": "0", "temp_F": "0",
"uvIndex": "0", "uvIndex": "0",
"visibility": "0", "visibility": "0",
"visibilityMiles": "0", "visibilityMiles": "0",
"weatherCode": "727", "weatherCode": "727",
"weatherDesc": [{"value": "Idk"}], "weatherDesc": [{"value": "Idk"}],
"weatherIconUrl": [{"value": ""}], "weatherIconUrl": [{"value": ""}],
"winddir16Point": "", "winddir16Point": "",
"winddirDegree": "0", "winddirDegree": "0",
"windspeedKmph": "0", "windspeedKmph": "0",
"windspeedMiles": "0", "windspeedMiles": "0",
"icon": "idk", "icon": "idk",
"hourly": [] "hourly": []
}' }'
:interval "1h" :interval "1h"
:run-while revealControlpanel :run-while revealControlpanel
"./scripts/weather.py") "./scripts/weather.py")
(defpoll datehour :initial "12" :interval "30m" "date +'%H'") (defpoll datehour :initial "12" :interval "30m" "date +'%H'")
(defpoll notesc :interval "2s" :run-while reveal4 "cat -s ~/Documents/fuck.txt") (defpoll notesc :interval "2s" :run-while reveal4 "cat -s ~/Documents/fuck.txt")
(defpoll quotejson :interval "1h" `./scripts/quote.py`) (defpoll quotejson :interval "1h" `./scripts/quote.py`)

View file

@ -26,7 +26,7 @@
(Logo) (Logo)
(Workspaces) (Workspaces)
;; (hiddenctl) (hiddenctl)
)) ))
(defwidget Middle [] (defwidget Middle []
@ -91,52 +91,37 @@
(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 (box
:class "touch"
:orientation "v" :orientation "v"
:class "widget" :spacing 5
:space-evenly false (button :onclick "swaymsg kill"
(revealer (label :class "icon" :text "󰅙"))
:reveal reveal3 (button :onclick "wofi --show=drun -i -I"
:transition "slideup" (label :class "icon" :text "󰀻"))
:duration "500ms" (button :onclick "./scripts/touchkey.sh"
(box (label :class "icon" :text "󰌌"))))
:class "touch" )
:orientation "v"
:spacing 5
(button :onclick "swaymsg kill"
(label :class "icon" :text "󰅙"))
(button :onclick "wofi --show=drun -i -I"
(label :class "icon" :text "󰀻"))
(button :onclick "./scripts/touchkey.sh"
(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 {}%"