• 0

Create Linux Desktop Icons with Python


Question

I've written another little tool to make my life a little bit easier, and thought I'd share it with you guys.

 

So I noticed in newer versions of Ubuntu that when you double click a .sh file, you are no longer presented with a dialog asking "Run, Run in Terminal, View", even if the file is marked as executable.  They always open in a text editor without asking.  I play a few video games via emulator, and some of them use different emulators, different options, etc.  However, even with writing scripts to automate launching the games with the appropriate software and settings, I "still" had to open up a terminal and manually execute the script.  I wanted it to be like I'd installed the games and just have an icon on my desktop that I could double click and go.  So I sat down, opened up Geany and started hashing out some python code.  I'm not an expert programmer, but in an hour or two I managed to knock out something that is functional and allows me to generate valid .desktop files that point to the icon and executable files of my choice.  You can use it for purposes other than gaming obviously, but that was my primary motivator.  Another problem I had was that I play a few Nintendo 64 games via emulator, but I haven't been able to find a decent user interface for Mupen64Plus since the default one started getting removed from newer Linux distros.  CuteMupen was the best I could find with one major issue.  The Glide video plugin works best for me, but using Glide, if you have a game open and hit escape, the game dies and you can go to the main interface to launch another one, but the window stays open.  Not a huge issue, unless you want to play fullscreen, because then escape doesn't get you out of fullscreen, it just kills the game and leaves you at a black screen with nothing but a mouse pointer.  However, using the same plugins, if you launch the game with Mupen64Plus manually from the terminal without using CuteMupen, it all works fine.  So anyway, because I'm lazy, I wrote a program that helps me make desktop icons to launch my games automatically with my own scripts.

 

If you'd like to check it out for yourself, feel free to download, modify, redistribute, etc.  I uploaded it to my sourceforge account at: 

 


 

It's all in plain text format so if you want to examine what's going on before-hand you can open all the files in a text editor.  The python file for me worked using both Python 2.7 and Python 3.3 on Linux, and on Python 3.3 on Windows 8 (In case you have all the details about where files are located and for whatever reason want to generate them in Windows)

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Posts

    • The article says the whole setup is about the size of a pencil case which sounds pretty portable to me.
    • I thought router has to have 6 Ghz band to be called wifi-7, guess I was wrong...
    • I have the Pixel 9 Pro XL...Unless this thing is "leaps and bounds" faster than the 9, I'll pass. And by leaps and bounds, I don't mean on benchmarks. "Real world" faster. Most people don't even come close to topping out the performance of their phones. Tensor G5 is Google's most powerful chip to date, boasting a staggering 36 percent performance leap over G4.
    • MIT's stunning 'bubble wrap' device squeezes water out from thin air even in deserts by Sayan Sen Image by Matteo Roman via Pexels Massachusetts Institute of Technology (MIT) engineers have built a new kind of device that can pull clean drinking water straight out of the air—no electricity needed. It’s designed for areas where water is scarce and traditional sources like rivers or lakes aren’t reliable. Right now, more than 2.2 billion people globally don’t have access to safe drinking water. In the United States alone, 46 million face water insecurity, with either no running water or water that’s not safe to drink. This new device, called an Atmospheric Water Harvesting Window (AWHW), uses a unique hydrogel panel that looks like black bubble wrap. These dome-shaped bubbles soak up water vapor from the air, especially at night when humidity is higher. During the day, sunlight makes the vapor inside evaporate. That vapor then condenses on a glass surface and drips down through a tube, turning into drinkable water. The AWHW doesn’t rely on power sources like batteries or solar panels. It’s completely passive, meaning it works on its own. The team tested a meter-sized panel in Death Valley, California, one of the driest places in North America, and got between 57.0 and 161.5 milliliters of water per day even with humidity as low as 21 percent. That’s more than what other similar passive devices have managed. “We have built a meter-scale device that we hope to deploy in resource-limited regions, where even a solar cell is not very accessible,” said Xuanhe Zhao, a professor at MIT. “It’s a test of feasibility in scaling up this water harvesting technology. Now people can build it even larger, or make it into parallel panels, to supply drinking water to people and achieve real impact.” Another cool part of the design is how they kept the water safe to drink. Usually, these kinds of hydrogels use salts like lithium chloride to absorb more vapor but that can lead to salt leaking into the water, which isn’t ideal. To solve this, MIT’s team mixed in glycerol, a compound that helps keep salt locked inside the gel. In testing, the lithium ion concentration in the harvested water stayed below 0.06 ppm (parts per million), which is way below the safe limit. The hydrogel domes also give the material more surface area, letting it collect more vapor. The outer glass panel is coated with a special polymer film that helps cool the glass, making it easier for vapor to condense. “This is just a proof-of-concept design, and there are a lot of things we can optimize,” said lead author Chang Liu, now a professor at the National University of Singapore. “For instance, we could have a multipanel design. And we’re working on a next generation of the material to further improve its intrinsic properties.” Published in Nature Water, the study says the AWHW could last at least a year and shows promise for making safe, sustainable water in places with harsh climates. The researchers believe an array of vertical panels could one day supply water to individual households, especially in remote or off-grid locations. Source: MIT News, Nature This article was generated with some help from AI and reviewed by an editor. Under Section 107 of the Copyright Act 1976, this material is used for the purpose of news reporting. Fair use is a use permitted by copyright statute that might otherwise be infringing.
    • Clear Linux is open source, indeed, so its source code is available for anyone. They're just shutting down its support from them, they're not forbidding anyone else from taking over.
  • Recent Achievements

    • One Month Later
      Ricky Chan earned a badge
      One Month Later
    • First Post
      leoniDAM earned a badge
      First Post
    • Reacting Well
      Ian_ earned a badge
      Reacting Well
    • One Month Later
      Ian_ earned a badge
      One Month Later
    • Dedicated
      MacDaddyAz earned a badge
      Dedicated
  • Popular Contributors

    1. 1
      +primortal
      505
    2. 2
      ATLien_0
      209
    3. 3
      Michael Scrip
      202
    4. 4
      Xenon
      144
    5. 5
      +FloatingFatMan
      121
  • Tell a friend

    Love Neowin? Tell a friend!