Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: HowTo: Use the unity launcher quicklist for snippets

  1. #11
    Join Date
    Aug 2013
    Beans
    12

    Re: HowTo: Use the unity launcher quicklist for snippets

    not sure I made myself clear -- the launcher object no longer seems to be working AT ALL. whereas the original version was capturing snippets for middle-click pasting, in this version nothing is happening right now.

  2. #12
    Join Date
    Aug 2013
    Beans
    12

    Re: HowTo: Use the unity launcher quicklist for snippets

    couple notes:

    1) the "Date" snippet works fine -- as things are configured now, to middle-mousebutton

    2) though clicking on the Unity Launcher doesn't work, running this DOES copy the snippet to where Ctrl-V can get at it

    Code:
    sh -c "head -1 ~/.snippets-launcher/snippets.txt | tail -1 | tr -d '\n' | xclip -i -selection clipboard"
    3) here is my snippets.txt

    Code:
    718-421-8779
    http://www.youtube.com/watch?v=malB-TLIpio&feature=share
    Weight: 154 Hair: brown/gray; Eyes: brown Suit: 38 Pants: 34/32 Shoes: 9 Hat: 7 3/8

  3. #13
    Join Date
    Oct 2008
    Beans
    3,509

    Re: HowTo: Use the unity launcher quicklist for snippets

    Quote Originally Posted by ray_field2 View Post
    couple notes:

    1) the "Date" snippet works fine -- as things are configured now, to middle-mousebutton

    2) though clicking on the Unity Launcher doesn't work, running this DOES copy the snippet to where Ctrl-V can get at it

    Code:
    sh -c "head -1 ~/.snippets-launcher/snippets.txt | tail -1 | tr -d '\n' | xclip -i -selection clipboard"
    3) here is my snippets.txt

    Code:
    718-421-8779
    http://www.youtube.com/watch?v=malB-TLIpio&feature=share
    Weight: 154 Hair: brown/gray; Eyes: brown Suit: 38 Pants: 34/32 Shoes: 9 Hat: 7 3/8
    It works here.
    Code:
    glen@Raring:~$ head -1 ~/.snippets-launcher/snippets.txt | tail -1 
    718-421-8779
    glen@Raring:~$ head -2 ~/.snippets-launcher/snippets.txt | tail -1 
    http://www.youtube.com/watch?v=malB-TLIpio&feature=share
    glen@Raring:~$ head -3 ~/.snippets-launcher/snippets.txt | tail -1
    Weight: 154 Hair: brown/gray; Eyes: brown Suit: 38 Pants: 34/32 Shoes: 9 Hat: 7 3/8
    Try replacing your current ~/.snippets-launcher/snippets.sh file with this one. Then updatethe launcher
    Code:
    #!/bin/bash
    #set -x
    # Use snippets from a unity quicklist.
    # Creates a ~/.local/share/applications/snippets.desktop file to drag and drop on the unity launcher
    # or any dock that supports quicklists.
    # The right click quicklist items are created from ~/.snippets-launcher/snippets.txt....one snippet per line...
    # ....and will be sorted alphbetically.
    # Can add cipboard content via quicklist menu.
    
    
    
    mkdir -p ~/.local/share/applications
    sed -i '/^\s*$/d' ~/.snippets-launcher/snippets.txt                            # remove blank lines
    sort ~/.snippets-launcher/snippets.txt -o ~/.snippets-launcher/snippets.txt    # alphbetical
    rm -rf /tmp/.actions*                                                         #clean before start
    
    
    ## count snippets
    snipcount=$(cat ~/.snippets-launcher/snippets.txt | wc -l)
    
    ## create single line to use with desktop "Actions"
    n=1
    while [ $n -le "$snipcount" ];
    do
    echo Snippet$n\; | tee -a /tmp/.actions
    n=$(( n+1 )) 
    done
    
    awk '{ printf "%s", $0 }' /tmp/.actions > /tmp/.actions2
    rm -rf "/tmp/.actions"
    cp /tmp/.actions2 /tmp/.actions
    
    shortcuts=$(cat /tmp/.actions)
    
    echo "[Desktop Entry]
    Version=1.0
    Name=Snippets
    Comment=Snippets to clipboard using xclip
    GenericName=Snippets
    Exec=gedit $HOME/.snippets-launcher/snippets.txt
    Icon=$HOME/.snippets-launcher/Snippets.png
    Terminal=false
    X-MultipleArgs=false
    Type=Application
    Categories=GNOME;System;
    X-Ayatana-Desktop-Shortcuts=${shortcuts}Snippet96;Snippet97;Snippet98;Snippet99" | tee ~/.local/share/applications/snippets.desktop
    
    
    ## get quicklist titles from snippets.txt and create the quicklists
    	n=1
    	while [ $n -le "$snipcount" ];
    	do
    	MENUENTRY=$(sed -n "$n{p;q;}" $HOME/.snippets-launcher/snippets.txt)   #/tmp/.ur_bootlist2
    	echo "[Snippet$n Shortcut Group]
    	Name=$(echo "$MENUENTRY")
    	Exec=sh -c \"head -$n ~/.snippets-launcher/snippets.txt | tail -1 | tr -d '\n' | xclip -i -selection clipboard\"
    	TargetEnvironment=Unity" | tee -a ~/.local/share/applications/snippets.desktop
    	n=$(( n+1 ))
    	done
    	rm -rf /tmp/.actions* > /dev/null 2>&1
    
    ### permanent quicklists
    ## date
    echo "[Snippet96 Shortcut Group]
    	Name=Date
    	Exec=$HOME/.snippets-launcher/date.sh
    	TargetEnvironment=Unity" | tee -a ~/.local/share/applications/snippets.desktop
    
    ## quicklist item used as a separator
    echo "[Snippet97 Shortcut Group]
    	Name=__________________________________________________
    	Exec=notify-send -i $HOME/.snippets-launcher/mp2.jpeg 'Go Away...or I shall taunt you a second time !'
    	TargetEnvironment=Unity" | tee -a ~/.local/share/applications/snippets.desktop
    
    ## Add clipboard to snippets and update 
    echo "[Snippet98 Shortcut Group]
    	Name=Add Clipboard Content
    	Exec=sh -c \"xclip -selection clipboard -o >> $HOME/.snippets-launcher/snippets.txt; $HOME/.snippets-launcher/snippets.sh\"
    	TargetEnvironment=Unity" | tee -a ~/.local/share/applications/snippets.desktop
    
    ## update launcher after changing snippets
    echo "[Snippet99 Shortcut Group]
    	Name=Update Launcher
    	Exec=gnome-terminal -e $HOME/.snippets-launcher/snippets.sh
    	TargetEnvironment=Unity" | tee -a ~/.local/share/applications/snippets.desktop
    
    
    
    #chmod +x ~/.local/share/applications/snippets.desktop
    If that doesn't work I'm currently testing a cleaner version written for me by Vaphell
    that I will post soon.
    Attached Files Attached Files
    Last edited by stinkeye; November 2nd, 2013 at 08:15 PM.

  4. #14
    Join Date
    Aug 2013
    Beans
    12

    Re: HowTo: Use the unity launcher quicklist for snippets

    Quote Originally Posted by stinkeye View Post
    Try replacing your current ~/.snippets-launcher/snippets.sh file with this one.
    no joy.

    again, what puzzles me is that

    Code:
    sh -c "head -1 ~/.snippets-launcher/snippets.txt | tail -1 | tr -d '\n' | xclip -i -selection clipboard"
    works perfectly.

  5. #15
    Join Date
    Oct 2008
    Beans
    3,509

    Re: HowTo: Use the unity launcher quicklist for snippets

    Post the contents of the created snippets.desktop file.
    Code:
    gedit ~/.local/share/applications/snippets.desktop

  6. #16
    Join Date
    Oct 2008
    Beans
    3,509

    Re: HowTo: Use the unity launcher quicklist for snippets

    I'm off to bed. The error is probably with my script.
    Try Vaphell's version.
    This one's packaged up as quicksnips.
    Same install method. Check the ReadMe.

    You can leave the other one as they don't interfere.
    Can remove if like with....
    Code:
    rm -rf ~/.snippets-launcher ~/.local/share/applications/snippets.desktop
    Attached Files Attached Files
    Last edited by stinkeye; November 2nd, 2013 at 09:56 PM.

  7. #17
    Join Date
    Aug 2013
    Beans
    12

    Re: HowTo: Use the unity launcher quicklist for snippets

    pleasant dreams. Vaphell's version works perfectly. thanks once again Stinkeye, and Vaphell.

  8. #18
    Join Date
    Oct 2008
    Beans
    3,509

    Re: HowTo: Use the unity launcher quicklist for snippets

    Updated to version 1.3 with thanks to Vaphell. (Bug fix for parsing of certain strings)
    See first post.

  9. #19
    Join Date
    Nov 2013
    Beans
    2

    Smile Re: HowTo: Use the unity launcher quicklist for snippets

    Hi community... My first post of many I hope...
    For me is working perfect under 12.04.3

    1- Is there a way to add 1 snipp with multiple lines in the list? If paragraph is added it chops the lines in diferent snippets.

    2- colors ? #FFFFFF ??


    Thank you all for everything you ve done and will ...

  10. #20
    Join Date
    Oct 2008
    Beans
    3,509

    Re: HowTo: Use the unity launcher quicklist for snippets

    Quote Originally Posted by francesc2 View Post
    Hi community... My first post of many I hope...
    For me is working perfect under 12.04.3

    1- Is there a way to add 1 snipp with multiple lines in the list? If paragraph is added it chops the lines in diferent snippets.

    2- colors ? #FFFFFF ??


    Thank you all for everything you ve done and will ...
    It's not really meant for copying paragraphs of text but as a snippets companion
    to your normal clipboard be that glipper, clipit, diodon etc.

    Any line in the ~/.quicksnips/snippets.txt file starting with "#" is ignored so you can add comments.
    If you add "#FFFFFF" via the "Add Clipboard Content" quicklist item it is added to snippets.txt
    but no quicklist item is created.
    Attached Images Attached Images
    Last edited by stinkeye; November 8th, 2013 at 12:25 PM.

Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •