Initial commit
This commit is contained in:
		
							
								
								
									
										28
									
								
								hypr/scripts/focusOrLaunch
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										28
									
								
								hypr/scripts/focusOrLaunch
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
#!/usr/bin/env zsh
 | 
			
		||||
 | 
			
		||||
export HYPRLAND_INSTANCE_SIGNATURE=$(hyprctl -j instances | jq -r '.[0] | .instance')
 | 
			
		||||
app="${1}"
 | 
			
		||||
shift
 | 
			
		||||
class_name="${1}"
 | 
			
		||||
shift
 | 
			
		||||
workspace="${1}"
 | 
			
		||||
app_id=$(hyprctl -j clients | jq --arg class "${class_name}" \
 | 
			
		||||
    '.[] | select(.class == $class) | .workspace.id')
 | 
			
		||||
 | 
			
		||||
if [[ -n "${app_id}" ]]; then
 | 
			
		||||
    hyprctl dispatch focuswindow "class:${class_name}"
 | 
			
		||||
 | 
			
		||||
    case "${app}" in
 | 
			
		||||
        "qutebrowser")
 | 
			
		||||
           hyprctl dispatch sendshortcut ", 0, class:${class_name}"
 | 
			
		||||
           hyprctl dispatch sendshortcut ", 1, class:${class_name}"
 | 
			
		||||
           hyprctl dispatch sendshortcut "ALT, J, class:${class_name}"
 | 
			
		||||
           ;;
 | 
			
		||||
        *)
 | 
			
		||||
            ;;
 | 
			
		||||
    esac
 | 
			
		||||
    #hyprctl dispatch fullscreen 1
 | 
			
		||||
else
 | 
			
		||||
    hyprctl dispatch workspace "${workspace}"
 | 
			
		||||
    ${app} &
 | 
			
		||||
fi
 | 
			
		||||
		Reference in New Issue
	
	Block a user