88 lines
3.3 KiB
Plaintext
88 lines
3.3 KiB
Plaintext
(defpoll time :interval "1s" "date '+%Y/%m/%d %H:%M:%S'")
|
|
(defpoll inhibit_status :interval "1s" "[ -f /tmp/eww-inhibit.pid ] && echo 'on' || echo 'off'")
|
|
(defpoll vol :interval "1s" :initial "0" "bash ~/.config/eww/scripts/volume.sh get")
|
|
(defpoll vol_icon :interval "1s" :initial "🔉" "bash ~/.config/eww/scripts/volume.sh icon")
|
|
(defpoll br :interval "1s" :initial "50" "bash ~/.config/eww/scripts/brightness.sh get")
|
|
(defpoll br_icon :interval "1s" :initial "☀️" "bash ~/.config/eww/scripts/brightness.sh icon")
|
|
|
|
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces.sh")
|
|
|
|
(defwidget workspaces_widget []
|
|
(box :class "workspaces" :orientation "h" :space-evenly false :spacing 5
|
|
(for ws in workspaces
|
|
(button :onclick "swaymsg workspace ${ws.name}"
|
|
:class {ws.focused ? "ws-focused" : "ws-inactive"}
|
|
"${ws.name}"))))
|
|
|
|
(defwidget date_widget []
|
|
(box :class "date-time"
|
|
(button :onclick "bash ~/.config/eww/scripts/toggle-window.sh calendar"
|
|
time)))
|
|
|
|
(defwidget volume_widget []
|
|
(box :class "volume-widget"
|
|
(button :onclick "bash ~/.config/eww/scripts/toggle-window.sh volume_popup"
|
|
:onrightclick "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
|
|
"${vol_icon} ${vol}%")))
|
|
|
|
(defwidget brightness_widget []
|
|
(box :class "brightness-widget"
|
|
(button :onclick "bash ~/.config/eww/scripts/toggle-window.sh brightness_popup"
|
|
"${br_icon} ${br}%")))
|
|
|
|
(defwidget caffeine_widget []
|
|
(box :class "caffeine"
|
|
(button :onclick "bash ~/.config/eww/scripts/toggle-inhibit.sh"
|
|
:class {inhibit_status == "on" ? "caffeine-on" : "caffeine-off"}
|
|
{inhibit_status == "on" ? "☕" : "🌙"})))
|
|
|
|
(defwidget tray_widget []
|
|
(box :halign "end" :class "tray-container" :space-evenly false :spacing 10
|
|
(brightness_widget)
|
|
(volume_widget)
|
|
(caffeine_widget)
|
|
(systray :orientation "h" :spacing 5 :icon-size 20 :prepend-new true)))
|
|
|
|
(defwidget bar_layout []
|
|
(box :class "main-container"
|
|
(centerbox :orientation "h"
|
|
(workspaces_widget)
|
|
(date_widget)
|
|
(tray_widget))))
|
|
|
|
(defwindow bar
|
|
:monitor "eDP-1"
|
|
:geometry (geometry :x "0%" :y "0%" :width "99%" :height "30px" :anchor "top center")
|
|
:stacking "fg"
|
|
:exclusive true
|
|
:focusable false
|
|
(bar_layout))
|
|
|
|
(defwindow calendar
|
|
:monitor "eDP-1"
|
|
:geometry (geometry :x "0%" :y "15px" :width "250px" :height "250px" :anchor "top center")
|
|
:stacking "fg"
|
|
:focusable false
|
|
(box :class "calendar-box"
|
|
(calendar)))
|
|
|
|
(defwindow volume_popup
|
|
:monitor "eDP-1"
|
|
:geometry (geometry :x "15px" :y "15px" :width "300px" :height "60px" :anchor "top right")
|
|
:stacking "fg"
|
|
:focusable false
|
|
(box :class "popup-box" :space-evenly false :spacing 15
|
|
(button :onclick "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" vol_icon)
|
|
(scale :class "vol-bar" :min 0 :max 101 :value {vol == "" ? 0 : vol} :width 150 :onchange "wpctl set-volume @DEFAULT_AUDIO_SINK@ {}%")
|
|
(label :text "${vol}%")))
|
|
|
|
(defwindow brightness_popup
|
|
:monitor "eDP-1"
|
|
:geometry (geometry :x "15px" :y "15px" :width "300px" :height "60px" :anchor "top right")
|
|
:stacking "fg"
|
|
:focusable false
|
|
(box :class "popup-box" :space-evenly false :spacing 15
|
|
(label :text br_icon)
|
|
(scale :class "br-bar" :min 0 :max 101 :value {br == "" ? 0 : br} :width 150 :onchange "brightnessctl s {}%")
|
|
(label :text "${br}%")))
|