AppLauncher - MacOS files launcher

A place for you to show off what you have made with LiveCode

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Zax
Posts: 472
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

AppLauncher - MacOS files launcher

Post by Zax » Thu Mar 07, 2024 3:44 pm

I'm an old fan of DragThing (which stopped development for a few years) and, although I don't really like Windows, there is a sort of area in the start menu in Windows that I like.
AppLauncher is a mix between a very simplified DragThing and this Windows menu. The icons are of course shortcuts but also accept document drop, in order to open documents with another application than the one normally intended.
Categories can be renamed.

The only thing I really miss is the ability to assign keyboard shortcuts to icons, like DragThing allowed. But that's way beyond my skills.

This application is brand new... I will see in use if it works correctly and if it meets my specifications. I was not able to test it on a recent MacOS.

appl.jpg
The screenshot shows the application "deployed". When it is "closed", only the small button on the right remains.

https://sw.ixoft.com/files/


Thanks to the members of this forum who helped me a lot :)

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: AppLauncher - MacOS files launcher

Post by stam » Thu Mar 07, 2024 6:28 pm

Thanks Zax,
I gave it a try. It produced an error on first run
Screenshot 2024-03-07 at 15.21.12.png
but then ran fine. It's kinda cool and does what it says on the tin.

Overall this works well.
Some comments, perhaps for a version 2:

1. Usage The button to lock it in an open position is right at the edge of the stack's titlebar, and it's easy to overshoot it resulting in the window closing abruptly and having to repeat. You have to know to lock it, then drag the apps precisely over the placeholders for the icons, but when dragging apps onto it, they don't hilite when dragging Finder items in. It's not immediately obvious to someone picking it up that you need to!

Maybe consider moving the 'lock' button to a 'safer' place and make it more obvious this is how you add icons? Not sure if there is a way to make the receptacles visible on drag - certainly they do when moving icons from one slot to another but not when you drag stuff from the finder unless you're right on top of the slot. Since the drag starts from outside the app, maybe acting on the resumeStack as the stack becomes active with the drag could do that?

2. Accessibility The other thing to consider is that this only works if the app is in the foreground - you have to switch to the app then open it then click. And having switched to the app I would probably prefer if the window showed on mouseEnter rather than mouseUp.

Some Mac users may take the 'low-tech' solution of just adding folders of shortcuts to their Dock (add aliases to these, then set it to 'Fan' or 'Grid' and it pops up your apps/documents), making these accessible from anywhere.

I've never used it, but perhaps having an option to set the systemWindow of the stack to true so it always shows may be a nice option for some? This will make always float above any app or window.

Ideally this would be a menubar item but really not sure if/how you can do this with LiveCode. There is a 'Mac Status Menu' library that I guess lets you do this, but the documentation puts Spartans to shame - to say it's laconic is a vast overstatement.

3. Image Quality The icons of the stuff dragged on appears to be quite low-resolution. I don't know if setting the resizeQuality to "best" will help with that? Or maybe not...

5. Preferences Consider adding a 'preference' that would allow naming/renaming of the row sections etc. On this note, the preferences appear in a non-mac-like position (first menu item in the file menu). I think if you leave it in the default position in the end of the Edit menu, livecode will put this in the application menu for you, and you can give it the usual MacOS shortcut of cmd-,

The preferences appear right over your 'toggle' at the right edge of the screen, but as a user I expect these to appears centre-screen. I presume this is a substack of the main stack. Consider centering it on the screen, easier on the eyes.

Also - unlock is not directly intuitive - perhaps consider renaming it to a more explicit name like 'move anchor' or whatever you call your little iconified widget ;). Movement of said anchor is very choppy - looks like there is a lot of processing going on during mouseMove/drag, can this be deferred to mouseUp? I think perhaps this is best done with a right-click-drag or ctrl/cmd-drag rather than having to go to the file menu and manually select the item first.

Overall, your app is solid and does what it says it will.
I hope you find these comments useful but won't be offended if you ignore them all :)
Stam

Zax
Posts: 472
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: AppLauncher - MacOS files launcher

Post by Zax » Fri Mar 08, 2024 9:29 am

Thank you Stam for your comments and your always precise analysis.
I was in a hurry to finish this first version in order to test it on a daily basis and it is true that certain things will need to be corrected.

The 7300 error on the first run annoys me a lot because I can't reproduce it. Can you tell me exactly when it happened? See code below.

Concerning the small lock box, it is only useful for the first launches, when you want to populate the board with lots of files. When adding a single file, it is not necessary to lock the display.

When adding a file, the hovered boxes display their own box. The grid is made visible by changing the border color in the preferences.

Concerning the quality of the icons, they are very pretty on a non-retina screen ;)
I cann't improve this quality for 2 reasons:
- I don't have a retina screen
- the icon creation process is an extension that I wrote by copying and pasting other codes I don't really understand! I guess it has to do with "NSImage.-representations".
In LC, the images resizeQuality is already set to "best".

For the other points, you are absolutely right and I will try to implement them in future versions.


