rehauled time and added more timezones

This commit is contained in:
willifan 2024-06-09 00:56:40 +02:00
parent 1a6e0f68f7
commit ac16c49d2e
2 changed files with 91 additions and 48 deletions

View file

@ -5,21 +5,8 @@
;; left
(defwidget time []
(box
:class "barbox"
:space-evenly false
:spacing 3
(space)
(eventbox
:onclick ``
:class "smallBox"
:valign "center"
:height 20
:width 70
(label
:text "${formattime(EWW_TIME, "%H:%M:%S")}"))
(space)))
;; center
@ -105,24 +92,18 @@
;; Widget blocks
(defwidget media []
(box
:class "barbox"
:visible {media.status == "Playing" ? true : false}
:spacing 3
:space-evenly false
:halign "end"
:valign "center"
:height 30
(space)
(box
:class "smallBox"
:height 20
:valign "center"
:spacing 1
:space-evenly false
(space)
(label
:text {media.name}
:tooltip {media.name}
:truncate true))
(space)))
:truncate true)
(space)))
(defwidget processing []
(eventbox
@ -195,6 +176,31 @@
(power)
(smallSpacer))))
;; Boxes
(defwidget timeBox []
(box
:class "barbox"
:spacing 3
:space-evenly false
:halign "end"
:valign "center"
:height 30
(testtime)))
(defwidget mediaBox []
(box
:class "barbox"
:visible {media.status == "Playing" ? true : false}
:spacing 3
:space-evenly false
:halign "end"
:valign "center"
:height 30
(space)
(media)
(space)))
(defwidget start []
(box
@ -204,9 +210,9 @@
:halign "start"
:valign "center"
:spacing 3
(time)
(media)
(space)))
(timeBox)
(mediaBox)
(box)))
(defwidget center [monitor]
(box
@ -250,37 +256,51 @@
(defwidget end []
(box
:class "barbox"
:spacing 2
:orientation "h"
:space-evenly false
:spacing 3
:height 30
:valign "center"
:halign "end"
(space)
;; (systray
;; :spacing 2
;; :orientation "h"
;; :space-evenly true
;; :icon-size 16)
;;
;; (seperator)
(testtime
:name "US East"
:timezone "EST")
(testtime
:name "Asia"
:timezone "Asia/Seoul")
(box
:class "barbox"
:spacing 2
:orientation "h"
:space-evenly false
:height 30
:valign "center"
:halign "end"
(space)
;; (systray
;; :spacing 2
;; :orientation "h"
;; :space-evenly true
;; :icon-size 16)
;;
;; (seperator)
(processing)
(processing)
(seperator)
(controlls)
(seperator)
(controlls)
(seperator)
(seperator)
(wireless)
(wireless)
(seperator)
(seperator)
(energy)
(energy)
(space)))
(space))))
(defwidget bar [monitor]
(centerbox

View file

@ -86,3 +86,26 @@
:valign "center"
:text "|"
)))
(defwidget testtime [?name ?icon ?timezone]
(box
:class "barbox"
:space-evenly false
:spacing 3
(space)
(box
:onclick ``
:class "smallBox"
:spacing 1
:space-evenly false
:valign "center"
:height 20
(space)
(eventbox
(label
:truncate {name != "" ? true : false }
:truncate-left {name != "" ? true : false }
:text {timezone != "" ? "${name} ${formattime(EWW_TIME, "%H:%M", timezone)}" : "${formattime(EWW_TIME, "%H:%M:%S")}"}
:tooltip {timezone != "" ? "${formattime(EWW_TIME, "%A %d.%m.%G", timezone)}" : "${formattime(EWW_TIME, "%A %d.%m.%G")}"}))
(space))
(space)))