8

I have Unity's launcher hidden as I prefer to use cairo dock.

This is why I am trying to find a way to make the things installed from the Ubuntu Software Center to automatically set a shortcut in my desktop.

8
  • I can't make sense out of this. Why would you want to do this? What tool/launcher has to do with everything? – Braiam Jan 5 '15 at 22:54
  • 1
    @Braiam I believe the OP wants to have a shortcut created on the desktop for programs (s)he downloaded through the software center, the way many Windows programs do. The launcher was mentioned because the software center automatically pins new installs to it, but the OP doesn't use that. – Seth Jan 5 '15 at 22:57
  • @Seth well, that's a wild guess because he wants that the software "downloads" to the desktop. – Braiam Jan 5 '15 at 23:00
  • 2
    @Braiam A little understanding of how newer users think helps a lot ;) He clearly doesn't want the binaries on his desktop.. You can't even use the software-center to download binaries. – Seth Jan 5 '15 at 23:01
  • First off im a she.....second off im talking about when I download like gimp, or PDF stuff or games or whatever applications, I want it to go to my desktop so I can access it because I dont use the little toolbar that comes with UBUNTU i use the cairo dock and I cant seem to figure out how to change where the ubuntu software center(this is where i download sed programs) downloads – Ashleigh Johnson Jan 5 '15 at 23:04
6

Run the script below in the background and it will automatically create a starter on your desktop on (only) newly installed software.

It also:

  • checks if the new item actually is an application, meant to start from a launcher (checking for NoDisplay=true)
  • makes the launcher on your desktop executable, ready to use.

How to use

  • Copy the script below into an empty file (use e.g. gedit), save it somewhere as make_starter.py.
  • If you first want to test it: run it from a terminal window by the command:

    python3 /path/to/make_starter.py
    

    Install an application like you are used to. An icon should appear on your desktop after installation has finished

  • If all works fine, add it to your startup applications: Dash > Startup Applications > Add. Add the command:

    python3 /path/to/make_starter.py
    

Note

Localized versions of Ubuntu may have a different name for "Desktop" ("Bureaublad" in Dutch). If so, replace in the line:

desktopname = "Desktop"

"Desktop" by the loacalized name.

The script

#!/usr/bin/env python3
import subprocess
import os
import time
import shutil

desktopname = "Desktop"
dr = "/usr/share/applications"

while True:
    current = os.listdir(dr)
    time.sleep(10)
    last = os.listdir(dr)
    for item in last:
        if not item in current and item.endswith(".desktop"):
            file = dr+"/"+item
            with open(file) as src:
                text = src.read()
            if not "NoDisplay=true" in text:
                target = os.environ["HOME"]+"/"+desktopname+"/"+item
                shutil.copyfile(file, target)
                command = "chmod +x "+target
                subprocess.Popen(["/bin/bash", "-c", command])
5
  • Thank you @Jacobvlijm I will have my dad read your comment and do it for me as I don't understand all the technical stuff – Ashleigh Johnson Jan 6 '15 at 19:11
  • 1
    This has nothing to do about the answer's goal but I take the opportunity to remark the Python syntax, it's extremely simple to understand. Of course you can use something else like bash or even C, but you can't get more human than this. :-) – Lucio Jan 7 '15 at 22:07
  • 3
    @Lucio good chance that if you'd write plain English, you'd write a python script by accident :) – Jacob Vlijm Jan 7 '15 at 22:11
  • 1
    @JacobVlijm I can't keep myself from saying that on the other hand, good chance that if you'd leave a monkey in front of a PC she'd write a Perl script by accident :) – kos Mar 11 '15 at 8:33
  • @kos I didn't know there were so many monkeys on AU :) To be honest: my cat earned most of my reputation here. The single answer I wrote myself was the downvoted one :). – Jacob Vlijm Mar 11 '15 at 14:35
3

This will be incredibly messy, since there might be well over a hundred application icons. The icons (actually, desktop launcher files) are usually in /usr/share/applications. So you could run the following command in a terminal:

find /usr/share/applications -type f -name '*.desktop' -exec cp --target-directory ~/Desktop/ {} +

but this would create a copy of every single launcher on your desktop. (possibly a few hundred, depending on your environment)

You could browse /usr/share/applications in the file manager, and manually copy them for relevant applications to the desktop. There's no automatic way to make the Software Centre do this, as far as I can tell.

11
  • 1
    I wonder if synaptic has some kind of post install scripts it can run or something.. Obviously the software center wouldn't have that but synaptic might. Otherwise the only other way of accomplishing this would be install things through the command-line with a custom script. Just thinking aloud. – Seth Jan 6 '15 at 1:28
  • One could probably save a list of the installed applications using dpkg and diff the new selections list and the previous selections list after each installation. Then, shortcuts can be created using a script which copies the relevant .desktop files to the desktop. – Rohith Madhavan Jan 6 '15 at 5:09
  • 1
    So pretty much when I install something I have to manually put it on my desktop? A little annoYing but I can handle that – Ashleigh Johnson Jan 6 '15 at 6:37
  • 1
    Sorry for the edit @muru but I'm trying to protect the innocent... ;-) On my system: ls /usr/share/applications/*.desktop | wc gives: 168 168 7851 – Fabby Jan 6 '15 at 13:34
  • @AshleighJohnson but there is the thing: installed applications get added to the launcher. So it is there for you directly just not on the desktop itself. – Rinzwind Jan 6 '15 at 15:18

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.