fixing things for eww and hyprland
This commit is contained in:
		
							parent
							
								
									d34f4ab2b4
								
							
						
					
					
						commit
						849b950c02
					
				
					 8 changed files with 29 additions and 102 deletions
				
			
		| 
						 | 
				
			
			@ -302,7 +302,13 @@ tooltip label {
 | 
			
		|||
.works {
 | 
			
		||||
    font-size: 14px;
 | 
			
		||||
    font-weight: normal;
 | 
			
		||||
    margin: 4px 0px 0px 20px;
 | 
			
		||||
    margin: 2px 0px 0px 0px;
 | 
			
		||||
    background-color: rgba(00, 00, 00, 0.0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.worksbox {
 | 
			
		||||
    margin-left: 15px;
 | 
			
		||||
    margin-right: 15px;
 | 
			
		||||
    background-color: rgba(00, 00, 00, 0.0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -318,7 +324,7 @@ tooltip label {
 | 
			
		|||
    color: $base05;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.focused_workspace {
 | 
			
		||||
.current_workspace {
 | 
			
		||||
    color: $base0D;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,11 +18,10 @@
 | 
			
		|||
(defpoll HOST :interval "1h" "hostname")
 | 
			
		||||
(defpoll DISK :interval "1m" "disk")
 | 
			
		||||
(deflisten volume_percent :interval "0.5s"  "tail -F /tmp/vol")
 | 
			
		||||
(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")
 | 
			
		||||
(deflisten workspaces :initial "[]" "scripts/get-workspaces")
 | 
			
		||||
(deflisten current_workspace :initial "1" "scripts/get-active-workspace")
 | 
			
		||||
 | 
			
		||||
(defvar vol_reveal false)
 | 
			
		||||
(defvar br_reveal false)
 | 
			
		||||
| 
						 | 
				
			
			@ -39,15 +38,22 @@
 | 
			
		|||
            :onscroll "echo {} | sed -e 's/up/-1/g' -e 's/down/+1/g' | xargs hyprctl dispatch workspace"
 | 
			
		||||
            :valign "center" 
 | 
			
		||||
            (box
 | 
			
		||||
             :class "works"
 | 
			
		||||
             :class "worksbox"
 | 
			
		||||
             :orientation "h"
 | 
			
		||||
             :spacing 5
 | 
			
		||||
             :space-evenly "true"
 | 
			
		||||
             :spacing 20
 | 
			
		||||
             :space-evenly false
 | 
			
		||||
             :valign "center"
 | 
			
		||||
             (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}")))))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                  (button :onclick "hyprctl dispatch workspace ${workspace.id}" :class "works ${workspace.id == current_workspace ? "current_workspace" : ""} ${workspace.windows > 0 ? "occupied_workspace" : "empty_workspace"}"
 | 
			
		||||
                          "${workspace.id == 1 ? "" :
 | 
			
		||||
                             workspace.id == 2 ? "" :
 | 
			
		||||
                             workspace.id == 3 ? "" :
 | 
			
		||||
                             workspace.id == 4 ? "" :
 | 
			
		||||
                             workspace.id == 5 ? "" :
 | 
			
		||||
                             workspace.id == 9 ? "" :
 | 
			
		||||
                             workspace.id}")))))
 | 
			
		||||
 
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
(defwidget appnames []
 | 
			
		||||
  (eventbox
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										0
									
								
								.config/eww/scripts/change-active-workspace
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								.config/eww/scripts/change-active-workspace
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										0
									
								
								.config/eww/scripts/get-active-workspace
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								.config/eww/scripts/get-active-workspace
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										2
									
								
								.config/eww/scripts/get-workspaces
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										2
									
								
								.config/eww/scripts/get-workspaces
									
										
									
									
									
										
										
										Normal file → Executable file
									
								
							| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
 | 
			
		||||
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)})'
 | 
			
		||||
	seq 1 5 | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
spaces
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,18 +0,0 @@
 | 
			
		|||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
focused_workspace () {
 | 
			
		||||
    hyprctl monitors | grep -B 5 "focused: yes" | awk 'NR == 1{print $3}'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
occupied_workspace () {
 | 
			
		||||
    hyprctl workspaces
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
case $1 in
 | 
			
		||||
    fw)
 | 
			
		||||
        focused_workspace
 | 
			
		||||
        ;;
 | 
			
		||||
    ow)
 | 
			
		||||
        occupied_workspace
 | 
			
		||||
        ;;
 | 
			
		||||
esac
 | 
			
		||||
| 
						 | 
				
			
			@ -1,67 +0,0 @@
 | 
			
		|||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
#define icons for workspaces 1-9
 | 
			
		||||
ic=(0       )
 | 
			
		||||
 | 
			
		||||
#initial check for occupied workspaces
 | 
			
		||||
for num in $(hyprctl workspaces | grep ID | awk '{print $3}'); do 
 | 
			
		||||
  export o"$num"="$num"
 | 
			
		||||
done
 | 
			
		||||
 
 | 
			
		||||
#initial check for focused workspace
 | 
			
		||||
for num in $(hyprctl monitors | grep -B 5 "focused: yes" | awk 'NR==1{print $3}'); do 
 | 
			
		||||
  export f"$num"="$num"
 | 
			
		||||
  export fnum=f"$num"
 | 
			
		||||
  export mon=$(hyprctl monitors | grep -B 2 "\($num\)" | awk 'NR==1{print $2}')
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
workspaces() {
 | 
			
		||||
if [[ ${1:0:9} == "workspace" ]] && [[ ${1:11} != "special" ]]; then #set focused workspace
 | 
			
		||||
  unset -v "$fnum" 
 | 
			
		||||
  num=${1:11}
 | 
			
		||||
  export f"$num"="$num"
 | 
			
		||||
  export fnum=f"$num"
 | 
			
		||||
 | 
			
		||||
elif [[ ${1:0:10} == "focusedmon" ]]; then #set focused workspace following monitor focus change
 | 
			
		||||
  unset -v "$fnum"
 | 
			
		||||
  string=${1:12}
 | 
			
		||||
  num=${string##*,}
 | 
			
		||||
  export mon=${string/,*/}
 | 
			
		||||
  export f"$num"="$num"
 | 
			
		||||
  export fnum=f"$num"
 | 
			
		||||
 | 
			
		||||
elif [[ ${1:0:13} == "moveworkspace" ]] && [[ ${1##*,} == "$mon" ]]; then #Set focused workspace following swapactiveworkspace
 | 
			
		||||
  unset -v "$fnum"
 | 
			
		||||
  string=${1:15}
 | 
			
		||||
  num=${string/,*/}
 | 
			
		||||
  export f"$num"="$num"
 | 
			
		||||
  export fnum=f"$num"
 | 
			
		||||
 | 
			
		||||
elif [[ ${1:0:15} == "createworkspace" ]]; then #set Occupied workspace
 | 
			
		||||
  num=${1:17}
 | 
			
		||||
  export o"$num"="$num"
 | 
			
		||||
  export onum=o"$num"
 | 
			
		||||
 | 
			
		||||
elif [[ ${1:0:16} == "destroyworkspace" ]]; then #unset unoccupied workspace
 | 
			
		||||
  num=${1:18}
 | 
			
		||||
  unset -v o"$num"
 | 
			
		||||
fi
 | 
			
		||||
}
 | 
			
		||||
module() {
 | 
			
		||||
#output eww widget
 | 
			
		||||
echo 	"(eventbox :onscroll \"echo {} | sed -e 's/up/-1/g' -e 's/down/+1/g' | xargs hyprctl dispatch workspace\" :valign \"center\" \
 | 
			
		||||
          (box	:class \"works\" :orientation \"h\" :spacing 5 :space-evenly \"false\" :valign \"center\"	\
 | 
			
		||||
              (button :onclick \"hyprctl dispatch workspace 1\" :class \"0$o1$f1\" \"${ic[1]}\") \
 | 
			
		||||
              (button :onclick \"hyprctl dispatch workspace 2\" :class \"0$o2$f2\" \"${ic[2]}\") \
 | 
			
		||||
              (button :onclick \"hyprctl dispatch workspace 3\" :class \"0$o3$f3\" \"${ic[3]}\") \
 | 
			
		||||
              (button :onclick \"hyprctl dispatch workspace 4\" :class \"0$o4$f4\" \"${ic[4]}\") \
 | 
			
		||||
          )\
 | 
			
		||||
        )"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module
 | 
			
		||||
 | 
			
		||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r event; do 
 | 
			
		||||
workspaces "$event"
 | 
			
		||||
module
 | 
			
		||||
done
 | 
			
		||||
| 
						 | 
				
			
			@ -17,10 +17,10 @@ in
 | 
			
		|||
    monitor=HDMI-A-1,preferred,0x0,1
 | 
			
		||||
    monitor=DP-1,preferred,1080x0,1.5
 | 
			
		||||
    monitor=DP-2,preferred,3640,1
 | 
			
		||||
    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
 | 
			
		||||
    workspace=1,monitor:eDP-1,1,default:true
 | 
			
		||||
    workspace=1,monitor:HDMI-A-1,2,default:true
 | 
			
		||||
    workspace=9,monitor:DP-2,9,gapsout:0,default:true
 | 
			
		||||
    workspace=2,monitor:DP-1,1,default:true
 | 
			
		||||
    monitor=HDMI-A-1,transform,1
 | 
			
		||||
 | 
			
		||||
    input {
 | 
			
		||||
| 
						 | 
				
			
			@ -220,10 +220,10 @@ in
 | 
			
		|||
    # blurls=gtk-layer-shell
 | 
			
		||||
    # blurls=notifications
 | 
			
		||||
 | 
			
		||||
    exec-once = /home/chris/bin/startup.sh
 | 
			
		||||
    exec-once = swww init
 | 
			
		||||
    exec-once = swww img /home/chris/Pictures/wallpapers/nixorange.webp -t grow --transition-bezier .14,0,.14,.99
 | 
			
		||||
    exec-once = dunst
 | 
			
		||||
    exec-once = /home/chris/bin/startup.sh
 | 
			
		||||
    exec-once = hyprctl dispatch --batch "splitratio 1; splitration -0.35"
 | 
			
		||||
    exec-once = dbus-update-activation-environment --systemd --all
 | 
			
		||||
    exec-once = jellyfin-mpv-shim
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue