adding better workspaces to eww
This commit is contained in:
		
							parent
							
								
									f7394076c1
								
							
						
					
					
						commit
						d34f4ab2b4
					
				
					 9 changed files with 55 additions and 33 deletions
				
			
		| 
						 | 
				
			
			@ -306,6 +306,10 @@ tooltip label {
 | 
			
		|||
    background-color: rgba(00, 00, 00, 0.0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.works:hover {
 | 
			
		||||
    background-color: $base0D;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.empty_workspace {
 | 
			
		||||
    color: $base03;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,6 +21,9 @@
 | 
			
		|||
(deflisten workspace "scripts/workspace")
 | 
			
		||||
(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 br_reveal false)
 | 
			
		||||
(defvar music_reveal false)
 | 
			
		||||
| 
						 | 
				
			
			@ -39,12 +42,10 @@
 | 
			
		|||
             :class "works"
 | 
			
		||||
             :orientation "h"
 | 
			
		||||
             :spacing 5
 | 
			
		||||
             :space-evenly "false"
 | 
			
		||||
             :space-evenly "true"
 | 
			
		||||
             :valign "center"
 | 
			
		||||
              (button :onclick "hyprctl dispatch workspace 1" :class "0$o1$f1" "") 
 | 
			
		||||
              (button :onclick "hyprctl dispatch workspace 2" :class "0$o2$f2" "") 
 | 
			
		||||
              (button :onclick "hyprctl dispatch workspace 3" :class "0$o3$f3" "") 
 | 
			
		||||
              (button :onclick "hyprctl dispatch workspace 4" :class "0$o4$f4" ""))))
 | 
			
		||||
             (for workspace in workspaces
 | 
			
		||||
                  (button :onclick "hyprctl dispatch workspace ${workspace.id}" :class "works ${workspace.id == current_workspace ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}" "${workspace.name}")))))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -256,7 +257,7 @@
 | 
			
		|||
            :valign "center"
 | 
			
		||||
	    :class "left_modules"
 | 
			
		||||
            :spacing 8
 | 
			
		||||
            ;; (workspaces)
 | 
			
		||||
            (workspaces)
 | 
			
		||||
            (appnames)))
 | 
			
		||||
(defwidget center []
 | 
			
		||||
	   (box 
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										21
									
								
								.config/eww/scripts/change-active-workspace
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								.config/eww/scripts/change-active-workspace
									
										
									
									
									
										Normal 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
 | 
			
		||||
							
								
								
									
										5
									
								
								.config/eww/scripts/get-active-workspace
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.config/eww/scripts/get-active-workspace
									
										
									
									
									
										Normal 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}'
 | 
			
		||||
							
								
								
									
										11
									
								
								.config/eww/scripts/get-workspaces
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								.config/eww/scripts/get-workspaces
									
										
									
									
									
										Normal 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
 | 
			
		||||
| 
						 | 
				
			
			@ -5,7 +5,7 @@
 | 
			
		|||
    "height": 35, // Waybar height (to be removed for auto height)
 | 
			
		||||
    "width": 1400, // Waybar width
 | 
			
		||||
    // 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-right": ["pulseaudio", "backlight", "temperature", "memory", "cpu", "battery", "tray"],
 | 
			
		||||
    "margin-top": -5,
 | 
			
		||||
| 
						 | 
				
			
			@ -13,30 +13,9 @@
 | 
			
		|||
    "margin-left": 6,
 | 
			
		||||
    "margin-right": 6,
 | 
			
		||||
    // 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": {
 | 
			
		||||
        "format": "  <span style='italic'>{}</span>"
 | 
			
		||||
    },
 | 
			
		||||
    "workspaces": {
 | 
			
		||||
        "format": " {name} "
 | 
			
		||||
    },
 | 
			
		||||
    "wlr/workspaces": {
 | 
			
		||||
     "format": "{icon}",
 | 
			
		||||
     "on-scroll-up": "hyprctl dispatch workspace e+1",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,7 +82,7 @@ window#waybar > box {
 | 
			
		|||
    color:      rgba(217, 216, 216, 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#workspaces button.focused {
 | 
			
		||||
#workspaces button.active {
 | 
			
		||||
    color: @base0C;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,13 +14,13 @@ in
 | 
			
		|||
  home.file.".config/hypr/hyprland.conf" = {
 | 
			
		||||
    text = ''
 | 
			
		||||
    monitor=eDP-1,2256x1504@60,0x0,1.5
 | 
			
		||||
    workspace=eDP-1,1
 | 
			
		||||
    monitor=HDMI-A-1,preferred,0x0,1
 | 
			
		||||
    monitor=DP-1,preferred,1080x0,1.5
 | 
			
		||||
    monitor=DP-2,preferred,3640,1
 | 
			
		||||
    workspace=DP-2,9
 | 
			
		||||
    workspace=DP-1,1
 | 
			
		||||
    workspace=HDMI-A-1,2
 | 
			
		||||
    workspace=1,name:,id:1,monitor:eDP-1,1,default:true
 | 
			
		||||
    workspace=1,name:,id:2,monitor:HDMI-A-1,2,default:true
 | 
			
		||||
    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
 | 
			
		||||
 | 
			
		||||
    input {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,3 +13,4 @@ rbw-agent &
 | 
			
		|||
emacs --daemon &
 | 
			
		||||
nextcloud --background &
 | 
			
		||||
batmon &
 | 
			
		||||
swww img /home/chris/Pictures/wallpapers/nixorange.webp -t grow --transition-bezier .14,0,.14,.99
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue