mirror of
https://github.imc.re/void-land/hyprland-void-dots
synced 2025-04-18 17:46:53 +02:00
refactor: eww bar modules
This commit is contained in:
parent
ae8e8f956f
commit
fe323d6f63
11 changed files with 76 additions and 45 deletions
|
@ -1,6 +1,9 @@
|
|||
(include "./src/widgets/_revealer.yuck")
|
||||
(include "./src/_definitions.yuck")
|
||||
|
||||
(include "./src/-components/_helpers.yuck")
|
||||
(include "./src/-modules/_language.yuck")
|
||||
(include "./src/-modules/_workspaces.yuck")
|
||||
|
||||
(include "./setups/sidebar.yuck")
|
||||
(include "./setups/panel.yuck")
|
||||
(include "./src/wallpapers/main.yuck")
|
||||
|
|
Binary file not shown.
6
hypr-configs/hyprland/eww/scripts/kb-layout/get-active
Executable file
6
hypr-configs/hyprland/eww/scripts/kb-layout/get-active
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
hyprctl devices | grep -A 3 "$DEVICE$" | grep "active keymap:" | tail -n 1 | awk '{print toupper(substr($3,1,2))}'
|
||||
|
||||
socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - |
|
||||
stdbuf -o0 awk -F '>>|,' -e '/^activelayout>>/ {print toupper(substr($3, 1, 2))}'
|
10
hypr-configs/hyprland/eww/scripts/kb-layout/set-active
Executable file
10
hypr-configs/hyprland/eww/scripts/kb-layout/set-active
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
hyprctl \
|
||||
--batch "$(
|
||||
hyprctl devices -j |
|
||||
jq -r '.keyboards[] | .name' |
|
||||
while IFS= read -r keyboard; do
|
||||
printf '%s %s %s;' 'switchxkblayout' "${keyboard}" 'next'
|
||||
done
|
||||
)"
|
|
@ -24,14 +24,14 @@ control() {
|
|||
LOCK_FILE="$HOME/.config/eww-control.lock"
|
||||
|
||||
run() {
|
||||
${EWW_BIN} open control_panel
|
||||
${EWW_BIN} open ControlPanel
|
||||
}
|
||||
|
||||
if [[ ! -f "$LOCK_FILE" ]]; then
|
||||
touch "$LOCK_FILE"
|
||||
run && echo "ok good!"
|
||||
else
|
||||
${EWW_BIN} close control_panel
|
||||
${EWW_BIN} close ControlPanel
|
||||
rm "$LOCK_FILE" && echo "closed"
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(defwidget hovered-sign [var]
|
||||
(defwidget HoveredSign [var]
|
||||
(box :space-evenly false
|
||||
(revealer :reveal {!var}
|
||||
:duration "100ms"
|
||||
|
@ -9,7 +9,7 @@
|
|||
:transition "slideleft"
|
||||
(children :nth 1))))
|
||||
|
||||
(defwidget reveal_on_hover [var varname ?class ?duration ?transition]
|
||||
(defwidget RevealOnHover [var varname ?class ?duration ?transition]
|
||||
(box
|
||||
:class "${class}"
|
||||
:orientation "v"
|
||||
|
@ -33,7 +33,7 @@
|
|||
)
|
||||
|
||||
|
||||
(defwidget clickbox [var varname ?class ?duration ?transition]
|
||||
(defwidget ClickBox [var varname ?class ?duration ?transition]
|
||||
(box :class "${class} clickbox" :orientation "h" :space-evenly false
|
||||
(button :onclick "eww update ${varname}=${ var ? false : true }"
|
||||
(children :nth 0))
|
11
hypr-configs/hyprland/eww/src/-modules/_clock.yuck
Normal file
11
hypr-configs/hyprland/eww/src/-modules/_clock.yuck
Normal file
|
@ -0,0 +1,11 @@
|
|||
(defwidget Clock []
|
||||
(eventbox
|
||||
:cursor "pointer"
|
||||
:onclick "${EWW_CMD} open calendar --toggle"
|
||||
(box
|
||||
:orientation "v"
|
||||
:space-evenly false
|
||||
:class "widget clock"
|
||||
(label :text thour)
|
||||
(label :text tmin)
|
||||
(label :text tpm))))
|
3
hypr-configs/hyprland/eww/src/-modules/_language.yuck
Normal file
3
hypr-configs/hyprland/eww/src/-modules/_language.yuck
Normal file
|
@ -0,0 +1,3 @@
|
|||
(defwidget Language []
|
||||
(button :class "widget" :onclick "./scripts/kb-layout/set-active"
|
||||
(label :text {kbLayout})))
|
26
hypr-configs/hyprland/eww/src/-modules/_workspaces.yuck
Normal file
26
hypr-configs/hyprland/eww/src/-modules/_workspaces.yuck
Normal file
|
@ -0,0 +1,26 @@
|
|||
(defwidget Workspaces []
|
||||
(eventbox
|
||||
:cursor "pointer"
|
||||
:onscroll "./scripts/workspace/set-active {} ${currentWorkspace}"
|
||||
:onhover "${EWW_CMD} update showNoOfWindows=true"
|
||||
:onhoverlost "${EWW_CMD} update showNoOfWindows=false"
|
||||
|
||||
(box
|
||||
:class "workspaces"
|
||||
:space-evenly false
|
||||
:orientation "v"
|
||||
|
||||
(for workspace in {workspacesJson}
|
||||
(button
|
||||
:onclick "hyprctl dispatch workspace ${workspace.id}"
|
||||
(box
|
||||
:height 25
|
||||
:class "workspace ${workspace.id == currentWorkspace ? "workspacethingactive" : "workspacething"}"
|
||||
|
||||
(revealer
|
||||
:reveal { workspace.id == currentWorkspace}
|
||||
:transition "slideup"
|
||||
:duration 500
|
||||
|
||||
(box
|
||||
:height 40))))))))
|
|
@ -1,4 +1,6 @@
|
|||
; Global
|
||||
(defvar animationDuration "500ms")
|
||||
(deflisten kbLayout :initial "en" "./scripts/kb-layout/get-active")
|
||||
(defpoll thour :initial "0" :interval "60s" "date +'%I'")
|
||||
(defpoll tmin :initial "0" :interval "60s" "date +'%M'")
|
||||
(defpoll tpm :initial "0" :interval "60s" "date +'%p'")
|
||||
|
@ -45,14 +47,13 @@
|
|||
(defvar revealSystray true)
|
||||
|
||||
; Dock
|
||||
(defvar revealDock true)
|
||||
(deflisten tasksjson :initial "[]" "./scripts/tasklist.py")
|
||||
(defvar revealDock false)
|
||||
|
||||
; Workspaces
|
||||
(defvar show_no_of_windows false)
|
||||
(defpoll workspacesjson :initial "[]" :interval "60s" "./scripts/workspace/get-workspaces")
|
||||
(deflisten current_workspace :initial "1" "./scripts/workspace/get-active")
|
||||
|
||||
(defvar showNoOfWindows false)
|
||||
(defpoll workspacesJson :initial "[]" :interval "60s" "./scripts/workspace/get-workspaces")
|
||||
(deflisten currentWorkspace :initial "1" "./scripts/workspace/get-active")
|
||||
|
||||
; Notifications
|
||||
(deflisten notifications :initial '{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
:valign "start"
|
||||
:vexpand false
|
||||
(home)
|
||||
(workspaces)
|
||||
(Workspaces)
|
||||
(hiddenctl)
|
||||
))
|
||||
|
||||
|
@ -49,41 +49,12 @@
|
|||
:vexpand false
|
||||
:hexpand false
|
||||
; (systemtray)
|
||||
(Language)
|
||||
(sliders)
|
||||
(clock)
|
||||
; (battery)
|
||||
))
|
||||
|
||||
(defwidget workspaces []
|
||||
(eventbox
|
||||
:cursor "pointer"
|
||||
:onscroll "./scripts/workspace/set-active {} ${current_workspace}"
|
||||
:onhover "${EWW_CMD} update show_no_of_windows=true"
|
||||
:onhoverlost "${EWW_CMD} update show_no_of_windows=false"
|
||||
(box
|
||||
:class "workspaces"
|
||||
:space-evenly false
|
||||
:orientation "v"
|
||||
|
||||
(for workspace in {workspacesjson}
|
||||
(button
|
||||
:onclick "hyprctl dispatch workspace ${workspace.id}"
|
||||
(box
|
||||
:height 25
|
||||
:class "workspace ${workspace.id == current_workspace ? "workspacethingactive" : "workspacething"}"
|
||||
|
||||
(revealer
|
||||
:reveal { workspace.id == current_workspace }
|
||||
:transition "slideup"
|
||||
:duration 500
|
||||
|
||||
(box
|
||||
:height 40))))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defwidget home []
|
||||
(box
|
||||
:class "widget"
|
||||
|
@ -209,7 +180,7 @@
|
|||
(button :onclick "alacritty -e nmtui" :tooltip wifi_essid
|
||||
(label :class "icon" :style "font-size: 18px;" :text wifi_icon))
|
||||
|
||||
(reveal_on_hover
|
||||
(RevealOnHover
|
||||
:var revealVolume
|
||||
:varname "revealVolume"
|
||||
(box
|
||||
|
@ -227,7 +198,7 @@
|
|||
:min 0
|
||||
:flipped true))
|
||||
|
||||
(reveal_on_hover
|
||||
(RevealOnHover
|
||||
:var revealMicrophone
|
||||
:varname "revealMicrophone"
|
||||
(box
|
||||
|
@ -245,7 +216,7 @@
|
|||
:min 0
|
||||
:flipped true))
|
||||
|
||||
(reveal_on_hover
|
||||
(RevealOnHover
|
||||
:var revealBrightness
|
||||
:varname "revealBrightness"
|
||||
(box
|
||||
|
|
Loading…
Add table
Reference in a new issue