Application icons in Linux

Deploying to Linux? Get penguinated here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

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

Re: Application icons in Linux

Post by bogs » Fri Jan 04, 2019 8:29 pm

... and here is the updated automatic version. Any and all feedback on either maker welcome :D
Last edited by bogs on Sun Jan 13, 2019 2:05 pm, edited 1 time in total.
Image

sphere
Posts: 921
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Application icons in Linux

Post by sphere » Wed Jan 09, 2019 2:53 pm

Hi Bogs, i see i totally missed this post. :shock:
This looks very promising.

Will check it out tonight :D

Thanks!
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

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

Re: Application icons in Linux

Post by bogs » Wed Jan 09, 2019 3:13 pm

No problems, last few days were really busy for me, I haven't even had time to make *corrections to the fuller version of it lately.

*Corrections -
  1. I notice that the interface is clunky when it comes to picking the actual exe file. Plan is to collect all exe file names (minus ones names 'setup', 'install', 'pref', etc) when more than 1 are in the folder and present the choice of exe to the user instead of requiring manually choosing by clicking on the label.
  2. Getting the icon for the program (if none were found) currently is done at the end, you have to click yes to making changes. Thinking of changing this to if no icon is found, presenting the dialog to pick one immediately.
Last edited by bogs on Sun Jan 13, 2019 1:59 pm, edited 1 time in total.
Image

sphere
Posts: 921
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Application icons in Linux

Post by sphere » Thu Jan 10, 2019 8:41 pm

Hi Bogs,

it works awesome !
Very nice how you've changed it. :mrgreen:
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

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

Re: Application icons in Linux

Post by bogs » Fri Jan 11, 2019 2:09 pm

Working on some further changes to meet these goals (in no particular order) -
  • make the code more modular - now that the semi-rough draft is finished, moving some parts to individual handlers to ease maintenance.
  • changing icon and exe finding routines to better filter options and hopefully get the correct items (if more than one found) the first time, probably by presenting a list.
  • changing the scroll bars to only show if needed.
  • changing the semi-automated version to include the minimum amount of information needed, reasoning being that an end user shouldn't be messing with it if used as part of an install routine. More work on the dev's part (will have to supply partial path to the icon, exe and such in the template), but should be transparent on the user end.
  • control layout seems ok to me, but if anyone has suggestions, would be happy to consider them :D
If you can think of anything missing, go ahead and suggest it.
Image

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

Re: Application icons in Linux

Post by bogs » Sun Jan 13, 2019 12:10 am

Ok, I've uploaded the newest version of the remote launcher maker (which you can find here).

I've broken most of the routines out of the openStack into their own handlers, so goal 1 complete. I'll be doing the same to the more automated one when I get the time.

Some new things from the previous version -
  • Now has a help system :P
  • New routine for picking the exe and icon files. If more than 1 of each is found, a dialog will confirm which is the correct one. If none is found, a different dialog will ask you to point to it (should be very rarely seen).
  • Scrollbars were replaced with tool tips, since sometimes the scrollbars would not extend the field far enough to read the text in older IDEs.
  • Removed the StartupWMClass entry as a minor simplification.
I wasn't able to trip it up, although I'm positive I still haven't gotten all the redundant code out yet, I may wind up going through that later.

While .png based icons will show up in the icon preview, .svg ones of course will not. I am not sure I want to try tackling that for the older versions of the IDE, Al Capellan's svgl works fantastically though if you really want/need to be able to preview them.

Have fun :D
Last edited by bogs on Sun Jan 13, 2019 1:57 pm, edited 1 time in total.
Image

sphere
Posts: 921
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Application icons in Linux

Post by sphere » Sun Jan 13, 2019 1:11 pm

Great great, it's getting better and better :)

I like to write my stacks too, like as simplistic to use for the user.

thanks man!
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

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

Re: Application icons in Linux

Post by bogs » Sun Jan 13, 2019 1:25 pm

Heh, I really need to go back through those routines for picking the exe and icon out, what a mess those turned into. Time to pull out the scratch paper :P

Also thinking (when I get the time ahead) of trying to figure out a way to display the svg icon preview. I've seen some great solutions, but they are far more complete than I need for this. The only icon format that is standard for all 'nixes I know that is missing now is .xpm, but that is for another day.

Ah well, all part of the refinement process :D

I think I'll rig a dropbox folder up, so the link to download from won't keep changing all the time too (probably should have done that first, but didn't think I'd revise it so much :roll: ).

*Edit - Ok, folder created, all updates for both versions from here on out will be uploaded to here, which should cut down on any confusion chasing posts (which are all being corrected to point to this link) :wink:
Attachments
Selection_001.png
Image

