first commit
This commit is contained in:
274
eww.yuck
Normal file
274
eww.yuck
Normal file
@@ -0,0 +1,274 @@
|
||||
;;main status bar and whatnot
|
||||
(defwindow bar
|
||||
:monitor 0
|
||||
:stacking "fg"
|
||||
:windowtype "dock"
|
||||
:vexpand false
|
||||
:exclusive "true"
|
||||
:geometry (geometry
|
||||
:y "3px"
|
||||
:width "99%"
|
||||
:anchor "bottom center")
|
||||
(bar)
|
||||
)
|
||||
|
||||
(defpoll time :interval "1s" :initial `date +%H:%M:%S` `date +%H:%M:%S`)
|
||||
(defpoll date :interval "1m" "date +%m/%d/%y")
|
||||
(defpoll ip_addr :interval "1h" 'ip -j a show enp0s3')
|
||||
(defpoll volume :interval "250ms" 'wpctl get-volume @DEFAULT_SINK@') ;;turn this into a script or smth
|
||||
(defpoll active_workspaces :interval "250ms" "hyprctl workspaces -j")
|
||||
(defpoll active_window :interval "500ms" 'hyprctl activewindow -j')
|
||||
(defpoll current_workspace :interval "250ms" "hyprctl activeworkspace -j")
|
||||
(deflisten splash :initial "yo" "hyprctl splash")
|
||||
(defvar reveal_calendar false)
|
||||
(defvar reveal_sound false)
|
||||
(defvar reveal_sound_menu false)
|
||||
(defvar network_interface "enp0s3") ;;the interface to listen to
|
||||
(defvar reveal_apps 0)
|
||||
(defvar browser "microsoft-edge")
|
||||
(defvar filemanager "pcmanfm")
|
||||
|
||||
|
||||
;; DONE workspaces
|
||||
;; DONE date
|
||||
;; KINDA DONE networking
|
||||
;; DONE volume
|
||||
;; make the sound icon do smth
|
||||
;; power menu
|
||||
;; DONE app tray
|
||||
|
||||
(defwidget workspaces []
|
||||
(box
|
||||
:class "workspaces island"
|
||||
:orientation "h"
|
||||
:space-evenly true
|
||||
:halign "start"
|
||||
:spacing 3
|
||||
(for wsp in active_workspaces
|
||||
(button
|
||||
:class {current_workspace.id == wsp.id ? "active_workspace" : "workspaces"}
|
||||
:onclick "hyprctl dispatch workspace ${wsp.id}" {wsp.id}))
|
||||
(label :visible false :text "${current_workspace}") ;;this is a dummy widget since current_workspace won't poll otherwise
|
||||
))
|
||||
|
||||
(defwidget sound []
|
||||
(eventbox
|
||||
:onhover "eww update reveal_sound=true"
|
||||
:onhoverlost "eww update reveal_sound=false"
|
||||
(box
|
||||
:space-evenly false
|
||||
:orientation "h"
|
||||
:spacing "3"
|
||||
(revealer
|
||||
:reveal reveal_sound
|
||||
:transition "slideleft"
|
||||
:duration "500ms"
|
||||
(scale
|
||||
:draw-value true
|
||||
:value-pos "right"
|
||||
:min 0
|
||||
:max 101
|
||||
:orientation "h"
|
||||
:value {substring(volume,8,4) * 100}
|
||||
:onchange "wpctl set-volume @DEFAULT_SINK@ {}%")
|
||||
)
|
||||
""
|
||||
)
|
||||
))
|
||||
|
||||
(defwidget time-and-date []
|
||||
(eventbox
|
||||
:onclick "eww update ${selected_widget != 1 ? "selected_widget=1" : "selected_widget=0"}"
|
||||
(box
|
||||
:class "timendate"
|
||||
:spacing 1
|
||||
:space-evenly false
|
||||
:halign "start"
|
||||
:orientation "v"
|
||||
:tooltip time
|
||||
{substring(time,0,strlength(time)-3)}
|
||||
date))
|
||||
)
|
||||
|
||||
(defwidget network []
|
||||
(box
|
||||
:class "monitor"
|
||||
:orientation "v"
|
||||
"${network_interface}"
|
||||
(label :limit_width 25 :wrap true :text "ip: ${ip_addr[0].addr_info[0].local}")
|
||||
(label :text ":${round(EWW_NET.enp0s3.NET_UP / 1000000 * 8, 1)} / :${round(EWW_NET.enp0s3.NET_DOWN / 1000000 * 8, 1)} mbps")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defwidget center []
|
||||
(eventbox
|
||||
:class "center island"
|
||||
:onhover "eww update reveal_apps=1"
|
||||
:onhoverlost "eww update reveal_apps=0"
|
||||
(stack
|
||||
:selected reveal_apps
|
||||
:transition "slidedown"
|
||||
:samesize true
|
||||
(label :class "center island" :text "${active_window.title ?: splash}")
|
||||
(box
|
||||
:orientation "h"
|
||||
:space-evenly true
|
||||
(button :onclick {browser} "")
|
||||
(button :onclick {filemanager} ""))
|
||||
)))
|
||||
|
||||
|
||||
(defwidget right []
|
||||
(box
|
||||
:class "island"
|
||||
:spacing 5
|
||||
:orientation "h"
|
||||
:space-evenly false
|
||||
:halign "end"
|
||||
(systray
|
||||
:spacing 3
|
||||
:orientation "h"
|
||||
:space-evenly false
|
||||
:icon-size 5
|
||||
:prepend-new false)
|
||||
(sound)
|
||||
(time-and-date)
|
||||
))
|
||||
|
||||
(defwidget bar []
|
||||
(centerbox
|
||||
:orientation "h"
|
||||
:class "bar"
|
||||
(workspaces)
|
||||
;; (label :class "center island" :text "${active_window.title ?: splash}")
|
||||
(center)
|
||||
(right)
|
||||
))
|
||||
|
||||
|
||||
(defvar selected_widget 0)
|
||||
|
||||
;;sub window for widgets
|
||||
(defwindow widget_window []
|
||||
:monitor 0
|
||||
:geometry (geometry
|
||||
:y "2%"
|
||||
:x "2%"
|
||||
:anchor "right bottom")
|
||||
|
||||
:stacking "overlay"
|
||||
:exclusive false
|
||||
(sub_window)
|
||||
)
|
||||
|
||||
(defwidget sub_window []
|
||||
(stack
|
||||
:selected selected_widget
|
||||
:transition "slideup"
|
||||
:same-size false
|
||||
""
|
||||
(calendar)
|
||||
(power_menu)
|
||||
)
|
||||
)
|
||||
|
||||
(defwidget power_menu []
|
||||
(box
|
||||
:class "island"
|
||||
:orientation "v"
|
||||
:space-evenly false
|
||||
(button
|
||||
:onclick "shutdown now"
|
||||
"shutdown")
|
||||
(button
|
||||
:onclick "hyprctl dispatch exit"
|
||||
"logout")
|
||||
(button
|
||||
:onclick "reboot"
|
||||
"restart")
|
||||
(button
|
||||
:onclick "eww update selected_widget=0"
|
||||
"X")
|
||||
)
|
||||
)
|
||||
|
||||
;;second monitor can have cpu and ram usage, cpu temp, time
|
||||
|
||||
(defwindow resource_monitor []
|
||||
:monitor 0
|
||||
:geometry (geometry
|
||||
:y "5%"
|
||||
:x "5%"
|
||||
:width "20%"
|
||||
:height "20%"
|
||||
:anchor "left top")
|
||||
:stacking "bottom"
|
||||
:exclusive false
|
||||
(resource_widget))
|
||||
|
||||
|
||||
(defwidget resource_widget []
|
||||
(box
|
||||
:orientation "v"
|
||||
:halign "start"
|
||||
:space-evenly false
|
||||
(label :class "monitor clock" :text {time})
|
||||
(cpu)
|
||||
(ram)
|
||||
(disk)
|
||||
(network)
|
||||
(visualizer)
|
||||
))
|
||||
|
||||
(defwidget cpu []
|
||||
(box
|
||||
:orientation "h"
|
||||
:space-evenly true
|
||||
:halign "start"
|
||||
(box
|
||||
:class "monitor"
|
||||
:orientation "v"
|
||||
(label :text "cpu avg: ${round(EWW_CPU.avg, 1)}%")
|
||||
(for core in {EWW_CPU.cores}
|
||||
(label :tooltip "${core.freq} Mhz" :text "${core.core}: ${core.usage}%")))
|
||||
(box
|
||||
:class "monitor"
|
||||
(graph
|
||||
:thickness 2
|
||||
:time-range "10s"
|
||||
:max 100
|
||||
:value {round(EWW_CPU.avg,1)}))
|
||||
))
|
||||
|
||||
(defwidget ram []
|
||||
(box
|
||||
:orientation "h"
|
||||
(box
|
||||
:class "monitor"
|
||||
:orientation "v"
|
||||
(label :text "RAM: ${round(EWW_RAM.used_mem/1000000000, 2)}/${round(EWW_RAM.total_mem/1000000000, 2)} GB")
|
||||
(label :text "Available: ${round(EWW_RAM.available_mem/1000000000, 2)} GB")
|
||||
)
|
||||
))
|
||||
|
||||
(defwidget disk []
|
||||
(box
|
||||
:class "monitor"
|
||||
:orientation "h"
|
||||
:space-evenly false
|
||||
(label :text "/: ${round(EWW_DISK["/"].free/1000000000, 2)}/${round(EWW_DISK["/"].total/1000000000,2)} GB")
|
||||
(circular-progress
|
||||
:value {round(EWW_DISK["/"].used_perc, 1)}
|
||||
:thickness 6)
|
||||
(label :text "${round(EWW_DISK["/"].used_perc, 1)}% used")
|
||||
))
|
||||
|
||||
(deflisten cava "bash $HOME/.config/eww/scripts/cava.sh")
|
||||
|
||||
(defwidget visualizer []
|
||||
(box
|
||||
:class "monitor"
|
||||
:orientation "h"
|
||||
(label :class "visualizer" :text cava)
|
||||
))
|
||||
Reference in New Issue
Block a user