30 lines
		
	
	
	
		
			597 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			597 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
#!/bin/sh
 | 
						|
 | 
						|
# Check to see if firefox is running
 | 
						|
if [ $(pgrep -c GeckoMain) -gt 0 ]; then
 | 
						|
 | 
						|
    if [ $XDG_SESSION_TYPE = "x11" ]; then
 | 
						|
        #X11
 | 
						|
        ffrg=$(wmctrl -lx | rg firefox | awk '{print $1}')
 | 
						|
        # echo $emacsrg
 | 
						|
 | 
						|
        if [ -z $ffrg ]; then
 | 
						|
            firefox
 | 
						|
            exit
 | 
						|
        else
 | 
						|
            wmctrl -ia $ffrg
 | 
						|
            exit
 | 
						|
        fi
 | 
						|
    else
 | 
						|
        # WAYLAND
 | 
						|
        ffrg=$(wlrctl window list | rg firefox)
 | 
						|
 | 
						|
        ffwin=$(echo $ffrg | sed 's/.*\: //')
 | 
						|
        # echo $ffwin
 | 
						|
 | 
						|
        wlrctl toplevel focus title:"$ffwin"
 | 
						|
        exit
 | 
						|
    fi
 | 
						|
else
 | 
						|
    firefox
 | 
						|
fi
 |