diff --git a/eww-laptop/.config/eww/eww.scss b/eww-laptop/.config/eww/eww.scss new file mode 100644 index 0000000..171a7a0 --- /dev/null +++ b/eww-laptop/.config/eww/eww.scss @@ -0,0 +1,13 @@ +* { + all: unset; +} + +.bar { + background-color: #1d2021; + color: #ebdbb2; + margin-left: 10px; + margin-right: 10px; + font-family: "CozetteVector"; + font-size: 12px; +} + diff --git a/eww-laptop/.config/eww/eww.yuck b/eww-laptop/.config/eww/eww.yuck new file mode 100644 index 0000000..75323a8 --- /dev/null +++ b/eww-laptop/.config/eww/eww.yuck @@ -0,0 +1,31 @@ +(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces") +(deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/get-active-workspace") +(defpoll time :interval "1s" "date '+%d.%m.%Y - %H:%M'") + +(defwidget workspaces [] + (eventbox :halign "start" + :onscroll "bash ${EWW_CONFIG_DIR}/scripts/change-active-workspace {} ${current_workspace}" + :class "workspaces-widget" + (box :space-evenly true + (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 ? "◆" : "◇"} "))))))) + +(defwidget bar [] + (centerbox :class "bar" + (workspaces) + "${time}" + (box :halign "end" + :space-evenly true + :width "150" + "󰁹 ${EWW_BATTERY["BAT1"].capacity}%" + "󰍛 ${round(EWW_RAM.used_mem_perc, 0)}%" + "󰻠 ${round(EWW_CPU.avg, 0)}%"))) + +(defwindow bar + :monitor 0 + :geometry (geometry :x 0 :y 0 :width "100%" :height "30px" :anchor "top center") + :stacking "fg" + :exclusive true + (bar)) diff --git a/eww-laptop/.config/eww/scripts/change-active-workspace.sh b/eww-laptop/.config/eww/scripts/change-active-workspace.sh new file mode 100755 index 0000000..af2ce35 --- /dev/null +++ b/eww-laptop/.config/eww/scripts/change-active-workspace.sh @@ -0,0 +1,21 @@ +#! /bin/bash +function clamp { + min=$1 + max=$2 + val=$3 + python -c "print(max($min, min($val, $max)))" +} + +direction=$1 +current=$2 +if test "$direction" = "down" +then + target=$(clamp 1 10 $(($current+1))) + echo "jumping to $target" + hyprctl dispatch workspace $target +elif test "$direction" = "up" +then + target=$(clamp 1 10 $(($current-1))) + echo "jumping to $target" + hyprctl dispatch workspace $target +fi diff --git a/eww-laptop/.config/eww/scripts/get-active-workspace b/eww-laptop/.config/eww/scripts/get-active-workspace new file mode 100755 index 0000000..5791828 --- /dev/null +++ b/eww-laptop/.config/eww/scripts/get-active-workspace @@ -0,0 +1,3 @@ +#!/bin/bash +hyprctl monitors -j | jq --raw-output .[0].activeWorkspace.id +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 grep '^workspace>>' | stdbuf -o0 awk -F '>>|,' '{print $2}' diff --git a/eww-laptop/.config/eww/scripts/get-workspaces b/eww-laptop/.config/eww/scripts/get-workspaces new file mode 100755 index 0000000..570ff6e --- /dev/null +++ b/eww-laptop/.config/eww/scripts/get-workspaces @@ -0,0 +1,11 @@ +#!/bin/bash + +spaces (){ + WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries') + seq 1 10 | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})' +} + +spaces +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do + spaces +done diff --git a/hyprland/.config/hypr/hyprland.conf b/hyprland/.config/hypr/hyprland.conf index 9453d18..39ddef8 100644 --- a/hyprland/.config/hypr/hyprland.conf +++ b/hyprland/.config/hypr/hyprland.conf @@ -1,6 +1,10 @@ monitor=,preferred,auto,1 exec-once = swaybg -m fill --image /home/leon/Pictures/green_leaves.jpg & mako +env = $WOBSOCK,$XDG_RUNTIME_DIR/wob.sock +exec-once = mkfifo $WOBSOCK && tail -f $WOBSOCK | wob +exec-once = eww open bar + # Source a file (multi-file configs) # source = ~/.config/hypr/myColors.conf @@ -12,7 +16,7 @@ input { kb_layout = us kb_variant = kb_model = - kb_options = + kb_options = compose:ralt kb_rules = follow_mouse = 1 @@ -90,6 +94,14 @@ bind = $mainMod SHIFT, P, exec, rofi -show drun bind = $mainMod, P, pseudo, # dwindle bind = $mainMod, v, togglesplit, # dwindle bind = $mainMod, f, fullscreen, # dwindle + +bind = ,XF86AudioRaiseVolume, exec, pamixer -ui 2 && pamixer --get-volume > $WOBSOCK +bind = ,XF86AudioLowerVolume, exec, pamixer -ud 2 && pamixer --get-volume > $WOBSOCK +bind = ,XF86AudioMute, exec, pamixer --toggle-mute && ( pamixer --get-mute && echo 0 > $WOBSOCK ) || pamixer --get-volume > $WOBSOCK +bind = ,XF86MonBrightnessDown, exec, brightnessctl set 5%- | sed -En 's/.*\(([0-9]+)%\).*/\1/p' | tee /tmp/brightness > $WOBSOCK +bind = ,XF86MonBrightnessUp, exec, brightnessctl set +5% | sed -En 's/.*\(([0-9]+)%\).*/\1/p' | tee /tmp/brightness > $WOBSOCK + + bind = $mainMod, h, movefocus, l bind = $mainMod, l, movefocus, r bind = $mainMod, k, movefocus, u