adding better workspaces to eww

This commit is contained in:
Chris Cochrun 2023-08-30 15:28:21 -05:00
parent f7394076c1
commit d34f4ab2b4
9 changed files with 55 additions and 33 deletions

View file

@ -306,6 +306,10 @@ tooltip label {
background-color: rgba(00, 00, 00, 0.0); background-color: rgba(00, 00, 00, 0.0);
} }
.works:hover {
background-color: $base0D;
}
.empty_workspace { .empty_workspace {
color: $base03; color: $base03;
} }

View file

@ -21,6 +21,9 @@
(deflisten workspace "scripts/workspace") (deflisten workspace "scripts/workspace")
(deflisten appname "scripts/appname") (deflisten appname "scripts/appname")
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get-workspaces")
(deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/get-active-workspace")
(defvar vol_reveal false) (defvar vol_reveal false)
(defvar br_reveal false) (defvar br_reveal false)
(defvar music_reveal false) (defvar music_reveal false)
@ -39,12 +42,10 @@
:class "works" :class "works"
:orientation "h" :orientation "h"
:spacing 5 :spacing 5
:space-evenly "false" :space-evenly "true"
:valign "center" :valign "center"
(button :onclick "hyprctl dispatch workspace 1" :class "0$o1$f1" "") (for workspace in workspaces
(button :onclick "hyprctl dispatch workspace 2" :class "0$o2$f2" "") (button :onclick "hyprctl dispatch workspace ${workspace.id}" :class "works ${workspace.id == current_workspace ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}" "${workspace.name}")))))
(button :onclick "hyprctl dispatch workspace 3" :class "0$o3$f3" "󰍨")
(button :onclick "hyprctl dispatch workspace 4" :class "0$o4$f4" "󰈙"))))
@ -256,7 +257,7 @@
:valign "center" :valign "center"
:class "left_modules" :class "left_modules"
:spacing 8 :spacing 8
;; (workspaces) (workspaces)
(appnames))) (appnames)))
(defwidget center [] (defwidget center []
(box (box

View file

@ -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

View file

@ -0,0 +1,5 @@
#!/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}'

View file

@ -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 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

View file

@ -5,7 +5,7 @@
"height": 35, // Waybar height (to be removed for auto height) "height": 35, // Waybar height (to be removed for auto height)
"width": 1400, // Waybar width "width": 1400, // Waybar width
// Choose the order of the modules "custom/wintitle", // Choose the order of the modules "custom/wintitle",
"modules-left": ["wlr/workspaces", "workspaces", "hyprland/window"], "modules-left": ["wlr/workspaces", "hyprland/window"],
"modules-center": ["clock"], "modules-center": ["clock"],
"modules-right": ["pulseaudio", "backlight", "temperature", "memory", "cpu", "battery", "tray"], "modules-right": ["pulseaudio", "backlight", "temperature", "memory", "cpu", "battery", "tray"],
"margin-top": -5, "margin-top": -5,
@ -13,30 +13,9 @@
"margin-left": 6, "margin-left": 6,
"margin-right": 6, "margin-right": 6,
// Modules configuration // Modules configuration
"sway/workspaces": {
"disable-scroll": true,
"all-outputs": true,
"format": "{icon}",
"format-icons": {
"1": " ",
"2": " ",
"3": " ",
"4": " ",
"5": " ",
"urgent": " ",
"focused": " ",
"default": " "
}
},
"river/tags": {
"num-tags": 8
},
"hyprland/window": { "hyprland/window": {
"format": " <span style='italic'>{}</span>" "format": " <span style='italic'>{}</span>"
}, },
"workspaces": {
"format": " {name} "
},
"wlr/workspaces": { "wlr/workspaces": {
"format": "{icon}", "format": "{icon}",
"on-scroll-up": "hyprctl dispatch workspace e+1", "on-scroll-up": "hyprctl dispatch workspace e+1",

View file

@ -82,7 +82,7 @@ window#waybar > box {
color: rgba(217, 216, 216, 1); color: rgba(217, 216, 216, 1);
} }
#workspaces button.focused { #workspaces button.active {
color: @base0C; color: @base0C;
} }

View file

@ -14,13 +14,13 @@ in
home.file.".config/hypr/hyprland.conf" = { home.file.".config/hypr/hyprland.conf" = {
text = '' text = ''
monitor=eDP-1,2256x1504@60,0x0,1.5 monitor=eDP-1,2256x1504@60,0x0,1.5
workspace=eDP-1,1
monitor=HDMI-A-1,preferred,0x0,1 monitor=HDMI-A-1,preferred,0x0,1
monitor=DP-1,preferred,1080x0,1.5 monitor=DP-1,preferred,1080x0,1.5
monitor=DP-2,preferred,3640,1 monitor=DP-2,preferred,3640,1
workspace=DP-2,9 workspace=1,name:,id:1,monitor:eDP-1,1,default:true
workspace=DP-1,1 workspace=1,name:,id:2,monitor:HDMI-A-1,2,default:true
workspace=HDMI-A-1,2 workspace=9,name:,id:9,monitor:DP-2,9,gapsout:0,default:true
workspace=2,name:,id:1,monitor:DP-1,1,default:true
monitor=HDMI-A-1,transform,1 monitor=HDMI-A-1,transform,1
input { input {

View file

@ -13,3 +13,4 @@ rbw-agent &
emacs --daemon & emacs --daemon &
nextcloud --background & nextcloud --background &
batmon & batmon &
swww img /home/chris/Pictures/wallpapers/nixorange.webp -t grow --transition-bezier .14,0,.14,.99