erosman / support

Support Location for all my extensions
Mozilla Public License 2.0
175 stars 12 forks source link

Allow user to set B&W flat icon – or no icon – in contextual menu for Copy PlainText #167

Open antistress opened 4 years ago

antistress commented 4 years ago

Hi,

I really like Copy PlainText , thanks for that. Very efficient !

However, on my GNU/Linux GNOME system, icons are B&W flat. Therefore I've changed the copy icon aimed at Firefox contextual menu for this one https://commons.wikimedia.org/wiki/File:High-contrast-edit-copy.svg from GNOME, which is under the GNU Lesser General Public License. I've used GIMP to create all needed resolutions from the SVG, and thanks to "Export for Web" GIMP extension I could generate PNG-8 using B&W palette. Then I used optipng -o7 *.png for a last optimisation. Total 3.5Ko. That's a very basic work. If you're interested, you can get it here. http://libre-ouvert.toile-libre.org/data/Ic%C3%B4nes%20pour%20l'extension%20Copy%20PlainText%20pour%20Firefox.zip

Screenshot here https://pix.toile-libre.org/upload/img/1586098005.png

Thanks

erosman commented 4 years ago

Thank you for your kind comment.

Does the original icon show or not? or is it that you dont like the icon?

BTW, in case svg, there is no need for other sizes as svg works fine for all.

antistress commented 4 years ago

Hi, Yes the original icon shows normally, Copy PlainText works flawlessly thanks. It's just that its icon is too heterogeneous on my system. Here are the GNOME HIG : https://developer.gnome.org/hig/stable/ui-elements.html.en https://developer.gnome.org/hig/stable/icons-and-artwork.html.en When there are icons inside the app, their style is B&W flat. Thanks !

antistress commented 4 years ago

BTW, in case svg, there is no need for other sizes as svg works fine for all.

Thanks for the tip I tried to use the SVG icon instead of the PNG set, naming it icon.svg but it doesn't work. What name shall I give to the SVG icon ?

erosman commented 4 years ago

I tried to use the SVG icon instead of the PNG set, naming it icon.svg but it doesn't work. What name shall I give to the SVG icon ?

Are you editing the extension and re-packing it?

Then you need to save the icon as icon.svg and edit the manifest.json

  "icons": {
    "16": "image/icon.svg",
    "32": "image/icon.svg",
    "48": "image/icon.svg",
    "64": "image/icon.svg",
    "128": "image/icon.svg"
  },
antistress commented 4 years ago

Thanks :)

Also sometimes Firefox detects the change I made and complains about bad extension signature, therefore I'm note sure that my workaround is sustainable. Do you think It would be possible to add OS detection to the extension, so that it could use the good set of icons regarding the OS ?

Also note that having no icon at all in contextual menu in front of the menu entry would be OK on GNOME, if you don't want to add different set of icons in your package ;)

erosman commented 4 years ago

Do you think It would be possible to add OS detection to the extension, so that it could use the good set of icons regarding the OS ?

AFAIK, that is not possible since manifest.json doesn't have that feature. Furthermore, this is your personal preference. Others may not have the same preference.. There are many 3D icon sets for GNOME system and not everyone is in favour of 2D B&W icons.

antistress commented 4 years ago

Hi again :)

First let me say that your tip works (about using the svg directly), thank you! Alas it appears that Firefox detects the change and deactivate the extension after a restart.

Others may not have the same preference

Indeed, you're right !

Furthermore, this is your personal preference

Actually not only : Since a few years now GNOME HIG recommands to be uber cautious while using icons inside applications. See HIG: Using icons in your user interface. Either way colored icons use is limited to rare cases : "Apart from application icons, the full-color icon style can also be used in cases where icons are displayed at large sizes and are intended to be the focus of attention. File and folder icons in a file manager are a good example of this." See HIG: Icon uses. Please note that I don't want to be polemical : I'm very grateful for this extension.

Also, for the record, I wander if something like the getPlatformInfo method or runtime.PlatformOs could be used to detect the OS. But the OS is not sufficient since man may need to know which DE is used (GNOME or something else). Maybe the only way would be a setting to allow user to remove the icon. I would perfectly understand that you could feel that it's not worth the hassle anyway ;)

Cheers

antistress

erosman commented 4 years ago

Maybe the only way would be a setting to allow user to remove the icon.

That might be possible for context-menu (only). I will look into it.

antistress commented 4 years ago

That would be great :)

For the record it seems it could also match macOS HIG : "Minimize the use of icons. Use icons in menus only when they add significant value. A menu that includes too many icons may appear cluttered and be difficult to read." (HIG: Using Icons in Menus) See also the screenshot here https://developer.apple.com/design/human-interface-guidelines/macos/menus/contextual-menus/

Cheers

antistress

erosman commented 4 years ago

I have been looking into it and sadly, it is not possible to change it.

menus.update()

In addition, icons can only be changed on menu commands, not on the top-level context menu. The top-level icon matches the extension's primary icon as declared in the extension's manifest file. ... Custom icons can only be set for items appearing in submenus.

antistress commented 4 years ago

hi !

On my side, I've filled https://bugzilla.mozilla.org/show_bug.cgi?id=1628819

Thanks