sphere
Posts: 921
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Application icons in Linux

Post by sphere » Mon Jan 14, 2019 10:26 pm

Nice, i can't wait. It's already working wonderfull. :D
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

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

Re: Application icons in Linux

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

In another post, someone mentioned rabbit holes and how they can be...erm, distracting I guess :D

In this utility, I just wasted about 3 days playing with this rabbit hole :P

The idea behind it was to make sure we had an executable to proceed with, or if the user decided to quit, or that they had even typed in the correct number for any of the choices. This is a good example of not having your brain cells connect while banging out code~

Code: Select all

on pickExe
   put shell("file *") into tmpExe
   // find the executable file, if there is one... 
   if tmpExe is not empty then
      repeat with x=1 to the number of lines of tmpExe
         set the itemDelimiter to ":"
         if matchChunk(line x of tmpExe, "LSB executable") then 
            put item 1 of line x of tmpExe into line x of tmpExe
         else
            put "" into line x of tmpExe
         end if
      end repeat
      filter tmpExe without empty
   end if
   // put the possible executable files into tmpName...
   put tmpExe into tmpName
   
   set the itemDelimiter to slash // make sure we return this to / for the rest of the program...
   
   // make sure there is only one line left in tmpName...
   if tmpName is not "" then
      if the number of lines of tmpName > 1 then
         repeat for each line x in tmpName
            add 1 to tmpLineNum
            put tmpLineNum & " " & x before line tmpLineNum of tmpLine
         end repeat
      end if
      ask question "Is one of the following the correct program?" & return & return & "Put the line number of the correct name below..." & return & return & tmpLine
      if the result is "Cancel" then 
         exit to top
         else 
            put the number of lines of tmpLine into tmpLineNum
            repeat until (it > 0 and it <= tmpLineNum)
               if it is not empty then   //  if the number entered is greater or less than the possible number of choices, then ask again for the right number...
                  ask question "Is one of the following the correct program?" & return & return & "Put the line number of the correct name below..." & return & return & tmpLine
                  if it is "" then 
                     answer question "Would you like to quit?" with "Yes" or "No"
                     if it is "Yes" then exit to top
                     if it is "No" then answer question "Would you like to pick the executable manually?" with "Yes" or "No"
                     if it is "Yes" then answer file "Please select an executable..." with (tmpPath)
                     if it is "No" then exit to top
                     
                  end if
               end if
            end repeat
            breakpoint
            // assume we have the right program...
            put line it of tmpName into tmpName
            
         end if
      else
         answer file "Unable to find an executable file..."
         if it is not empty then
            put it into tmpName
         end if
      end if
   
end pickExe
Since the main goal of all the above gobbly-goop was just to make sure we had something to work with or allow the user to quit, I changed it to this much simpler version ~

Code: Select all

on pickExe
   // find the executable file, if there is one... 
   if tmpExe is not empty then
      repeat with x=1 to the number of lines of tmpExe
         set the itemDelimiter to ":"
         if matchChunk(line x of tmpExe, "LSB executable") then 
//   "LSB executable" verifies it is not a .dll or .so file
            put item 1 of line x of tmpExe into line x of tmpExe
         else
            put "" into line x of tmpExe
         end if
      end repeat
      filter tmpExe without empty
// may be a problem with this as I still find empty in the last line...
      if the number of lines of tmpExe > 1 then
         put the number of lines of tmpExe into tmpNum
         set the itemDelimiter to space
         repeat with x=1 to tmpNum 
            put quote & line x of tmpExe & quote & space & "or" & space after tmpAnswer
         end repeat
         if the last item of tmpAnswer = "or" then delete the last item of tmpAnswer
         put "answer" && quote & "Please choose one of the options below as the executable..." & quote && "with" && quote & "Cancel" & quote && "or"  && tmpAnswer into tmpAnswer
// eliminate the need for the user to do anything other than click a button...
         do tmpAnswer
         if it is "Cancel" then
            exit to top
         else
            put it into tmpExe
         end if
      end if
   end if

end pickExe
NOT the most stellar code on the planet, but I think a *lot* better than the mess above it. Too funny how we dig holes for ourselves :lol:
Image

sphere
Posts: 921
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Application icons in Linux

Post by sphere » Fri Jan 18, 2019 9:49 pm

Ha, you have not seen my clunky codes...
although i tend to tink that it is logical and straight forward in many cases.

But sometimes returning to a script after a while does take some time to get into again. :shock: :roll:
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

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

Re: Application icons in Linux

Post by bogs » Sun Jan 20, 2019 2:17 pm

sphere wrote:
Fri Jan 18, 2019 9:49 pm
But sometimes returning to a script after a while does take some time to get into again. :shock: :roll:
Yes, when I come back to things I wrote years ago (or decades in some cases), I really wonder what I was thinking at the time. Thankfully my addddddddddd saves me from thinking about it overly long :lol:

Ok, minor patching update to increase the accuracy of getting the exe and Icon correctly.

Some minor additions to the program -
Added a test to see if it is the first run [ checks for the tmpResFolder ]. If it isn't found, program assumes it is first run and displays the help file before continuing.
Added a test for Image Magick [ should be on most 'nix systems by default I think ]. I will later be incorporating Image Magick to allow representation of .svg and .xpm files by using it to convert any that the program comes across into a temporary .png file in the tmpResFolder, then displaying that.

I've been testing this myself on a wide variety of different types of programs, some that come with multiple exe files, some that come with multiple icons in the main folder, some without any icons, etc. across multiple distributions. I haven't seen it barf up on anything yet, but would appreciate it if you can tell me if you see something it doesn't handle well.

This pertains to the remoteMakeDesktopLauncher.livecode version only, I haven't made any changes to the more automated one yet.
Image

sphere
Posts: 921
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Application icons in Linux

Post by sphere » Tue Jan 22, 2019 9:49 pm

Hi Bogs,

thanks very much.
i've downloaded your latest version, but had no time yet to test it.
I hope to do it this week, i'll keep you posted.

Do your additions like image magick have to be installed? i don see it in Mate.
Or is it an optional choice :?:
Thanks !
2018 Worldwide Mobile Market share: Android 84.4% !!!, iOs 15.1%, others 0.1%

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

Re: Application icons in Linux

Post by bogs » Wed Jan 23, 2019 3:03 pm

sphere wrote:
Tue Jan 22, 2019 9:49 pm
Do your additions like image magick have to be installed? i don see it in Mate.
Or is it an optional choice :?:
Having Image Magick or Inkscape (which I'm also adding a test for) or not having either of them will make no difference in the end result of the program, which is to make a menu entry with whatever you have that qualifies (an executable and an acceptable icon). It will only affect what you see (or don't see) in the icon box :D

The main use of those programs is to convert .svg and .xpm icons (if they are available) to a temporary png file (which will sit in the tmpResFolder) since Lc doesn't provide a ready way to do that itself, and I didn't feel like writing my own routine (or incorporating someone else's routine) to convert them to .png so Lc can display them because I am lazy :P

I also want this to be as backwards compatible as possible, so using Lc 8.x and up as the IDE just to have the svg part is a non starter (and they don't do xpm either, far as I can tell, despite what the guide says).

Image Magick is installed on most 'nix distros, which is why I am running the test for that one first. Inkscape is *often* installed on 'nix distros (but not as often as IM), and both of these can convert from the command line, which makes them easy to shell out to, change the (svg or xpm) to a temporary png, and use that to display in the icon box.

For the svg part, Image Magick relies on the rsvg library being installed as well in some cases.Technically, if Image Magick can't find the library, it is supposed to fall back to its own internal routines, but I did find some versions that do not do this correctly :roll:

Inkscape apparently not so much (but that makes sense, considering what Inkscape is).

The program will still use whatever the user picked as the actual icon for the menu entry, so whether or not you have either of the above programs will not affect the menu entry in any way. You will merely see a message saying that the program can not find either of those two programs, so .svg and .xpm files will not be displayed in the box.

*Edit - I forgot to mention that if you wanted to find out ahead of time whether Image Magick is installed or not, you can open a terminal and type "convert -version". The more important (for svg format) library you can see with "rsvg-convert -v". The output will look like this -
Terminal_001.png
Change is good...
Image

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

Re: Application icons in Linux

Post by bogs » Thu Jan 24, 2019 11:32 pm

Well, I had some time today so I incorporated some changes into the help page which now, aside from being formatted a little better, includes a link to this thread as well as a link to the folder where all updates are uploaded to. The link *should* open in the local browser (it does here, anyway), but I count on someone independently testing that feature out :D

I also put in the code to have the testing for Image Magick and Inkscape, and I got at least Image Magick to convert the .svg icon to a temp. png format for display. According to everything I could find, .xpm is supposed to display in an image object, but I've yet to see it happen. Maybe I'm not holding my nose right :roll:

I'll be spending the next spare moments re-vamping the automated version of this so that it is entirely suitable for an installer to call. This means a bit more work for those that want to use it as part of an installer, of course, as you will have to set the names of the files, categories, etc yourself, but I'll make sure it is heavily commented to point out where that needs to be done.
Image

Post Reply

Return to “Linux”