Application icons in Linux

Deploying to Linux? Get penguinated here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

sphere
Posts: 801
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth

Re: Application icons in Linux

Post by sphere » Fri Dec 28, 2018 10:04 pm

ok, it just has to work i see.

Ok i will test some more.
Maybe alpha in the image is an issue.
So i will try with another image(without transparency)to see what happens.
Will report back tomorrow.
Thanks!
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

bogs
Posts: 3148
Joined: Sat Feb 25, 2017 10:45 pm

Re: Application icons in Linux

Post by bogs » Fri Dec 28, 2018 10:08 pm

I didn't check for alpha in a png, I'll run that in a few. Look forward to hearing your results tomorrow :D

*Edit - to test alpha, I took the original image into GIMP, then took all the black out of it and saved it out as a .png file...
StepOsTesters [Running] - Oracle VM VirtualBox_004.png
Blackout !
Then re-ran makeLauncher. Seems to work here, so I'm out of ideas :?
StepOsTesters [Running] - Oracle VM VirtualBox_005.png
Hmmmm....
Image

sphere
Posts: 801
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth

Re: Application icons in Linux

Post by sphere » Sat Dec 29, 2018 12:35 pm

Hi Bogs,

i created a starter by clicking on the desktop to see what's happening.
So here i could choose just like in your program.

The text in the script is this:

Code: Select all

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Icon=/home/jerry/Downloads/test.png
Icon[nl_NL]=/home/jerry/Downloads/test.png
Exec=/home/jerry/Downloads/Test
Terminal=false
Name[nl_NL]=test2
Name=test2
(there is no category ,because it was made on the desktop)

Then i copied the entry which was made with your program to the desktop.
Checked the script:

Code: Select all

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Categories=Development;
Name=Test
Exec="/home/jerry/Downloads/Test"
StartupWMClass=
Terminal=false
# File generated on Sat, 29 Dec 2018 12:09:47 +0100
Allthough the PNG was selected in you program, it was not written to the script.
So that must be why i don see the icon.
Schermafdruk op 2018-12-29 12-28-17.png
Strange hey, that it works with you but not here.

So to make sure i used your last version, i've downloaded again, checked some in the script. But i see the line should be added. Created a x64 standalone, but same issue.
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

sphere
Posts: 801
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth

Re: Application icons in Linux

Post by sphere » Sat Dec 29, 2018 12:55 pm

this piece rmoves the line where the icon is stated:

Code: Select all

if field "txtComment" is not "Comment about the program..." then 
      put "Comment= " & field "txtComment" into line 6 of field 1
   else
      delete line 6 of field 1
   end if
   put "Comment about the program..." into field "txtComment"
So if the comment field is not adjusted then there is no new line inserted in the script, but it removes the line with Icon=, because itś then on line 6.
So i commented out these 2 lines:
--else
-- delete line 6 of field 1

Now there is an icon, but not the png image.

**edit
i also see that with my installation the folder with the starters is: /usr/share/applications
you have this: "/.local/share/applications/"

So i could not find the starterscript, is that different per Linux Distribution?
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

bogs
Posts: 3148
Joined: Sat Feb 25, 2017 10:45 pm

Re: Application icons in Linux

Post by bogs » Sat Dec 29, 2018 2:20 pm

Well, I think I know what the problem is now anyway, your still using the older version I posted about way back there, and I am using the version(s) linked to here.

*Edit - I have removed the previous versions to prevent confusion, and have gone back to link any past posts to the posts for the newer versions.

When you download the zip file, all you should see in the 'create launcher' folder is this...
Selection_003.png
1 file, 1 folder....
If there is anything else in that folder, delete it and turn the file 'AutomatedMakeLauncher' into an exe.
sphere wrote:
Sat Dec 29, 2018 12:55 pm
i also see that with my installation the folder with the starters is: /usr/share/applications
you have this: "/.local/share/applications/"

So i could not find the starterscript, is that different per Linux Distribution?
You absolutely have the "/.local/share/applications/" folder. Open your file browser, go to your home directory, and if you don't see any folders that start with a '.' then on your keyboard hit

Code: Select all

ctrl+h
and you should now see a folder named ".local". This is (one of the places) where the menu draws from, and the place the newer launcher maker places the file.

/usr/share is a folder requiring root permission to write to, if you were installing a program for all the users on a machine. The approach I'm using writes only to the users folder, and therefore doesn't require priviledge escalation to root or sudo.
Last edited by bogs on Sun Jan 13, 2019 2:10 pm, edited 3 times in total.
Image

sphere
Posts: 801
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth

Re: Application icons in Linux

Post by sphere » Sun Dec 30, 2018 2:26 pm

Yes!
Works perfectly!
works.png
Great job! and thanks very much.

I will make a minor change, so that i can choose the category like in the first releases and hit the write button again. I liked that.

So now back to eating mucho mucho Oliebollen https://nl.wikipedia.org/wiki/Oliebol ,a tradition, for these last 2 days of this year :D
Happy new year Bogs!
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

bogs
Posts: 3148
Joined: Sat Feb 25, 2017 10:45 pm

Re: Application icons in Linux

Post by bogs » Sun Dec 30, 2018 2:44 pm

Glad to hear it is finally working correctly for you!
sphere wrote:
Sun Dec 30, 2018 2:26 pm
I will make a minor change, so that i can choose the category like in the first releases and hit the write button again. I liked that.
That should be easy to do, the major corrections I made were instead of 'put into line x', I put the variable 'after line x', and stopped deleting any of the lines.

