27 lines
		
	
	
	
		
			500 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			500 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/bin/sh
 | 
						|
 | 
						|
 | 
						|
if [ $(pgrep -c firefox) -gt 0 ]; then
 | 
						|
    
 | 
						|
 | 
						|
    if [ $XDG_SESSION_TYPE = "x11" ]; then
 | 
						|
        #X11
 | 
						|
        ffrg=$(wmctrl -lx | rg firefox | awk '{print $1}')
 | 
						|
        # echo $emacsrg
 | 
						|
 | 
						|
        wmctrl -ia $ffrg
 | 
						|
        exit
 | 
						|
 | 
						|
    else
 | 
						|
        # WAYLAND
 | 
						|
        emacsrg=$(wlrctl window list | rg -v 'emacs:\sorg-agenda' | rg 'emacs:')
 | 
						|
 | 
						|
        emacswin=$(echo $emacsrg | sed 's/.*\: //')
 | 
						|
        echo $emacswin
 | 
						|
 | 
						|
        wlrctl toplevel focus title:"$emacswin"
 | 
						|
    fi
 | 
						|
 | 
						|
    emacsclient -c
 | 
						|
 | 
						|
fi
 |