Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebrand AppUserModelID - Ensure Pulsar is separated as it's own App Icon on Windows #315

Merged
merged 2 commits into from
Jan 7, 2023

Conversation

confused-Techie
Copy link
Member

By rebranding this value, it ensures that if a User were to run both Atom and Pulsar at the same time, that they will remain separate items within the Task Bar.

Without this change running both items simultaneous (or if a user has Atom/Pulsar pinned) the programs would overlap each other within the Task Bar.

But with it rebranding ensures they stay as separate applications.

Copy link
Member

@DeeDeeG DeeDeeG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation makes sense, and LGTM!

(Other than the hyphen.)

Co-authored-by: DeeDeeG <DeeDeeG@users.noreply.github.com>
@DeeDeeG
Copy link
Member

DeeDeeG commented Jan 7, 2023

I'm approving, LGTM. 👍

Optional info in this comment, just thought I'd post my findings about where the "Squirrel" in the ID seems to have come from.


Looking into what sort of "ID" if any is used by Squirrel (click to expand):

Using git grep, this is the only place in the entire core repo codebase where com.squirrel shows up. I'd think it'd be used in at least one more place if it was actually used for Squirrel or auto-updating???

And supposedly, Squirrel just uses the app name?

Squirrel.Windows simply uses application name as key

From: https://www.electron.build/configuration/nsis#guid-vs-application-name
See also: https://github.com/Squirrel/Squirrel.Windows/blob/1eb2c20f051ce717d6a2b24ef3e068e08b0ce660/docs/getting-started/2-packaging.md#packing

Anecdotally, I have a number of Atom update files around on my windows machine, in couple places under [MyUser]\AppData, and none of them mention com.github or anything other than atom or Atom.


This PR got me curious again, since I've always wondered about that com.squirrel.atom thing that shows up only here... if the Squirrel (auto-updater) handler takes an exclusively different code path just above this, why does the ID for the actual running app (not the updater) have "Squirrel" in it? (Only set if not handling startup with Squirrel?)

A fair guess would be "it just has to be a unique ID, the Squirrel part is not meaningful or even accurate, and it is just a bit of a red herring/not what it seems to be."

As it often does, trawling though the blame reveals context clues for this.

Trawling through the git blame, here are my notes (click to expand):

Looks like a mishap with meaningful indentation in CoffeeScript.

See: atom/atom@b483fc6

It appears there was an attempt to nest the app ID logic in the code handling the Squirrel code path. I think it shouldn't have been nested, given that it works when it's not nested, and because that makes more sense for the persistent running ID to have not much if anything to do with Squirrel.

Indeed, when decaffeinated, this code becomes not nested.

See: atom/atom@e4946a1#diff-7493904054a0d148d0518afb746d400c755837b07604c684e6fed26cee3ddd35R28-R39


I think the answer is: the ID having "Squirrel" in it was always just a coincidence, a bit of a misnomer, and the result of reading too much into / having a little too much faith in "nesting" whitespace, or an "attempt at meaningful whitespace gone wrong" mishap.

Hopefully that was an entertaining tangent.


Tangential thoughts on "release channels" and this bit of code

So given that info, I'm thinking this ID can be whatever we want it to be.

And given the code comments, to the extent we bring back the "release channels" idea, it looks like we should retain the different IDs per "release channel" so the channels get their own TaskBar icons on Windows. As of the moment, if we have only one release channel, it's kind of a moot point. Although it'd be nice if the version running from source was distinct from (had a separate TaskBar icon from) the packaged version. (I think it is -- I think the "from source" is "dev" channel, and the master builds are "stable".)

Copy link
Member

@DeeDeeG DeeDeeG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving.

Because I agree with the premise that this should help separate our app icon from Atom's on the Windows taskbar. And the ID happens to be the new one we're using everywhere dev.pulsar-edit.pulsar.

(P.S. Thanks for the fix!)

@confused-Techie
Copy link
Member Author

I gotta say @DeeDeeG I think this was one of the better reviews I've seen recently.

Answers a few questions I had myself, and is just an interesting deep dive into how it came about, so thanks for writing this up, seriously.

But yeah like you said, it's nice this will out of the box provide different icons for the packaged and source running apps, and if we did add release channels, it's not a burden to support the feature here until we do.

And otherwise I'd make the change to ensure this always happens, but considering we are not using squirrel nor do I think there's any push for us to do so, we could probably leave this as is then.

Thanks for the review, I'll go ahead and merge!

@confused-Techie confused-Techie merged commit 4265e95 into master Jan 7, 2023
@confused-Techie
Copy link
Member Author

@DeeDeeG I've discovered why this was here, and why it was com.squirrel.atom and previously com.squirrel.atom.atom

It's named this only to allow Squirrel AutoUpdates to still pin themselves to the TaskBar. It makes sense if you think about it, this string is how Windows identifies the application (which side note, with this PR now being merged this means everyone that uses Windows will have to repin their Icon. Especially considering the bug for windows task bar icons being broken this will very likely result in a few issues.)

But it seems Squirrel by default creates a shortcut icon with an Application User Model ID of com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE. So with that com.squirrel.atom.atom does kinda make total sense. Which since the shortcut icon has this Application ID, so did the pinned taskbar application need it as well. Which now that I again think about it, what is our shortcut icon created with? I'd assume it's created with the package ID from electron-builder which will be the same as what we have just set, so good thing you pointed out the hyphen huh?

But here if you want the docs read through this to see why it was the way it was.

@DeeDeeG
Copy link
Member

DeeDeeG commented Jan 9, 2023

Hmm, I thought there might be some risk it was really squirrel related. And I vaguely recalled seeing com. something in a Squirrel-specific folder at some point (a long time ago, I don't think I have those auto-update files/folders anymore), but couldn't remember if it was com.github or com.atom or...

It's hard to piece everything together with 100% completeness or confidence.

If you feel there is a reason to revert this, then I would understand. Otherwise, if this is a thing where some folks will be confused by it, and we just need to tell them to re-pin, I'll keep that in mind and be ready to advise folks to re-pin.

@confused-Techie
Copy link
Member Author

Hmm, I thought there might be some risk it was really squirrel related. And I vaguely recalled seeing com. something in a Squirrel-specific folder at some point (a long time ago, I don't think I have those auto-update files/folders anymore), but couldn't remember if it was com.github or com.atom or...

It's hard to piece everything together with 100% completeness or confidence.

If you feel there is a reason to revert this, then I would understand. Otherwise, if this is a thing where some folks will be confused by it, and we just need to tell them to re-pin, I'll keep that in mind and be ready to advise folks to re-pin.

Yeah honestly I feel like us getting away from the Atom pinned task icon, or concurrently running Atom instances in the task bar is worth it.

Where the only downside currently is that during an upgrade users need to repin.

Now when/if we eventually use Squirrel again we will have to modify this value again, but again the downside doesn't really concern me. Since the fix is so simple, and would likely only affect a few users

@Spiker985 Spiker985 deleted the rebrand-appUserModel branch February 24, 2023 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants