fix: eww stylesheet and window title
This commit is contained in:
parent
9147fa3fff
commit
c601a17ae9
|
@ -14,7 +14,9 @@ $weather: rgba(180, 220, 235, 0.8);
|
|||
$weather_end: rgba(171, 233, 179, 0.8);
|
||||
$clock: rgba(171, 233, 179, 1.0);
|
||||
|
||||
$media-progress-bg: #333333;
|
||||
$media: rgba(224, 232, 224, 0.7);
|
||||
$media-paused: rgba(224, 200, 200, 0.7);
|
||||
|
||||
$tray_bg: rgba(204, 204, 204, 0.1);
|
||||
$tray: #c9cbff;
|
||||
|
@ -25,7 +27,9 @@ $audio: #fae3b0;
|
|||
$backlight: #f8bd96;
|
||||
$bluetooth: #caa9c7;
|
||||
$network: #bd93f9;
|
||||
$cpu_bg: #333333;
|
||||
$cpu: #96cdfb;
|
||||
$memory_bg: #333333;
|
||||
$memory: #88bbeb;
|
||||
$temperature: #ddb6f2;
|
||||
$temperature_critical: #ff6666;
|
||||
|
@ -114,15 +118,10 @@ box .weather {
|
|||
color: mix($weather_end, $weather, 100%);
|
||||
}
|
||||
}
|
||||
.audio-scale {
|
||||
color: $audio;
|
||||
}
|
||||
.audio {
|
||||
all: unset;
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
color: $audio;
|
||||
}
|
||||
//.audio-scale .audio .audio-icon {
|
||||
// background-color: transparent;
|
||||
// color: $audio;
|
||||
//}
|
||||
scale {
|
||||
border-radius: 5px;
|
||||
min-height: 80px;
|
||||
|
@ -134,18 +133,19 @@ scale {
|
|||
color: $audio;
|
||||
}
|
||||
box .cpu {
|
||||
background-color: $cpu_bg;
|
||||
color: $cpu;
|
||||
padding: 6pt;
|
||||
padding: 5pt;
|
||||
}
|
||||
box .memory {
|
||||
background-color: $memory_bg;
|
||||
color: $memory;
|
||||
padding: 6pt;
|
||||
padding: 5pt;
|
||||
}
|
||||
box .clock {
|
||||
background-color: $widget_bg;
|
||||
background-color: transparent;
|
||||
border-radius: 5;
|
||||
color: $clock;
|
||||
margin-bottom: 30px;
|
||||
padding: 2pt 2pt 2pt 2pt;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,17 @@ box .clock {
|
|||
color: $media;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.media-playing {
|
||||
background-color: $media-progress-bg;
|
||||
color: $media;
|
||||
}
|
||||
.media-paused {
|
||||
background-color: $media-progress-bg;
|
||||
color: $media-paused;
|
||||
}
|
||||
.media-text-paused {
|
||||
color: $media-paused;
|
||||
}
|
||||
.status {
|
||||
font-family: monospace;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
:x "0%"
|
||||
:y "0%"
|
||||
:width "20px"
|
||||
:height "100%"
|
||||
:height "99%"
|
||||
:anchor "center left"
|
||||
)
|
||||
:reserve (struts :side "left" :distance "20px")
|
||||
|
@ -24,7 +24,6 @@
|
|||
(widget-workspaces)
|
||||
)
|
||||
(widget-media)
|
||||
;(widget-weather :orientation "v")
|
||||
(box :orientation "v" :space-evenly false :valign "end"
|
||||
(widget-tray)
|
||||
(widget-audio)
|
||||
|
@ -104,45 +103,49 @@
|
|||
:orientation "v"
|
||||
:space-evenly false
|
||||
:valign "center"
|
||||
(circular-progress
|
||||
:class "media"
|
||||
:width 20
|
||||
:height 20
|
||||
:thickness 5
|
||||
;:tooltip {music_listener_position}
|
||||
:tooltip "${music_position} / ${music_length}"
|
||||
:value {100.0 * music_position / (music_length / 1000000.0)}
|
||||
:visible {music_listener != "" && music_length != 1}
|
||||
)
|
||||
; Add play and pause buttons here?
|
||||
(eventbox
|
||||
:onclick "playerctl play-pause"
|
||||
(circular-progress
|
||||
:class { media-status == "Paused" ? "media-paused" : "media-playing" }
|
||||
:width 20
|
||||
:height 20
|
||||
:thickness 5
|
||||
:tooltip {media-position-text}
|
||||
:value {100.0 * media-position / (media-length / 1000000.0)}
|
||||
:visible {media-current != "" && media-length != 1}
|
||||
))
|
||||
(label
|
||||
:class { media-status == "Paused" ? "media-text-paused" : "media-text-playing" }
|
||||
:angle 270
|
||||
:xalign 0.5
|
||||
:yalign 0.5
|
||||
:justify "center"
|
||||
:text {music_listener != "" ? "『${music_listener}』" : "『』"})
|
||||
:text {media-current != "" ? "『${media-current}』" : "『』"})
|
||||
))
|
||||
|
||||
(deflisten music_listener :initial ""
|
||||
|
||||
(deflisten media-current :initial ""
|
||||
"playerctl --follow metadata --format '{{ artist }} / {{album}} / {{ title }}' || true")
|
||||
(deflisten music_listener_position :initial ""
|
||||
(deflisten media-position-text :initial ""
|
||||
"playerctl --follow metadata --format '{{duration(position)}} / {{duration(mpris:length)}}' || true")
|
||||
(defpoll music_position :interval "1s"
|
||||
(defpoll media-position :interval "1s"
|
||||
"playerctl position")
|
||||
(deflisten music_length :initial 1
|
||||
(deflisten media-length :initial 1
|
||||
"playerctl --follow metadata mpris:length")
|
||||
(deflisten media-status :initial "Stopped"
|
||||
"playerctl --follow status")
|
||||
|
||||
(defwidget widget-audio []
|
||||
(eventbox
|
||||
:class "audio"
|
||||
:onhover "${eww} update show_audio=true"
|
||||
:onhoverlost "${eww} update show_audio=false"
|
||||
:onhover "${eww} update show-audio=true"
|
||||
:onhoverlost "${eww} update show-audio=false"
|
||||
(box
|
||||
:class "audio"
|
||||
:orientation "v"
|
||||
:space-evenly "false"
|
||||
:spacing "2"
|
||||
(revealer :transition "slideup" :reveal show_audio
|
||||
(revealer :transition "slideup" :reveal show-audio
|
||||
(scale
|
||||
:class "audio-scale"
|
||||
:value current-volume
|
||||
|
@ -153,13 +156,15 @@
|
|||
:max 101
|
||||
:min 0
|
||||
:onchange "amixer -D pulse sset Master {}%" ))
|
||||
(button
|
||||
:class "audio"
|
||||
:onclick "scripts/popup audio"
|
||||
(label
|
||||
:class "audio-icon"
|
||||
:width 20 :height 20
|
||||
:xalign 0.5 :yalign 0.5
|
||||
:noindent true
|
||||
:tooltip "Volume: ${current-volume}%"
|
||||
:class "volume-icon" ""))))
|
||||
:text { current-volume == 0 ? "" : (current-volume > 80 ? "" : "") }))))
|
||||
(defpoll current-volume :interval "1s" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'")
|
||||
(defvar show_audio false)
|
||||
(defvar show-audio false)
|
||||
|
||||
(defwidget widget-cpu []
|
||||
(circular-progress
|
||||
|
@ -194,7 +199,7 @@
|
|||
:orientation "v"
|
||||
:valign "end"
|
||||
:spacing 1
|
||||
:width 25
|
||||
:width 20
|
||||
(box :class "icon" "")
|
||||
"${clock.m}" "${clock.d}"
|
||||
(box :class "icon" "")
|
||||
|
@ -231,23 +236,6 @@
|
|||
(defpoll calendar_year :interval "10h"
|
||||
"date '+%Y'")
|
||||
|
||||
; Unused widgets
|
||||
|
||||
;(defwidget widget_status []
|
||||
; (box
|
||||
; :class "status"
|
||||
; :orientation "v"
|
||||
; :space-evenly false
|
||||
; :valign "end"
|
||||
; (metric :label ""
|
||||
; :value volume
|
||||
; :onchange "amixer -D pulse sset Master {}%")
|
||||
; (metric :label ""
|
||||
; :value {EWW_RAM.used_mem_perc}
|
||||
; :onchange "")
|
||||
; (widget_clock)))
|
||||
|
||||
|
||||
(defwidget metric [label value onchange]
|
||||
(box
|
||||
:orientation "v"
|
||||
|
|
|
@ -121,10 +121,19 @@ class HyprlandHandler(CompositorHandler):
|
|||
return
|
||||
|
||||
prefix = b"activewindow>>"
|
||||
if not data.startswith(prefix):
|
||||
payload = next((l[len(prefix):]
|
||||
for l in reversed(data.split(b'\n'))
|
||||
if l.startswith(prefix)), None)
|
||||
|
||||
if payload is None:
|
||||
return
|
||||
title = data[len(prefix):]
|
||||
print(title, flush=True)
|
||||
|
||||
if b',' in payload:
|
||||
_, title = payload.decode('utf-8').split(',', 1)
|
||||
print(title, flush=True)
|
||||
else:
|
||||
print("", flush=True)
|
||||
|
||||
self.listen(callback)
|
||||
|
||||
@override
|
||||
|
|
Loading…
Reference in New Issue