This is code used when a file is dropped onto an empty board image:
Image behavior script: board icons

Code: Select all

on dragDrop
   put line 1 of the dragData["files"] into droppedFilePath // 1 seul drop à la fois
   set cursor to arrow
   
   if (the fileName of me = "") then // behavior: each image
      dropNewElement droppedFilePath
   else launchElement the short name of me, droppedFilePath // lancement par drop sur élément existant
end dragDrop

on dropNewElement droppedFilePath
   put dropThing(droppedFilePath) into arrFileInfos // "fileName", "filePath", "fileType" et "iconPath"
   if (arrFileInfos is not an array) then
      answerError "An error has occured." & cr & "    " & arrFileInfos & "        [#7300]"
      exit to top
   end if
   ... // process if no error
end dropNewElement

function dropThing droppedFilePath // returns array, ou error string
   if ((there is not a file droppedFilePath) and (there is not a folder droppedFilePath)) then return \
         "No valid dropped file."
   else
      ... // process if no error and returns array
   end if
end dropThing

Zax
Posts: 472
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: AppLauncher - MacOS files launcher

Post by Zax » Fri Mar 08, 2024 10:03 am

Concerning the quality of the icons, I would like to check something.
Could you look inside your ~user/Library/Preferences/AppLauncher Icons/ folder and tell me the size of a .png image? It should be 128x128 pixels.

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: AppLauncher - MacOS files launcher

Post by stam » Fri Mar 08, 2024 10:29 am

Zax wrote:
Fri Mar 08, 2024 10:03 am
Concerning the quality of the icons, I would like to check something.
Could you look inside your ~user/Library/Preferences/AppLauncher Icons/ folder and tell me the size of a .png image? It should be 128x128 pixels.
Yeah that might be the issue. Mine are 32 x 32 px.

This is what it looks like in the app:
Screenshot 2024-03-08 at 09.22.43.png
This is what the files look like in Finder:
Screenshot 2024-03-08 at 09.23.30.png
And this is what I see inspecting the image properties in Preview.app:
Screenshot 2024-03-08 at 09.24.39.png

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: AppLauncher - MacOS files launcher

Post by stam » Fri Mar 08, 2024 10:46 am

Hi Zax,
Zax wrote:
Fri Mar 08, 2024 9:29 am
The 7300 error on the first run annoys me a lot because I can't reproduce it. Can you tell me exactly when it happened? See code below.
I just lauched the app. On first run that is what I was shown, but it hasn't recurred since. I'm guessing has something to do with not finding what it expected to find in the local preferences? I suspect that this was then created and the error has not occurred since.
Zax wrote:
Fri Mar 08, 2024 9:29 am
Concerning the small lock box, it is only useful for the first launches, when you want to populate the board with lots of files. When adding a single file, it is not necessary to lock the display.

When adding a file, the hovered boxes display their own box. The grid is made visible by changing the border color in the preferences.
See images below - if I drag in an icon in, only 1 box only highlighst when the mouse is actually over a particular receptacle, but if not then no destinations hi light:
Screenshot 2024-03-08 at 09.40.07.png
Whereas if I want to move the icon, all possible boxes highlight:
Screenshot 2024-03-08 at 09.39.40.png
As a user this can be slightly confusing because I have to hunt blindly for a box (at which point I get a 'plus' icon), and if possible all possible destinations should highlight when dragging in a new icon, just like when moving an icon.

I'm afraid I don't have time to review your code today (and doubt I can add much!) but will do (always good to learn stuff!)

Stam

Zax
Posts: 472
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: AppLauncher - MacOS files launcher

Post by Zax » Fri Mar 08, 2024 11:15 am

OK. At this time, I saw 2 real bugs.

1. Icon size. It deals with Objective C "NSImage.-representations" and "-bestRepresentationForRect:context:hints:"
I don't know if I'll be able to undersatnd how to modify the extension code :?

2. 7300 error. I obviously tried to launch the app without any prefs file (like a real first launch) but wasn't able to reproduce the error.
So at this time it's a mystery.

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: AppLauncher - MacOS files launcher

Post by stam » Fri Mar 08, 2024 11:38 am

Zax wrote:
Fri Mar 08, 2024 11:15 am
2. 7300 error. I obviously tried to launch the app without any prefs file (like a real first launch) but wasn't able to reproduce the error.
So at this time it's a mystery.
I can reproduce this quite consistently by:
1. Quitting the app
2. Deleting file ~/Library/Preferences/AppLauncher_Prefs.ixp
3. Re-launching the app
4.
Screenshot 2024-03-08 at 10.36.28.png


Reviewing your code above, is there any other part of the app that executes the line

Code: Select all

 answerError "An error has occured." & cr & "    " & arrFileInfos & "        [#7300]"
If not, then why is on dropNewElement droppedFilePath being run on startup? Is this the issue?

Regardless, it looks like no check is being done for the file existing.
When I've done similar things, my startup stack (which becomes the app) checks to see if required files like preferences exist at every startup, and if not creates (or moves existing bundled files) to the desired location.

