Added wayland, hyprland and eww

This commit is contained in:
marc
2024-03-02 17:38:35 +01:00
parent 95944b2486
commit 466ddf2cd9
27 changed files with 591 additions and 13 deletions

View File

@@ -0,0 +1,21 @@
(defvar battery-reveal false)
(defwidget battery-module []
(eventbox :onhover "${EWW_CMD} update battery-reveal=true"
:onhoverlost "${EWW_CMD} update battery-reveal=false"
(box :class "module battery ${EWW_BATTERY.BAT0.status == "Discharging" ? "discharging" : "charging"}"
:orientation "h"
:space-evenly "false"
:tooltip "Battery: ${EWW_BATTERY.BAT0.capacity}%"
(label :text {EWW_BATTERY.BAT0.status == "Discharging" ?
EWW_BATTERY.BAT0.capacity < 10 ? "󰂎" : EWW_BATTERY.BAT0.capacity < 30 ? "󱊡" : EWW_BATTERY.BAT0.capacity < 70 ? "󱊢" : "󱊣" :
EWW_BATTERY.BAT0.capacity < 10 ? "󰢟" : EWW_BATTERY.BAT0.capacity < 30 ? "󱊤" : EWW_BATTERY.BAT0.capacity < 70 ? "󱊥" : "󱊦"}
:class "battery icon")
(revealer :transition "slideleft"
:duration "750ms"
:reveal {battery-reveal}
(progress :class "battery-bar"
:orientation "h"
:valign "center"
:width 60
:value {EWW_BATTERY.BAT0.capacity})))))

View File

@@ -0,0 +1,26 @@
(defpoll clock-time :interval "1s" "date +\"%H:%M:%S\"")
(defpoll clock-date :interval "1m" "date +\"%d/%m\"")
(defpoll clock-year :interval "1h" "date +\"%Y\"")
(defvar date-reveal false)
(defwidget clock-module []
(eventbox
:onhover "${EWW_CMD} update date-reveal=true"
:onhoverlost "${EWW_CMD} update date-reveal=false"
(box
:class "module clock"
:orientation "h"
:space-evenly "false"
(label
:text clock-time
:class "clock-time")
(revealer
:transition "slideleft"
:duration "750ms"
:reveal {date-reveal}
(box
:orientation "h"
(label :text clock-date
:class "clock-date")
(label :text clock-year
:class "clock-year"))))))

View File

@@ -0,0 +1,3 @@
(defwidget sep []
(label :text "|"
:class "separator"))

View File

@@ -0,0 +1,26 @@
(defpoll vinfo
:initial "{\"volume\": 0, \"muted\": false}"
:interval "1s"
"bash ~/.config/eww/scripts/get-volume-info.sh")
(defvar volume-reveal false)
(defwidget volume-module []
(eventbox :onhover "${EWW_CMD} update volume-reveal=true"
:onhoverlost "${EWW_CMD} update volume-reveal=false"
(box :class "module volume"
:orientation "h"
:space-evenly false
:tooltip {vinfo.muted? "muted" : "Volume: ${vinfo.volume}%"}
(label :text {vinfo.muted ? "󰝟" : vinfo.volume < 10 ? "󰕿" : vinfo.volume < 70 ? "󰖀" : "󰕾"}
:class "volume icon ${vinfo.muted ? "volume-mute" : ""}")
(revealer :transition "slideleft"
:duration "750ms"
:reveal {volume-reveal && !vinfo.muted}
(scale :class "volume-bar"
:orientation "h"
:valign "center"
:width 60
:min 0
:max 101
:value {vinfo.volume}
:onchange "amixer sset Master {}% > /dev/null")))))

View File

@@ -0,0 +1,25 @@
(defvar wifi-reveal false)
(defpoll winfo
:initial "{\"connected\": \"false\"}"
:interval "10s"
"bash ~/.config/eww/scripts/get-wifi-info.sh")
(defwidget wifi-module []
(eventbox :onhover "${EWW_CMD} update wifi-reveal=true"
:onhoverlost "${EWW_CMD} update wifi-reveal=false"
:onclick "$HOME/.config/rofi/menus/wifi/wifi.sh"
(box :class "module wifi"
:orientation "h"
:space-evenly "false"
:tooltip {winfo.connected ? "Signal: ${winfo.signal}%" : "Disconnected"}
(label :text { !winfo.connected ? "󰤭" :
winfo.signal < 25 ? "󰤟" :
winfo.signal < 50 ? "󰤢" :
winfo.signal < 75 ? "󰤥" : "󰤨"}
:class "wifi icon")
(revealer :transition "slideleft"
:duration "750ms"
:reveal {wifi-reveal && winfo.connected}
(label :class "wifi-text"
:text {winfo.connected ? winfo.ssid : "Disconnected"})))))

View File

@@ -0,0 +1,10 @@
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces.sh")
(deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/get-active-workspace.sh")
(defwidget workspaces-module []
(box :space-evenly true
(label :text "${workspaces}${current_workspace}"
:visible false)
(for workspace in workspaces
(eventbox :onclick "hyprctl dispatch workspace ${workspace.id}"
(box :class "workspace-entry ${workspace.id == current_workspace ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}"
(label :text "${workspace.id == current_workspace ? "" : ""}"))))))