Noitidart / Profilist

ff-addon: Profile manager for Australis
https://addons.mozilla.org/en-US/firefox/addon/profilist/?src=github
34 stars 1 forks source link

Add badge to os icon and profilist icon per profile #18

Open Noitidart opened 10 years ago

Noitidart commented 10 years ago

Credits to evacchi for the beautiful idea: https://github.com/evacchi/firefox-custom-badge/issues/1

profilist badging mockup

Noitidart commented 10 years ago

WinXP

Last Updated June 22, 2014
Progress 83%

Noitidart commented 10 years ago

Win7

Last Updated Jan 30, 2015
Progress 100%
Noitidart commented 9 years ago

Notes on setting icon in Mac:

notes from irc: becuase of RedrawIcon: http://mxr.mozilla.org/mozilla-release/source/widget/cocoa/nsMacDockSupport.mm#156

mstange well, the code there doesn't make it easy 12:01 mstange if you just overwrite the dock icon with your own one, your replacement is going to be overwritten as soon as nsMacDockSupport::RedrawIcon() is called again 12:01 noida yea 12:02 noida and it does that on downloads or something 12:02 noida so i have to replace the icon that RedrawIcon uses 12:02 noida like nightly uses the nightly background 12:02 noida aurora uses aurora 12:02 noida so when RedrawIcon calls it will use my modified icon as bg 12:03 mstange how did you do that? 12:03 noida didnt yet just brainstorming 12:03 mstange ah ok 12:03 mstange but I don't see how you can get access to mAppIcon or mProgressBackground 12:04 noida oh shoot thx for that note, thx for brainstorming with me 12:04 mstange I suppose you could swizzle -[NSApplication setApplicationIconImage:] 12:04 noida hahaha 12:04 noida swizzle means hijak? 12:05 mstange yes, but this method is actually called swizzling 12:05 mstange see for example http://dxr.mozilla.org/mozilla-central/source/widget/cocoa/nsAppShell.mm#301

noida no problem thx man for the help. btw do you know what it means to " swizzle -[NSApplication setApplicationIconImage:]" 12:08 Yoric I mean, a ChromeWorker can't call into xpcom. 12:08 Yoric Sorry about that. 12:08 Yoric It's a funky Objective C function call 12:08 noida o ok thx! 12:08 noida haha 12:09 Yoric If I recall correctly, [NSApplication setApplicationIconImage:] calls method setApplicationIconImage of NSApplication, without arguments. 12:09 Yoric (well, it's called a message in objective C, instead of a method call, but it's the same thing)

Noitidart commented 9 years ago

For Linux check out:

edit: dec 9 14 For unity launcher in ubuntu:

Noitidart commented 9 years ago

Mac

Last Updated Mar 1, 2015
Progress 90%

Remaining

Noitidart commented 9 years ago

Linux

Last Updated Apr 17, 2015
Progress 67%

Check out Bugzilla :: Bug 595462 - patch v1, load window icons from everywhere/from all supported formats which uses GDK to change icons. From Bugzilla :: Bug 595462 - Support loading window icons from zips, thanks to @nmaier telling me about it here: GitHubGIST :: Noitidart / _ff-addon-snippet-ChangeWindowIcon.js - Comment 4

evacchi commented 8 years ago

Any way I can play with this? I see a 2.0 branch, but I don't know how to package properly :)

Noitidart commented 8 years ago

Hey @evacchi sorry about that I got hung up with some other stuff. Let me get you the mac version its on my VM somewhere. v2.0 doesnt have the mac part merged in yet but your question motivates me to do it.

Noitidart commented 8 years ago

@evacchi you can grab the xpi from: https://github.com/Noitidart/Profilist/tree/mac-iconing-alpha

the one named " Porfilist 2 alpha mac iconing.xpi". To make the icon, click on main menu, then hover over profilist stack, it expands, then mouse over the imaf of the "user" (black/transparent) to the left of the profile name. Then click it, then select image or images (multi sizes of same image) to use as badge. then its badged. you can now go the options page, and then click "create shortcut" and choose the profile name. however an issue i havent figure out yet is that when running in the badged version, firefox updates seem to fail.

evacchi commented 8 years ago

uhm, which version of FFox should I be using? The file picker is shown, but when I pick a picture (png, jpg) no icon is shown -- and the generated files seems to be 0 bytes

Noitidart commented 8 years ago

Oh crap I just tested it you're right. Ok let me see whats going on Ill update you.

Noitidart commented 8 years ago

Fixed it @evacchi thanks for that note. It was due to a chance in Firefox 37 where array buffers were neutered: https://github.com/Noitidart/Profilist/tree/mac-iconing-alpha same xpi

so after you badge the icon from the menu, then go to preferences, and create desktop shortcut, then launch the profile from there. if you change the badge multiple times i have an issue where the desktop alias icon is not updating visually, but if you do get get info on it, you will see the icon is updated. the issue i brought up here: http://apple.stackexchange.com/questions/174761/make-alias-take-icon-of-the-app-it-points-to?noredirect=1#comment205991_174761 To work around it you can rename the alias to something new i dont know why this fixes it.

So anyways, you don't have to force the icon to take, you can drag that icon to dock, or just launch it, keep in dock on restart etc etc, it will show the updated icon everywhere except the dang desktop. :)

Noitidart commented 8 years ago

If icons dont update, you have to open terminal and do killall Dock and killall Finder, Im trying to figure out whats going on here: http://stackoverflow.com/questions/32848607/icon-not-taking-on-desktop-but-taking-everywhere-else

Or you dont have to killall just right click and "Show in Finder" to update the dock item, and on desktop rename the alias to have like a space at the end, watch this vid for demo: https://www.youtube.com/watch?v=yZtmJVanmbw

Noitidart commented 8 years ago

@evacchi how did it work out for you?

Noitidart commented 8 years ago

@evacchi I created and released an addon that allows you to provide png(s) for base and png(s) for badge and it will create a ICNS for you check it out: https://addons.mozilla.org/en-US/firefox/addon/icon-container-generator/

evacchi commented 8 years ago

ha! that's neat. so if I got it right:

This approach does work, but I though you had found a way to avoid creating the launcher in the first place, by badging the firefox icon "on the fly"; this can be easily done with a text label (as I did with my small addon), but I'm not sure about an arbitrary icon. The point of my addon was to avoid creating the desktop alias :)

BTW, still props for the effort!

Noitidart commented 8 years ago

@evacchi :)

The on fly thing works but it has major quirks. You cannot right click on the icon and keep in dock. It will think it is the main profile. If you have it running, and shutdown your computer, and told it to restart with last open programs, it will open with main profile.

So I had to make the alias :(

But you can use this addon to set it on the fly: https://github.com/Noitidart/Firefox-on-OS-X-Icon

And correct, I didn't hook up the buttons in the toolbar to launch the profile yet in that version. Launching from that alias is the only way. :( I have a hidden one, so in the non-alpha, it launches that hidden one, so a desktop alias is not required, but in this alpha version this parts not setup.

Noitidart commented 8 years ago

@evacchi updated in a huge way, this is true beta version - https://addons.mozilla.org/en-US/firefox/addon/profilist/versions/beta

Its in beta until I can get a patch in on Firefox. As on Mac the update mechansim is broken on profiles launched from Profilist menu, or by desktop launchers created by Profilist.