This allows you to have a fixed number of lines that doesn't change, something that is so obvious I was embarrassed it wasn't how the first run of code went :oops:

I'll be busy straightening out my computer today since I was apparently the victim of a hack (if you see any wierd posts by me before I'm finished, I swear it wasn't me), but after I'm done I'll make the corrections and post the update for any others that come along behind us.

Happy (and hopefully safe!) New Year to you and yours, and everyone else that I don't see before then :wink:
Image

bogs
Posts: 3148
Joined: Sat Feb 25, 2017 10:45 pm

Re: Application icons in Linux

Post by bogs » Wed Jan 02, 2019 12:16 pm

Guided by your comments along this thread, I've revised the script a bit.

You don't have to turn off messages anymore when opening it in the IDE, simply click the answer dialogs "Yes" button when it opens.

When the program launches, after it gathers the base information, it will put up an answer dialog asking if you want to add a comment or change the category. If you answer yes, you can make any changes before the file is written with the combo box for categories, or the field for comments, or even in the field the file text itself is in.

For instance, if your program works in the terminal, then change 'terminal=false' to 'true', and then you can write the file out (it won't pause again) and the program will close.
Selection_001.png
The answer is...
If you answer no, the program will simply write out the base file and close. The file will be written out to 2 places, the sub folder of the program '/AutomaticCreateLauncher/launcherRes/', and the local menu entry folder '~/.local/share/applications/'.

If you decide you want the program to be fully automated for something, like to include with your program on some one else's machine, just comment out the answer dialog line, and change the custom property template directly to change the category and comment. Optionally, if you include it for distribution, you may also want to launch it so it doesn't show the window, which might confuse a user, but that is up to you :D

All the rest of it is pretty much what it was before, heavily commented and with minor code change. Enjoy and let me know if you hit any problems :mrgreen:

*Either version (or both) can be downloaded from here.
Last edited by bogs on Sun Jan 13, 2019 2:09 pm, edited 2 times in total.
Image

sphere
Posts: 801
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth

Re: Application icons in Linux

Post by sphere » Wed Jan 02, 2019 6:06 pm

You're quicker than me Bogs 8)

I was busy with it, so that a few lines would be changed before writing, but had to do something else too.
So i was not finished yet.

But this makes it perfect! I can stop doing my adjustments and use your version :mrgreen:
I think you've helped a lot of other people too with this nice tool.

Muchos Gracias!!

ps. I will reboot to Ubuntu and check it out.
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

bogs
Posts: 3148
Joined: Sat Feb 25, 2017 10:45 pm

Re: Application icons in Linux

Post by bogs » Wed Jan 02, 2019 8:03 pm

Well, let me know if there are any issues with it as it sits. I was thinking about adding a way to browse to the folder holding the exe you want to create the launcher for, but at that point you are basically just getting the native tool to create a launcher :P
Image

sphere
Posts: 801
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth

Re: Application icons in Linux

Post by sphere » Wed Jan 02, 2019 10:18 pm

This is great as it is.
I've made a x64 Linux standalone in LC902. and it works superb.
Thanks for your effort !
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

bogs
Posts: 3148
Joined: Sat Feb 25, 2017 10:45 pm

Re: Application icons in Linux

Post by bogs » Wed Jan 02, 2019 10:28 pm

My pleasure, glad it works for you. You'll have to tell me how it goes if you ever include it with a program as part of a setup :D
Image

sphere
Posts: 801
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth

Re: Application icons in Linux

Post by sphere » Wed Jan 02, 2019 11:14 pm

No problem.
Of course will do that :)
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

bogs
Posts: 3148
Joined: Sat Feb 25, 2017 10:45 pm

Re: Application icons in Linux

Post by bogs » Wed Jan 02, 2019 11:25 pm

That would make my year :mrgreen:

*Edit -
Well, I found a problem already with the program. Looks like I will have to look at the long files version to score the executable after all :?

*Edit 2 - Actually, found an even better way than that :wink:
Last edited by bogs on Fri Jan 04, 2019 12:10 pm, edited 1 time in total.
Image

bogs
Posts: 3148
Joined: Sat Feb 25, 2017 10:45 pm

Re: Application icons in Linux

Post by bogs » Fri Jan 04, 2019 4:53 pm

So, one of the problems I found was that my method for detecting the executable file was pretty poor, as I only evaluated the names of the files in the folder, and not their permissions. I found a lot of circumstances where this really showed how bad a method that was :roll:

The new version will only pick an executable marked file for the initial run (if you manually override that, well, there isn't much I can do about that :P )

Some other issues I found were that it works out better naming the launcher after the folder the file is in, rather than relying on the exe name for the entry (go figure). I found this out when testing it on the Lc IDE files, which are all named the same :P :P
Selection_002.png
Something new, something old...
Selection_003.png
Results matter!
One thing I found annoying in my original design was moving the creator to all the different program folders. It works well if your going to package it as part of an installer, since it is already setup to run when opened, but as a desktop utility it was rather tedious :shock:

That has been eliminated in this version, but if you plan to use one of the versions as part of an installer routine, your better off with the other version (which I will be correcting the deficiencies and reposting).

I'll be posting this one when I finish testing it a bit further, hopefully I'll be able to call it done after that :twisted:

Even used it on itself :mrgreen:
Image

* You can download either version (or both) from here.
Last edited by bogs on Sun Jan 13, 2019 2:07 pm, edited 2 times in total.
Image

Post Reply

Return to “Linux”