Results 1 to 5 of 5

Thread: run .desktop in terminal

  1. #1
    Join Date
    Nov 2008
    Beans
    19

    run .desktop in terminal

    I have created a shortcut to an application, ML.desktop, which runs as expected when double-clicked. I would like to run it from the terminal, but can't figure out how. I get the following error, which makes sense because the .desktop file doesn't have a shebang.

    Code:
    $ ./ML.desktop
    ./ML.desktop: line 1: [Desktop: command not found
    ./ML.desktop: line 16: X-DBUS-ServiceName=: command not found
    ./ML.desktop: line 17: X-DBUS-StartupType=none: command not found
    ./ML.desktop: line 18: X-DCOP-ServiceType=none: command not found
    ./ML.desktop: line 19: X-KDE-SubstituteUID=false: command not found
    ./ML.desktop: line 20: X-KDE-Username=: command not found
    ./ML.desktop: line 21: X-Ubuntu-Gettext-Domain=desktop_kdebase: command not found

    My reason is that the .desktop file includes the 'Work path' variable, which I want to set at launch.

    Alternatively,
    a)how would I incorporate the workpath variable into a bash script that calls/links to the original application (on a network)?
    b) how would I assign a keyboard shortcut to a .desktop file?

    Don't know if it's relevant, but I have Jaunty and KDE4.2.2

  2. #2
    Join Date
    May 2007
    Beans
    980
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: run .desktop in terminal

    Why don't you use a alias?

    Edit ~/.bashrc, at the end of it add any aliases, example:
    Code:
    alias myalias='applicationName arg0 arg1 arg2'
    arg# are any arguments you want to pass to your program, the work path in this case.

    *note: After editing the file, the new aliases will be picked up in the next new terminal.

  3. #3
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,573
    Distro
    Ubuntu

    Re: run .desktop in terminal

    Is it that the application is on your desktop. In which case you need to be in /home/username/Desktop for that command to work.

    If you put it in your path ie /home/username/bin/ (which doesnt exist untill you create it) or /usr/bin/ so that all users can use it then you just need to type
    Code:
    ML.desktop
    .

    On the other hand I have no idea what this application is and have no experience with a .desktop app, so all of the above may well be nonsense.

    Well it`s not, but it may not apply in this particular case. Enlighten me.
    Quote Originally Posted by Diabolis View Post

    *note: After editing the file, the new aliases will be picked up in the next new terminal.
    Or you can just type
    Code:
    bash
    to restart bash - but you will loose your history from the moment you opened that terminal - y`know, that thing where you press the up arrow and it tells you what you just typed.

    I don`t think I`m quite "on the ball today"

  4. #4
    Join Date
    Mar 2009
    Location
    Buenos Aires, AR
    Beans
    2,325
    Distro
    Ubuntu

    Re: run .desktop in terminal

    Edit the launcher, and add.

    xterm -e "commandyouwanttorun"

    it opens automaticaly a terminal, and run the command inside

  5. #5
    Join Date
    Sep 2007
    Location
    Fort Wayne, IN
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: run .desktop in terminal

    Either move it the /home/username/ folder or, create a small script to run it in the /home/username/ folder.

    Open a text editor and put the full path to what you are trying to run.

    Save it in the /home/username/ folder.

    chmod it to execute.

    Code:
    sudo chmod +x /home/username/filestochmod
    Then when you open terminal it will be right there to bash it with ./runme

    Hope this helps a bit.
    "I am the terror that flaps in the night, I am the Ubuntu crawler. I am Darkwing Duck!"

Tags for this Thread

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
  •