I know I can add custom shortcuts or even url links to the launcher.

Can I create custom launcher shortcuts that accept or process arguments?

For example, can I set a launcher link to open http://google.com/#q=%s, so that when I type google cat videos in launcher, it will open the link replacing %s with cat videos?

  • No, that's not possible on Unity. The closest thing would be the remote scopes (in the example you give), but not the same in the general case.
    – edwin
    Jul 16 '14 at 3:02
  1. How about making new command google:

    sudo nano /usr/bin/google

    for w in $@ ; do query=$query+$w; done
    xdg-open http://google.com/#q=$query

    Add executing permission:

    sudo chmod +x /usr/bin/google
  2. To use it, Alt+F2 to open command launcher:

    google ...
  • Thanks; this suits my needs too. Two suggestions: it should be query="$query $w", and it's best to surround the argument with quotes i.e. xdg-open "http://google.com/#q=$query" Jul 16 '14 at 6:50
  • @congusbongus, I tried that before and retried after you mentioned it. I couldn't get it to work, xdg-open keep spliting it on multiple calls. May be we have different versions (1.1.0~rc1-2u on Ubuntu 14.04). BTW, manual make it clear the parameter should be a File or URL. So It should be encoded.
    – user.dz
    Jul 16 '14 at 7:09
  • @congusbongus, if that way (ie with space) works for you, then you call simply xdg-open "http://google.com/#q=$@" no need for that loop/variable indeed I added them basically to fix that behavior (splitting call commands at space) in my case.
    – user.dz
    Jul 17 '14 at 3:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.