183 lines
6.8 KiB
Plaintext
183 lines
6.8 KiB
Plaintext
|
|
(defpoll time_str
|
|
:interval "1m"
|
|
:initial ""
|
|
`date '+%r'`)
|
|
|
|
(defpoll date_str
|
|
:interval "1h"
|
|
:initial ""
|
|
`date '+%a %b %d'`)
|
|
|
|
(defpoll tasks-data
|
|
:interval "30m"
|
|
:initial "{tasks: []}"
|
|
`agenda-json`)
|
|
|
|
(defpoll mail-data
|
|
:interval "2m"
|
|
:initial "{\"new\": 0, \"read\": 0}"
|
|
`mail-count`)
|
|
|
|
(defpoll active-network
|
|
:interval "5m"
|
|
:initial "{}"
|
|
`nmcli conn show --active | head -n 2 | tail -n 1 | awk -F '[[:space:]][[:space:]]+' '{print "{ \\"name\\": \\""$1"\\", \\"type\\": \\""$3"\\"}"}'`
|
|
)
|
|
|
|
(defpoll net-interface
|
|
:interval "5m"
|
|
:initial ""
|
|
`nmcli conn show --active | head -n 2 | tail -n 1 | awk -F '[[:space:]][[:space:]]+' '{print $4}' | tr -d "[:blank:]"`
|
|
)
|
|
|
|
(deflisten player-status "playerctl --follow status || false")
|
|
(deflisten player-length "playerctl --follow metadata mpris:length || 0")
|
|
(deflisten player-art "playerctl --follow metadata mpris:artUrl || 0")
|
|
|
|
(deflisten artist `playerctl --follow metadata artist`)
|
|
(defpoll player-position
|
|
:interval "5s"
|
|
:initial "0"
|
|
:run-while {player-status == "Playing"}
|
|
`playerctl position`)
|
|
(deflisten track `playerctl --follow metadata title`)
|
|
|
|
(defpoll volume
|
|
:interval "5s"
|
|
:initial "0"
|
|
`amixer sget Master | awk -F"[][]" '/Left:/ { print $2 }' | tr -d '%'`)
|
|
|
|
(defwidget time[]
|
|
(box :class "time-container" :width 300 :height 30
|
|
(label :text date_str)
|
|
(label :text time_str)
|
|
))
|
|
|
|
|
|
(defwidget icon_stat[icon text ?visible]
|
|
(box :class "icon-stat" :orientation "h" :space-evenly false :visible visible
|
|
(label :width 30 :class "icon" :text icon)
|
|
(label :class "text" :text text))
|
|
)
|
|
|
|
(defwidget stat_box[label text]
|
|
(box :class "stat-box" :orientation "h" :spacing 0 :space-evenly false
|
|
(box :width 4)
|
|
(box :orientation "v" :spacing 0 :space-evenly false
|
|
(box :height 4)
|
|
(label :class "text" :text text)
|
|
(label :class "label" :text label)
|
|
(box :height 4))
|
|
(box :width 4)
|
|
))
|
|
|
|
(defwidget section[]
|
|
(box :class "section" :orientation "v" :space-evenly false
|
|
(box :height 10)
|
|
(children)
|
|
(box :height 10)
|
|
))
|
|
|
|
(defwidget pbar[text progress tooltip ?class ?visible]
|
|
(box :class "pbar ${class}"
|
|
:orientation "h"
|
|
:visible visible
|
|
:space-evenly false
|
|
:tooltip tooltip
|
|
(label :text text :width 40 :halign "center")
|
|
(progress :value progress :valign "center" :width 240)))
|
|
|
|
(defwidget tasks[]
|
|
(box :class "task-container" :orientation "v" :halign "start" :spacing 5 :width 300 :space-evenly false
|
|
(for task in {tasks-data.tasks}
|
|
(box
|
|
:class {task.state == "DONE" ? "task-item complete" : task.trigger == "Deadline:" ? "task-item deadline" : "task-item"}
|
|
:orientation "h"
|
|
:spacing 3
|
|
:halign "start" :space-evenly false :height 30 :valign "start"
|
|
(box :width 10)
|
|
(label :text {task.state != "" ? task.state == "TODO" ? " " : " " : " ${task.time}"}
|
|
:class {task.state != "" ? "task-state" : "task-time"}
|
|
:halign "start")
|
|
(label :text {task.title} :wrap true :justify "left" :xalign 0)))
|
|
))
|
|
(defwidget separator[]
|
|
(box :orientation "v" :space-evenly false
|
|
(box :height 10)
|
|
(box :class "separator" :height 1)
|
|
(box :height 9)
|
|
))
|
|
|
|
(defwidget disk[mount]
|
|
(pbar
|
|
:text ""
|
|
:progress {EWW_DISK[mount].used_perc}
|
|
:visible {EWW_DISK[mount] != "null"}
|
|
:tooltip "${mount}: ${round(EWW_DISK[mount].used_perc, 2)}%"))
|
|
|
|
(defwindow side-panel
|
|
:monitor 0
|
|
:geometry (geometry :x "10px"
|
|
:y "0%"
|
|
:width "300px"
|
|
:height "99%"
|
|
:anchor "center left")
|
|
:stacking "fg"
|
|
:windowtype "dock"
|
|
:exclusive true
|
|
:wm-ignore false
|
|
(box :orientation "v" :halign "center" :valign "start" :spacing 4 :space-evenly false
|
|
(section
|
|
(time)
|
|
(separator)
|
|
(tasks))
|
|
(section
|
|
(box :orientation "v" :spacing 2 :space-evenly: false
|
|
(pbar :text "" :progress {EWW_RAM.used_mem_perc} :tooltip "${round(EWW_RAM.used_mem / 1024 / 1024 / 1024, 2)}GB used")
|
|
(pbar :text "" :progress {EWW_CPU.avg} :tooltip "${round(EWW_CPU.avg, 2)}% average usage")
|
|
(literal :visible {EWW_BATTERY != ""} :content {EWW_BATTERY != "" ? '
|
|
(pbar :text {EWW_BATTERY.BAT0?.status == "Discharging" ? "" : ""}
|
|
:class {EWW_BATTERY.BAT0?.status == "Discharging" ? "bat-discharging" : "bat-charging"}
|
|
:progress {EWW_BATTERY.BAT0?.capacity}
|
|
:visible {EWW_BATTERY.BAT0 != ""}
|
|
:tooltip "${EWW_BATTERY?.BAT0?.status}: ${round(EWW_BATTERY?.BAT0?.capacity, 2)}%")
|
|
' : ""})
|
|
(disk :mount "/")
|
|
(disk :mount "/home/joe/Projects")
|
|
(disk :mount "/mnt/glacier"))
|
|
|
|
(separator)
|
|
(box :orientation "h" :halign "center" :spacing 5
|
|
(icon_stat :icon "" :text "Ethernet" :visible {active-network.type == "ethernet"})
|
|
(icon_stat :icon " " :text "${active-network.name}" :visible {active-network.type == "wifi"})
|
|
(icon_stat :icon "" :text "${round(EWW_NET[net-interface].NET_DOWN / 1024 / 1024 / 2, 2)}mb")
|
|
(icon_stat :icon "" :text "${round(EWW_NET[net-interface].NET_UP / 1024 / 1024 / 2, 2)}mb"))
|
|
)
|
|
|
|
(section
|
|
(box :orientation "h" :spacing 15
|
|
(box :width 15)
|
|
(stat_box :label "New" :text {mail-data.new})
|
|
(stat_box :label "Read" :text {mail-data.read})
|
|
(box :width 15)
|
|
))
|
|
(section
|
|
(label :visible {player-status == ""} :text "No player active")
|
|
(box :orientation "h" :space-evenly false :spacing 10 :visible {player-status != ""}
|
|
(eventbox :onclick "playerctl play-pause"
|
|
(label :width 50 :text {player-status == "Playing" ? "" : "" }))
|
|
(box :class "music-art" :style 'background-image: url("${player-art}");' :width 60 :height 60)
|
|
(box :orientation "v"
|
|
(progress :value {player-position / (player-length / 1000000) * 100} :valign "center")
|
|
(label :class "artist" :text artist :limit-width 15 :show-truncated true :halign "start")
|
|
(label :text track :halign "start" :limit-width 20 :show-truncated true)
|
|
)
|
|
)
|
|
(separator)
|
|
(box :orientation "h" :space-evenly false :halign "center" :spacing 20
|
|
(label :text "" :width 20)
|
|
(progress :width 200 :value {volume} :valign "center"))
|
|
)
|
|
))
|