alfred snippet import
This commit is contained in:
		
							
								
								
									
										13
									
								
								snippy
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								snippy
									
									
									
									
									
								
							@@ -79,16 +79,21 @@ run(){
 | 
				
			|||||||
    else
 | 
					    else
 | 
				
			||||||
        ${FILE} &> $TMPFILE # execute as bashcommand
 | 
					        ${FILE} &> $TMPFILE # execute as bashcommand
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    local old
 | 
					
 | 
				
			||||||
    old=$(xsel -b)
 | 
					    local current_clip
 | 
				
			||||||
    xsel -b --input < $TMPFILE
 | 
					    current_clip=$(xsel -b)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # replace {clipboard} by the cliboard comtent
 | 
				
			||||||
 | 
					    sed -i -e "s/{clipboard}/$current_clip/g" "$TMPFILE"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    xsel -b --input < "$TMPFILE"
 | 
				
			||||||
    # Paste into the current application.
 | 
					    # Paste into the current application.
 | 
				
			||||||
    if is_window; then
 | 
					    if is_window; then
 | 
				
			||||||
        ${GUIPASTE}
 | 
					        ${GUIPASTE}
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        ${CLIPASTE}
 | 
					        ${CLIPASTE}
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    echo -ne "$old" | xsel -b --input
 | 
					    echo -ne "$current_clip" | xsel -b --input
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
is_window(){
 | 
					is_window(){
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user