Files
nixos-config/user/files/eww/eww.yuck
Morten Olsen 6a41699dc3 init
2023-09-12 08:28:05 +02:00

223 lines
5.8 KiB
Plaintext

(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces")
(deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/get-active-workspace")
(defwidget workspaces []
(eventbox :onscroll "bash ~/.config/eww/scripts/change-active-workspace {} ${current_workspace}" :class "workspaces-widget"
(box :space-evenly true :orientation "v"
(for workspace in workspaces
(eventbox :onclick "hyprctl dispatch workspace ${workspace.id}"
(box :orientation "v" :class "workspace-entry ${workspace.id == current_workspace ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}"
(label :text "${workspace.id}")
)
)
)
)
)
)
;; Created by https://github.com/rxyhn
;; Designed by https://github.com/rxyhn
;; Maintaned by https://github.com/rxyhn
;; put path to aesthetic bar config files here ;;
(defvar eww "/usr/bin/eww -c $HOME/.config/eww")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Widget Section's ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Launcher Widgets ;;
(defwidget launcher []
(box :orientation "v"
:space-evenly "false"
:spacing -15
(button :class "launcher_icon"
:onclick "scripts/popup launcher" "")))
;; Volume Widgets ;;
(defwidget volum []
(eventbox :onhover "${eww} update volum=true"
:onhoverlost "${eww} update volum=false"
(box :orientation "v"
:space-evenly "false"
:spacing "2"
(revealer :transition "slideup"
:reveal volum
:duration "150ms"
(scale :class "volbar"
:value current-volume
:orientation "v"
:flipped true
:tooltip "Volume: ${current-volume}%"
:max 101
:min 0
:onchange "amixer sset Master {}%" ))
(button :onclick "pavucontrol" :class "volume-icon" ""))))
(defpoll current-volume :interval "1s" "~/.config/eww/scripts/getvol")
(defvar volum false)
;; Wifi Widgets ;;
(defwidget wifi []
(box :orientation "v"
:tooltip wifi-name
(button :onclick "scripts/popup wifi"
:class "wifi-icon" wifi-icon)))
(defpoll wifi-icon :interval "1s" "scripts/wifi icon")
(defpoll wifi-name :interval "1s" "scripts/wifi name")
;; Brightness Widgets ;;
(defwidget bright []
(eventbox :onhover "${eww} update bright=true"
:onhoverlost "${eww} update bright=false"
(box :orientation "v"
:space-evenly "false"
:spacing 2
(revealer :transition "slideup"
:reveal bright
:duration "550ms"
(scale :class "bribar"
:value current-brightness
:tooltip "Brightness: ${current-brightness}%"
:onchange "brightnessctl set {}%"
:orientation "v"
:flipped true
:max 101
:min 0))
(label :class "brightness-icon"
:text ""))))
(defpoll current-brightness :interval "1s" "brightnessctl -m | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%'")
(defvar bright false)
;; Control Panel Widgets ;;
(defwidget control []
(box :orientation "v"
:space-evenly false
:class "control"
(volum)(bright)(wifi)))
;; Clock Widgets ;;
(defwidget time []
(box :orientation "v"
:class "time"
:valign "end"
(button :onclick "scripts/popup calendar"
:class "time-hour" hour)
(button :onclick "scripts/popup calendar"
:class "time-min" min)))
(defpoll hour :interval "1s" "date '+%H'")
(defpoll min :interval "1s" "date '+%M'")
;; Calendar Widgets ;;
(defwidget cal []
(box :class "cal-box"
:orientation "v"
(box :class "cal-inner-box"
(calendar :class "cal"
:day calendar_day
:month calendar_month
:year calendar_year))))
(defpoll calendar_day :interval "10h"
"date '+%d'")
(defpoll calendar_month :interval "10h"
"scripts/calendar")
(defpoll calendar_year :interval "10h"
"date '+%Y'")
;; Powermenu Widgets ;;
(defwidget power []
(eventbox :onhover "${eww} update power=true"
:onhoverlost "${eww} update power=false"
(box :orientation "v"
:space-evenly "false"
:vexpand "false"
:class "powermenu"
(revealer :transition "slideup"
:reveal power
:duration "550ms"
(box :orientation "v"
:space-evenly "false"
(button :class "button-bspres"
:tooltip "BSPWM Restart"
:onclick "bspc wm -r" "" )
(button :class "button-reb"
:tooltip "Reboot"
:onclick "reboot" "")
(button :class "button-quit"
:tooltip "Logout"
:onclick "killall bspwm" "")
(button :class "button-lock"
:tooltip "Lock Screen"
:onclick "betterlockscreen -l" "")))
(button :class "button-off"
:tooltip "Shutdown"
:onclick "shutdown now" ""))))
(defvar power false)
;; Top Widgets ;;
(defwidget top []
(box :orientation "v"
:space-evenly "false"
:valign "start"
(launcher)
(workspaces)))
;; Bottom Widgets ;;
(defwidget bottom []
(box :orientation "v"
:space-evenly false
(time)
(power)))
;; End Widgets ;;
(defwidget end []
(box :orientation "v"
:space-evenly "false"
:valign "end"
:spacing 5
(control)
(bottom)))
;; Bar Widgets ;;
(defwidget bar []
(box :class "eww_bar"
:orientation "v"
:vexpand "false"
:hexpand "false"
(top)
(end)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Window Section's ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Bar Windows ;;
(defwindow bar
:geometry (geometry :x "0"
:y "0"
:height "100%"
:width "47px")
:monitor 0
:reserve (struts :distance "35px"
:side "left")
:wm-ignore false
:hexpand "false"
:vexpand "false"
(bar))
;; Calendar Windows ;;
(defwindow calendar
:geometry (geometry :x "70px"
:y "65%"
:width "270px"
:height "60px")
(cal))