feat: osd widget

This commit is contained in:
hesam-init 2024-07-02 13:05:17 +03:30
parent 978037d7d0
commit f0a51d2f8c
8 changed files with 119 additions and 101 deletions

View file

@ -20,25 +20,25 @@
}
.vertical-bar-slider {
scale {
all: unset;
trough {
background-color: $surface2;
border-radius: get-token(border-radius);
min-height: 80px;
min-width: 10px;
trough {
background-color: $surface2;
slider {
background-color: $white2;
border-radius: get-token(border-radius, large);
margin: -10px;
}
highlight {
background-color: $white0;
border-radius: get-token(border-radius);
min-height: 80px;
min-width: 10px;
slider {
background-color: $white2;
border-radius: get-token(border-radius, large);
margin: -10px;
}
highlight {
background-color: $white0;
border-radius: get-token(border-radius);
}
}
}
.volume-icon {
font-size: get-token(font-sizes, large);
}
}

View file

@ -17,6 +17,10 @@ entry {
color: $white0;
}
scale {
all: unset;
}
calendar {
all: unset;
background-color: $surface0;

View file

@ -1,10 +1,24 @@
@mixin window {
border-radius: 1rem;
padding: 1rem;
box-shadow: 0 0 4px 2px;
margin: 1rem;
.volume-osd {
@extend .panel-widget;
border-radius: get-token(border-radius, large);
min-width: 320px;
}
.volume-osd {
@include window;
.volume-scale {
trough {
border-radius: get-token(border-radius, large);
min-height: 32px;
background-color: $surface1;
highlight {
border-radius: get-token(border-radius, large);
background-color: $accent;
}
}
.volume-icon {
font-size: get-token(font-sizes, large);
margin-left: 8px;
}
}

View file

@ -8,6 +8,7 @@
@import "./assets/scss/windows/control-panel";
@import "./assets/scss/windows/vertical-bar";
@import "./assets/scss/windows/dashboard";
@import "./assets/scss/windows/osd";
@import "./src/dock/styles.scss";
@import "./src/desktop/styles.scss";

View file

@ -5,42 +5,42 @@
:y 10
:width 340
:anchor "top left"
)
)
:stacking "overlay"
:monitor 0
(ControlPanel))
(defwindow bar
:geometry
(geometry
:anchor "center left"
:anchor "center left"
:height "100%")
:monitor 0
:exclusive true
:wm-ignore false
(VerticalBar))
(defwindow dashboard
:geometry (geometry
:x 0
:y 0
:width 800
:height 420
:anchor "center")
:stacking "overlay"
:monitor 0
(Dashboard))
:geometry (geometry
:x 0
:y 0
:width 800
:height 420
:anchor "center")
:stacking "overlay"
:monitor 0
(Dashboard))
(defwindow osd
:monitor 0
:stacking "overlay"
:geometry (geometry
:anchor "bottom center"
:width "2px"
:height "2px"
)
(VolumeOsd)
:monitor 0
:stacking "overlay"
:geometry (geometry
:anchor "bottom center"
:width "2px"
:height "2px"
)
(VolumeOsd)
)

View file

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

View file

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

View file

@ -1,15 +1,15 @@
(defwidget VolumeOsd []
(revealer :transition "slideup" :reveal revealOsd :duration "500ms"
(box :orientation "h" :class "volume-osd" :space-evenly false
(VolumeScale))))
(revealer :transition "slideup" :reveal revealOsd :duration "500ms"
(box :orientation "h" :class "volume-osd" :space-evenly false
(VolumeScale))))
(defwidget VolumeScale []
(overlay :hexpand true
(scale :min 0 :max 100 :active {volume != "muted"} :value {volume == "muted" ? 0 : volume} :onchange "pamixer --set-volume {}" :class "volume-scale")
(label :class 'volume-icon ${volume == "muted" ? "less" : volume < 5 ? "less" : "more"}' :halign "start" :text {volume == "muted" ? "󰸈" : volume < 33 ? "" : volume < 67 ? "" : ""})))
(overlay :hexpand true :class "volume-scale"
(scale :min 0 :max 100 :active {volume != "muted"} :value {volume == "muted" ? 0 : volume} :onchange "pamixer --set-volume {}")
(label :class 'volume-icon ${volume == "muted" ? "less" : volume < 5 ? "less" : "more"}' :halign "start" :text {volume == "muted" ? "󰸈" : volume < 33 ? "" : volume < 67 ? "" : ""})))
(defwidget VolumeControlCenter []
(box :orientation "h" :class "volume-control-center" :space-evenly false
(volume_scale)
(button :class "volume-mute ${volume == 'muted' ? 'active' : ''}" :onclick "pamixer -t" "󰝟")
(button :class "volume-arrow" :onclick "scripts/toggle_control_center.sh close && pavucontrol &" "󰅂")))
(box :orientation "h" :class "volume-control-center" :space-evenly false
(volume_scale)
(button :class "volume-mute ${volume == 'muted' ? 'active' : ''}" :onclick "pamixer -t" "󰝟")
(button :class "volume-arrow" :onclick "scripts/toggle_control_center.sh close && pavucontrol &" "󰅂")))