diff --git a/.config/eww/eww.scss b/.config/eww/eww.scss new file mode 100644 index 0000000..4f16216 --- /dev/null +++ b/.config/eww/eww.scss @@ -0,0 +1,46 @@ +* { + all: unset; //Unsets everything so you can style everything from scratch + font-family: JetBrainsMono Nerd Font; +} + +//Global Styles +.bar { + background-color: #3a3a3a; + color: #b0b4bc; + padding: 10px; +} + +// Styles on classes (see eww.yuck for more information) + +.sidestuff slider { + all: unset; + color: #ffd5cd; +} + +.metric scale trough highlight { + all: unset; + background-color: #D35D6E; + color: #000000; + border-radius: 10px; +} +.metric scale trough { + all: unset; + background-color: #4e4e4e; + border-radius: 50px; + min-height: 3px; + min-width: 50px; + margin-left: 10px; + margin-right: 20px; +} +.label-ram { + font-size: large; +} +.workspaces button:hover { + color: #D35D6E; +} +.workspace-entry { + padding: 0 2em; +} +.current { + color: #D65D0E; +} diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck new file mode 100644 index 0000000..3572941 --- /dev/null +++ b/.config/eww/eww.yuck @@ -0,0 +1,77 @@ +(defwidget bar [] + (centerbox :orientation "h" + (workspaces) + (music) + (sidestuff))) + +(defwidget sidestuff [] + (box :class "sidestuff" :orientation "h" :space-evenly false :halign "end" + (metric :label "󰕾" + :value volume + :onchange "amixer -D pulse sset Master {}%") + (metric :label "󰍛" + :value {EWW_RAM.used_mem_perc} + :onchange "") + (metric :label "" + :value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)} + :onchange "") + time)) + +(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces") +(deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/get-active-workspace") +(defwidget workspaces [] + (eventbox :onscroll "bash ~/.config/eww/scripts/change-active-workspace {} ${current_workspace}" :class "workspaces-widget" + (box :space-evenly false + (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}") + ) + ) + ) + ) + ) +) + +(defwidget music [] + (box :class "music" + :orientation "h" + :space-evenly false + :halign "center" + {music != "" ? "🎵${music}" : ""})) + + +(defwidget metric [label value onchange] + (box :orientation "h" + :class "metric" + :space-evenly false + (box :class "label" label) + (scale :min 0 + :max 101 + :active {onchange != ""} + :value value + :onchange onchange))) + + + +(deflisten music :initial "" + "playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true") + +(defpoll volume :interval "1s" + "scripts/getvol") + +(defpoll time :interval "10s" + "date '+%H:%M %F'") + +(defwindow bar + :monitor 0 + :windowtype "dock" + :exclusive true + :geometry (geometry :x "0%" + :y "0%" + :width "90%" + :height "10px" + :anchor "top center") + :reserve (struts :side "top" :distance "100px") + (bar)) diff --git a/.config/eww/scripts/change-active-workspace b/.config/eww/scripts/change-active-workspace new file mode 100755 index 0000000..3a43646 --- /dev/null +++ b/.config/eww/scripts/change-active-workspace @@ -0,0 +1,21 @@ +#!/usr/bin/env 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/.config/eww/scripts/get-active-workspace b/.config/eww/scripts/get-active-workspace new file mode 100755 index 0000000..7bb8fe3 --- /dev/null +++ b/.config/eww/scripts/get-active-workspace @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id' + +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | + stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}' diff --git a/.config/eww/scripts/get-workspaces b/.config/eww/scripts/get-workspaces new file mode 100755 index 0000000..557f3e3 --- /dev/null +++ b/.config/eww/scripts/get-workspaces @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +spaces (){ + WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries') + seq 1 4 | 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/.config/eww/scripts/getvol b/.config/eww/scripts/getvol new file mode 100755 index 0000000..4e4275d --- /dev/null +++ b/.config/eww/scripts/getvol @@ -0,0 +1,12 @@ +#!/bin/sh + +if command -v pamixer &>/dev/null; then + if [ true == $(pamixer --get-mute) ]; then + echo 0 + exit + else + pamixer --get-volume + fi +else + amixer -D pulse sget Master | awk -F '[^0-9]+' '/Left:/{print $3}' +fi diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index e007b3f..13ac147 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -1,5 +1,17 @@ monitor=,preferred,auto,auto -exec-once = dunst & hyprpaper & syncthing & kitty + +windowrule = workspace 1, kitty +windowrule = workspace 2, firefox +windowrule = workspace 2, qutebrowser +windowrule = workspace 2, ^(.*)(Chrom)(.*)$ +windowrule = workspace 2, thunderbird + +exec-once = eww daemon && eww open bar +exec-once = qutebrowser +exec-once = thunderbird +exec-once = /usr/lib64/chromium/chrome-wrapper --profile-directory=Default --app-id=ejhkdoiecgkmdpomoahkdihbcldkgjci # Element +exec-once = firefox +exec-once = dunst & hyprpaper & kitty $terminal = kitty $menu = wofi --show drun @@ -95,23 +107,11 @@ bind = $mainMod, 1, workspace, 1 bind = $mainMod, 2, workspace, 2 bind = $mainMod, 3, workspace, 3 bind = $mainMod, 4, workspace, 4 -bind = $mainMod, 5, workspace, 5 -bind = $mainMod, 6, workspace, 6 -bind = $mainMod, 7, workspace, 7 -bind = $mainMod, 8, workspace, 8 -bind = $mainMod, 9, workspace, 9 -bind = $mainMod, 0, workspace, 10 bind = $mainMod SHIFT, 1, movetoworkspace, 1 bind = $mainMod SHIFT, 2, movetoworkspace, 2 bind = $mainMod SHIFT, 3, movetoworkspace, 3 bind = $mainMod SHIFT, 4, movetoworkspace, 4 -bind = $mainMod SHIFT, 5, movetoworkspace, 5 -bind = $mainMod SHIFT, 6, movetoworkspace, 6 -bind = $mainMod SHIFT, 7, movetoworkspace, 7 -bind = $mainMod SHIFT, 8, movetoworkspace, 8 -bind = $mainMod SHIFT, 9, movetoworkspace, 9 -bind = $mainMod SHIFT, 0, movetoworkspace, 1r # Move/resize windows with mainMod + LMB/RMB and dragging bindm = $mainMod, mouse:272, movewindow