custom launcher for terminal+bash script doesn't work

  • hi,
    I'm trying to get a custom launcher for a shell script working. The launcher shows up in app menu/main scope(?) but it doesn't seem to do anything when clicked. The desired outcome is that it opens the default terminal and runs my bash script in said terminal. The script works when run manually from the terminal. One of my more recent attempts is listed below and is located at /home/phablet/.local/share/applications/my_script.desktop on the nexus 5 being used.

    [Desktop Entry]
    Name=My Script

    i've also tried "aa-exec -- command" and "aa-exec-click -- command" with no discernable difference. The references online that i have found are a little old so i'm hoping someone knows what has changed with UT or what i'm doing wrong. Any help is appreciated. Please let me know if i didn't include any needed info.

  • @ITwrx


    you might want to show the contents of that script

    xThe references online that i have found are a little old


  • @doniks


    echo ""
    echo "My Script is an example script for troubleshooting launchers in ubuntu touch."
    echo ""
    while [ 1 ]
    echo "Press enter to exit"
    stty -echo
    read data
    stty echo

    if [ "$data" = "" ]
        echo "--------------------------"
        echo "Via con Dios..."
        echo "--------------------------"
    exit 0


  • @doniks
    by references i just meant random internet commenteers, though i did try to find some official docs that showed what was required for functioning launchers in UT, but i didn't find any. By then my eyes were pretty burned out so i didn't scour the interglobe or anything. Is this documented somewhere?

    this is one example of some of the only info i found.

  • also, i notice that clicking on the script from the file browser doesn't work either as the file browser complains that there is no application associated with ".sh" files (or however it was worded) and it didn't give me the option to select the application i want it to use that time or as the deafault. that would have sufficed as a temporary launcher/workaround. Is there a manual way to choose the default app for bash scripts?

  • @ITwrx Mhm, honestly, don't know. I was expecting your script would contain something roughly like

    ubuntu-app-launch terminal --exec /home/phablet/

    But looking at this:
    terminal might not be able to do this.

    Could this one be interesting for you:

    Otherwise. Sorry, don't know. Someone else?

  • I did something similar in the past: I have ported from the source the MUA 'mutt' which needs a terminal application to do its work, i.e. the click othe BQ E4.5 desktop icon launches the termial-app, this asks as usual for the password to get its privs, and than starts in the terminal the MUA 'mutt'. I could post a screen of this, but I think you get the idea. The way I implemented this, IIRC, was pulling the sources of the official terminal-app, modifying the sources to start a launcher script and making a click package out of it, even with its own icon for the desktop.

    HIH, matthias

  • @doniks by your reply it sounds like it's not possible to just point to a bash script from a launcher/desktop file and it open up with a terminal and run the script like it will with normal ubuntu(well, i tested that in mate desktop. maybe that doesn't even work with unity 7? i don't have that available. ). that's all i was trying to do. sounds like there are some layers i'm not familiar with in ubuntu touch's case. thanks for the links. i'll check out scripter as a possible temporary(?) workaround.

  • @guru thank you for the info. now i have some idea of what it would take to get it done if it comes to that. I'll probably just show the user how to do it manually. I just thought i'd make it a simple tap, if possible.

  • @ITwrx
    I've fiddled around a bit with your script and another one by myself and found a few things:

    • aa-exec /path/to/ or exec /path/to/ will only work (reliable) from the terminal app, at first it wouldn't work via adb. Just tested it again while writing this lines and now it works via adb shell as well 😜 however, exec will close the shell when your script is executed, aa-exec or bash will not. (This is just FYI, not related to your goal)
    • If you include the line X-Ubuntu-Application-ID=my_script you can execute it via adb/terminal app using ubuntu-app-launch my_script and this has interestingly different errors when run from adb (WARNING **: Unable to find keyfile for application 'my_script') and terminal-app (WARNING **: Unable to start app 'my_script': Keyfile does not represent application type) respectively. I think this is the actual problem which is somehow related to the Glib key-value file parser. (the type=Application value in the desktop file AFAIK) i think it is somehow related to the Ubuntu-App-Launcher however with my skills this is as far as i can get....
    • After running the command ubuntu-app-launch my_script a second time (there is some magic going on that makes doing the exact same stuff multiple times have multiple results ;-D) the error changes both via adb and terminal to
    ** (process:16881): CRITICAL **: Error parsing manifest for package 'my': my does not exist in any database for user phablet
    ** (process:16881): WARNING **: Unable to start app 'my_script': AppID is empty

    I hope this may help you or others, if you find a solution how to make the app-launcher believe there is a correct keyfile or whatever the problem here is please let us know!


    I just wanted to say that either something with your script or with my phone (Nexus 4 on old Multirom Ubuntu Canoncial 15.04 r602) is strange. I tested with another script i called "skript" that had a similar .desktop file, only with the X-Ubuntu-Application-ID=skript and this always puts out the same error when trying to execute via ubuntu-app-launch skript (WARNING **: Unable to start app 'skript': Keyfile does not represent application type) but for your "my_script" that i placed in the exact same places as you described, the beahviour was on first try the same, then it changed to the error above which seems to indicate that the ubuntu-app-launcher doesn't get the "_" and than thinks the AppID (which is declared in the exact same way as for my is empty.... and if i change the X-Ubuntu-Application-ID=my_script to X-Ubuntu-Application-ID=myscript the "parsing manifest for package 'my'" error vanishes but it still thinks the AppID is empty

    (by the way, is just:

    echo "simple test echo"

    and the .desktop file

    [Desktop Entry]
     Exec=exec /bin/bash home/phablet/Documents/    


Log in to reply