Stam

Zax
Posts: 472
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: AppLauncher - MacOS files launcher

Post by Zax » Fri Mar 08, 2024 1:48 pm

Then, we are facing to 2 mysteries :(

1 - I don't have this error when I do your test process (launch the app without the prefs file).
2-
stam wrote:
Fri Mar 08, 2024 11:38 am
Reviewing your code above, is there any other part of the app that executes the line

Code: Select all

 answerError "An error has occured." & cr & "    " & arrFileInfos & "        [#7300]"
If not, then why is on dropNewElement droppedFilePath being run on startup? Is this the issue?
The code with 7300 error is only called on dragDrop built-in message.
I'm sure the problem is not coming from the preferences management. It seems that the dragDrop message is sent on startup on your OS and not on mine. I've looked at the Message Watcher in IDE envitonment without finding anything.

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: AppLauncher - MacOS files launcher

Post by stam » Fri Mar 08, 2024 1:51 pm

Zax wrote:
Fri Mar 08, 2024 1:48 pm
The code with 7300 error is only called on dragDrop built-in message.
I'm sure the problem is not coming from the preferences management. It seems that the dragDrop message is sent on startup on your OS and not on mine. I've looked at the Message Watcher in IDE envitonment without finding anything.
I can't say why that may be, other than I'm running the latest version of MacOS Sonoma. Also weird that there is nothing like this once the preference file exists. Are you checking for presence of the file as the first action on startup?

Perhaps include a check empty data to indicate nothing is being dragged? ie.

Code: Select all

on dropNewElement droppedFilePath
   put dropThing(droppedFilePath) into arrFileInfos // "fileName", "filePath", "fileType" et "iconPath"
   if arrFileInfos is not an array and arrFileInfos is not empty then
      answerError "An error has occured." & cr & "    " & arrFileInfos & "        [#7300]"
      exit to top
   end if
   ... // process if no error
end dropNewElement

Zax
Posts: 472
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: AppLauncher - MacOS files launcher

Post by Zax » Fri Mar 08, 2024 2:17 pm

Bug finally found!

Obviously, it cames from my code and you were right: there is another part of the code that simulate a file drop.
On the very first launch, I populate the board with some basic elements:
/Applications/Preview.app
/Applications/iTunes.app
/Applications/Mail.app
/Applications/Utilities

It appears at least one of these files is not on your OS.

Anyhow, it's now fixed, and I'm very sorry to spend your time for a stupid mistake I've done.

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: AppLauncher - MacOS files launcher

Post by stam » Fri Mar 08, 2024 7:06 pm

Zax wrote:
Fri Mar 08, 2024 2:17 pm
On the very first launch, I populate the board with some basic elements:
/Applications/Preview.app
/Applications/iTunes.app
/Applications/Mail.app
/Applications/Utilities

It appears at least one of these files is not on your OS.
Actually all of those are - except iTunes. In modern MacOS's this has been replaced by Music.app. iTunes does not exist any more, except on legacy OS's...

Worth noting that none of these appear in the app for me - it's just a blank window. So that was probably the issue and I'd be wary about assuming apps are on the user's drive...

So this will likely bite anyone using a modern MacOS - it may not generate an error if you've fixed that, but it also doesn't seem to add any apps to start with. You probably need to check if app exists before adding it ;)

Zax
Posts: 472
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: AppLauncher - MacOS files launcher

Post by Zax » Sat Mar 16, 2024 10:34 am

Version 0.61 is available.
It fixes numerous bugs - thanks to Stam, including icons size.

In order to redraw icons at desired size (128 x 128 px) you will have to manually delete folder:
~Users/Library/Preferences/AppLauncher Icons

https://sw.ixoft.com/files/
stam wrote:
Thu Mar 07, 2024 6:28 pm
Ideally this would be a menubar item but really not sure if/how you can do this with LiveCode. There is a 'Mac Status Menu' library that I guess lets you do this, but the documentation puts Spartans to shame - to say it's laconic is a vast overstatement.
If I well understood this lib allows you to create - and manage - new articles to Apple menu, but you can't modify Apple articles.

Zax
Posts: 472
Joined: Mon May 28, 2007 10:12 am
Location: France
Contact:

Re: AppLauncher - MacOS files launcher

Post by Zax » Thu Mar 21, 2024 10:38 am

Vesrion 0.70 is available, with a brand new web page. :P

https://sw.ixoft.com


I'm still unable to disable Cmd-Q Apple menu shortcut.

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: AppLauncher - MacOS files launcher

Post by stam » Thu Mar 21, 2024 11:23 am

Well done Zax,
Thank you for providing this useful utility free and and thank you for addressing the previous comments.

The lock icon is larger and on both sides, the lock/unlock with right-click is much more intuitive and the choppiness when dragging the anchor around is completely gone. The icons are much improved at are 256x256 px.

That's a huge amount of work!
Good stuff :)
Stam

Post Reply

Return to “Made With LiveCode”