shell/fzf: improve fzf-apps + scratch terminal integration + refactor
This commit is contained in:
		
							parent
							
								
									11882cb47e
								
							
						
					
					
						commit
						8f641a3149
					
				| 
						 | 
					@ -12,6 +12,9 @@ case $OSTYPE in
 | 
				
			||||||
    linux*)
 | 
					    linux*)
 | 
				
			||||||
        cmd=$(echo -n "$PATH" | xargs -d: -I{} -r -- find -L {} -maxdepth 1 -mindepth 1 -type f -executable -printf '%P\n' 2>/dev/null | sort -u | gui-fzf)
 | 
					        cmd=$(echo -n "$PATH" | xargs -d: -I{} -r -- find -L {} -maxdepth 1 -mindepth 1 -type f -executable -printf '%P\n' 2>/dev/null | sort -u | gui-fzf)
 | 
				
			||||||
        if [[ $cmd ]]; then
 | 
					        if [[ $cmd ]]; then
 | 
				
			||||||
 | 
					            if [[ $cmd == fzf-* ]]; then
 | 
				
			||||||
 | 
					                $cmd
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
                if ! which lnch >/dev/null; then
 | 
					                if ! which lnch >/dev/null; then
 | 
				
			||||||
                    notify-send 'lnch is not installed' 'run "go get github.com/oem/lnch"'
 | 
					                    notify-send 'lnch is not installed' 'run "go get github.com/oem/lnch"'
 | 
				
			||||||
                    exit 1
 | 
					                    exit 1
 | 
				
			||||||
| 
						 | 
					@ -19,10 +22,13 @@ case $OSTYPE in
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                # This disowns the subprocess from the parent shell (i.e. if
 | 
					                # This disowns the subprocess from the parent shell (i.e. if
 | 
				
			||||||
                # that shell gets closed, the subprocess will survive).
 | 
					                # that shell gets closed, the subprocess will survive).
 | 
				
			||||||
            if [[ $cmd == fzf-* ]]; then
 | 
					 | 
				
			||||||
                $cmd
 | 
					 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
                lnch "$cmd"
 | 
					                lnch "$cmd"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                # OPTIONAL: requires bin/tmux
 | 
				
			||||||
 | 
					                if command -v 'tmux-session-name' >/dev/null; then
 | 
				
			||||||
 | 
					                    # If this was used from a scratch tmux terminal, close it
 | 
				
			||||||
 | 
					                    [[ "$(tmux-session-name)" == scratch ]] && tmux kill-session -t scratch
 | 
				
			||||||
 | 
					                fi
 | 
				
			||||||
            fi
 | 
					            fi
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue