diff --git a/hypr-configs/hyprland/eww/eww.yuck b/hypr-configs/hyprland/eww/eww.yuck index 81bec65..42093a9 100644 --- a/hypr-configs/hyprland/eww/eww.yuck +++ b/hypr-configs/hyprland/eww/eww.yuck @@ -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") diff --git a/hypr-configs/hyprland/eww/scripts/__pycache__/iconfetch.cpython-312.pyc b/hypr-configs/hyprland/eww/scripts/__pycache__/iconfetch.cpython-312.pyc index ba411fc..f66a0f9 100644 Binary files a/hypr-configs/hyprland/eww/scripts/__pycache__/iconfetch.cpython-312.pyc and b/hypr-configs/hyprland/eww/scripts/__pycache__/iconfetch.cpython-312.pyc differ diff --git a/hypr-configs/hyprland/eww/scripts/kb-layout/get-active b/hypr-configs/hyprland/eww/scripts/kb-layout/get-active new file mode 100755 index 0000000..d9adf5a --- /dev/null +++ b/hypr-configs/hyprland/eww/scripts/kb-layout/get-active @@ -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))}' diff --git a/hypr-configs/hyprland/eww/scripts/kb-layout/set-active b/hypr-configs/hyprland/eww/scripts/kb-layout/set-active new file mode 100755 index 0000000..7425c20 --- /dev/null +++ b/hypr-configs/hyprland/eww/scripts/kb-layout/set-active @@ -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 + )" \ No newline at end of file diff --git a/hypr-configs/hyprland/eww/scripts/pop b/hypr-configs/hyprland/eww/scripts/pop index 68014f2..f25a6d5 100755 --- a/hypr-configs/hyprland/eww/scripts/pop +++ b/hypr-configs/hyprland/eww/scripts/pop @@ -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 } diff --git a/hypr-configs/hyprland/eww/src/widgets/_revealer.yuck b/hypr-configs/hyprland/eww/src/-components/_helpers.yuck similarity index 86% rename from hypr-configs/hyprland/eww/src/widgets/_revealer.yuck rename to hypr-configs/hyprland/eww/src/-components/_helpers.yuck index 0dc9036..f8bf125 100644 --- a/hypr-configs/hyprland/eww/src/widgets/_revealer.yuck +++ b/hypr-configs/hyprland/eww/src/-components/_helpers.yuck @@ -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)) diff --git a/hypr-configs/hyprland/eww/src/-modules/_clock.yuck b/hypr-configs/hyprland/eww/src/-modules/_clock.yuck new file mode 100644 index 0000000..8f9c65a --- /dev/null +++ b/hypr-configs/hyprland/eww/src/-modules/_clock.yuck @@ -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)))) \ No newline at end of file diff --git a/hypr-configs/hyprland/eww/src/-modules/_language.yuck b/hypr-configs/hyprland/eww/src/-modules/_language.yuck new file mode 100644 index 0000000..b03dd82 --- /dev/null +++ b/hypr-configs/hyprland/eww/src/-modules/_language.yuck @@ -0,0 +1,3 @@ +(defwidget Language [] + (button :class "widget" :onclick "./scripts/kb-layout/set-active" + (label :text {kbLayout}))) \ No newline at end of file diff --git a/hypr-configs/hyprland/eww/src/-modules/_workspaces.yuck b/hypr-configs/hyprland/eww/src/-modules/_workspaces.yuck new file mode 100644 index 0000000..9628f9e --- /dev/null +++ b/hypr-configs/hyprland/eww/src/-modules/_workspaces.yuck @@ -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)))))))) \ No newline at end of file diff --git a/hypr-configs/hyprland/eww/src/_definitions.yuck b/hypr-configs/hyprland/eww/src/_definitions.yuck index ff3788a..04f7d4f 100644 --- a/hypr-configs/hyprland/eww/src/_definitions.yuck +++ b/hypr-configs/hyprland/eww/src/_definitions.yuck @@ -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 '{ diff --git a/hypr-configs/hyprland/eww/src/windows/vbar/main.yuck b/hypr-configs/hyprland/eww/src/windows/vbar/main.yuck index 0bf70a3..1d2e980 100644 --- a/hypr-configs/hyprland/eww/src/windows/vbar/main.yuck +++ b/hypr-configs/hyprland/eww/src/windows/vbar/main.yuck @@ -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