💥 eww(bar/workspaces): fix workspace indicator with a literal script

This commit is contained in:
retrozinndev
2024-12-10 10:41:06 -03:00
parent 75ce9fa8f9
commit cacc59cb8e
41 changed files with 377 additions and 782 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
(overlay
(scale :min 0
:max 100
:value "${volume_json.output}"
:value "${json_volume.output}"
:orientation "horizontal"
:draw-value false
:flipped false
+1 -1
View File
@@ -5,7 +5,7 @@
(overlay
(scale :min 0
:max 100
:value "${volume_json.source}"
:value "${json_volume.source}"
:orientation "horizontal"
:draw-value false
:flipped false
+2 -5
View File
@@ -1,15 +1,12 @@
(deflisten json_audio :initial `{ "output": 35, "source": 80 }`
`sh ./scripts/get-volume-watch.sh`)
(defwidget audio []
(eventbox :onclick "eww open --toggle audio-popup"
:class "audio-eventbox"
(box :class "audio"
(eventbox :onscroll `[ {} == "up" ] && wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ || wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-`
(label :text "${ json_audio.output != 0 ? '󰕾' : '󰝟' } ${json_audio.output}%"))
(label :text "${ json_volume.output != 0 ? '󰕾' : '󰝟' } ${json_volume.output}%"))
(eventbox :onscroll `[ {} == "up" ] && wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 5%+ || wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 5%-`
(label :text "${ json_audio.source != 0 ? '󰍬' : '󰍭' } ${json_audio.source}%"))
(label :text "${ json_volume.source != 0 ? '󰍬' : '󰍭' } ${json_volume.source}%"))
)
)
)
@@ -1,5 +1,5 @@
(defwidget control-center-toggle []
(defwidget cc-toggle []
(box :class "control-center-toggle"
(button :onclick "eww open --toggle control-center"
" ")
+1 -5
View File
@@ -1,10 +1,6 @@
(defpoll datetime :interval "10s"
`date +"%A %d, %H:%M"`)
(defwidget clock []
(box :class "clock"
(button :onclick "eww open calendar-window --toggle"
"${datetime}")
"${day-name} ${day}, ${time}")
)
)
+1 -14
View File
@@ -1,19 +1,6 @@
(deflisten json_workspaces :initial '[{"id": "1"},{"id": "2"}]'
`sh ./scripts/workspaces.sh`)
(deflisten json_active_workspace :initial '{ "id": 1 }'
`sh ./scripts/active-workspace.sh`)
(defwidget workspaces []
(eventbox :onscroll "[[ {} == up ]] && hyprctl dispatch workspace e+1 >> /dev/null || hyprctl dispatch workspace e-1 >> /dev/null"
(box :class "workspaces"
:space-evenly false
(for workspace in json_workspaces
(button :onclick "hyprctl dispatch workspace ${workspace.id}"
:class "${ json_active_workspace.id == workspace.id ? "active" : "default" }"
"")
)
)
(literal :content literal_workspaces)
)
)
@@ -1,8 +1,5 @@
(include "widgets/control-center/notification.yuck")
(deflisten json_notification_history :initial "{[]}"
`python ./scripts/notification-watcher.py`)
(defwidget notifications []
(box :class "cc-notifications"
:space-evenly false
@@ -11,7 +8,7 @@
(scroll :class "vertical-scroll"
:hscroll false
:vscroll true
:height 400 ; Adjust according to your screen size
:height 400 ; Adjust according to control center size
:vexpand true
(box :class "notifications"
@@ -49,7 +46,7 @@
"󰒲")
(button :class "clear-all"
:onclick "dunstctl history-clear"
"Clear all ")
"Clear all")
)
)
)
+6 -2
View File
@@ -1,4 +1,5 @@
(deflisten hostname :initial "GNU/Linux"
(defpoll hostname :initial "GNU/Linux"
:interval "24h"
`cat /etc/hostname`)
(defpoll uptime_info :interval "50s"
@@ -13,7 +14,7 @@
:halign "start"
(label :xalign 0
:text " ${hostname}"
:text " ${hostname}"
:class "hostname")
(label :xalign 0
@@ -29,6 +30,9 @@
(button :class "lock"
:onclick "hyprctl dispatch exec hyprlock"
"󰌾")
(button :class "color-picker"
:onclick "sh $HOME/.config/eww/scripts/color-picker.sh"
"󰴱")
(button :class "powermenu"
:onclick "eww close-all; eww open powermenu"
"󰗽")
+50 -14
View File
@@ -1,36 +1,72 @@
(defwidget toggle-grid []
(box :class "toggle-grid"
(grid-toggle :class "network"
:icon "󰈀"
:header "Network"
:active true ; This sets if toggle is enabled or not, put condition check here
:body "Connected" ; Generally put state here
:visible true
:max-width 128
:max-height 48
:onclick "notify-send 'Network' 'toggle network with nmcli!'"
:orientation "vertical"
(box :orientation "horizontal"
:class "row"
(grid-toggle :class "network"
:icon "󰈀"
:header "Network"
:active true ; This sets if toggle is enabled or not, put condition check here
:body "Connected" ; Put state here (e.g.: enabled, disabled)
:visible true
:onclick "notify-send 'Network' 'toggle network with nmcli!'"
)
(grid-toggle :class "bluetooth"
:icon "󰂯"
:header "Bluetooth"
:active false
:body "Connected"
:visible true
:onclick "notify-send 'Network' 'toggle network with nmcli!'"
)
(grid-toggle :class "dnd"
:icon "󰍶"
:header "Do Not Disturb"
:active false
:body "Disabled"
:visible true
:onclick "notify-send 'Network' 'toggle network with nmcli!'"
)
)
(box :orientation "horizontal"
:class "row"
:space-evenly false
(grid-toggle :class "airplane"
:icon "󰀝"
:header "Airplane Mode"
:active false
:body "Disabled"
:visible true
:onclick "notify-send 'Network' 'toggle network with nmcli!'"
)
)
)
)
(defwidget grid-toggle [ class onclick active ?icon header body visible max-width max-height ]
(defwidget grid-toggle [ class onclick active ?icon header body visible ]
(eventbox :visible "${visible}"
:onclick "${onclick}"
:class "${class} ${ active ? 'active' : '' }"
:class "grid-toggle ${class} ${ active == true ? 'active' : '' } button"
(box :class "toggle"
:space-evenly false
:orientation "horizontal"
:width 142
:height 52
(label :class "icon"
:visible { icon != "" ? true : false }
:valign "center"
"${icon}")
:text "${icon}")
(box :orientation "vertical"
:space-evenly false
(label :class "header"
"${header}")
:text "${header}"
:xalign 0)
(label :class "body"
"${body}")
:text "${body}"
:xalign 0)
)
)
)