Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4980
Joined: 2015-12-09, 15:45
Contact:

Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Unread post by moonbat » 2020-06-25, 10:42

For both my extensions, Pure URL and PMPlayer - the icon for the tools menu entry and the context menu (for PMPlayer) work fine on my barebones development profile, but not in my regular daily profile. I've seen this with Basilisk and Borealis as well. Even if I switch to the default theme it persists, and I don't see this problem with other extensions whose menu icons display fine. I'm using CSS to set the icon, and it works fine in a fresh/empty profile. The active attribute is set at startup.

Overlay code -

Code: Select all

	<menupopup id="menu_ToolsPopup">
		<menuitem id="menu-pureurl4pm-options" class="menu-iconic"
			label="&pureurl_toolsmenu_caption;" accesskey="&pureurl_accelerator;"
			insertafter="appmenu_addons" command="CmdPureURL4PMOptions" />
	</menupopup>
CSS entry for menu -

Code: Select all

#menu-pureurl4pm-options[active="false"] {
		list-style-image:url('chrome://pureurl4pm/skin/icon-red.png');
}
#menu-pureurl4pm-options[active="true"] {
		list-style-image:url('chrome://pureurl4pm/skin/icon-green.png');
}
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35602
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Unread post by Moonchild » 2020-06-25, 10:47

In your definition you neither set the active attribute to false nor true so it will be undefined and not hit either css rule to display the icon.
Menus are cached (for obvious reasons) in GUI rendering. If something else causes the menu to be altered before your extension init sets it, it'll be cached in its initial state (in your case undefined, meaning without an icon).
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4980
Joined: 2015-12-09, 15:45
Contact:

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Unread post by moonbat » 2020-06-25, 11:06

Moonchild wrote:
2020-06-25, 10:47
Menus are cached (for obvious reasons) in GUI rendering. If something else causes the menu to be altered before your extension init sets it, it'll be cached in its initial state (in your case undefined, meaning without an icon).
But the menu loads and shows the icon fine on a fresh profile, just not on my everyday profile. I do the menu init at the very end of my extension init.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4980
Joined: 2015-12-09, 15:45
Contact:

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Unread post by moonbat » 2020-06-26, 06:41

Turns out my icons don't play well with themes. If I revert to the default theme as I have on my development profile, then they show up. Other extension icons continue to work. What am I doing wrong?
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35602
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Unread post by Moonchild » 2020-06-26, 08:58

Well, maybe I was wrong then -- unfortunately I'm not the theming guru here so I'll hand this one over to Lootyhoof to answer. ;)
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
opus_27
Apollo supporter
Apollo supporter
Posts: 36
Joined: 2020-06-16, 13:29

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Unread post by opus_27 » 2020-06-26, 12:10

I'd suggest you try removing [active="false"] from the first CSS rule, leaving the second as is:

#menu-pureurl4pm-options {
list-style-image:url('chrome://pureurl4pm/skin/icon-red.png');
}
#menu-pureurl4pm-options[active="true"] {
list-style-image:url('chrome://pureurl4pm/skin/icon-green.png');
}

User avatar
Lootyhoof
Themeist
Themeist
Posts: 1569
Joined: 2012-02-09, 23:35
Location: United Kingdom

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Unread post by Lootyhoof » 2020-06-26, 13:16

I'd agree with @opus_27. By default show the red inactive icon, and if it does become active at any point change to the active icon.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4980
Joined: 2015-12-09, 15:45
Contact:

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Unread post by moonbat » 2020-06-26, 13:30

Ok but why does it only not work when I change the theme from the default? If I don't use any themes then the icons display correctly.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
Lootyhoof
Themeist
Themeist
Posts: 1569
Joined: 2012-02-09, 23:35
Location: United Kingdom

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Unread post by Lootyhoof » 2020-06-26, 13:33

Does it happen with any theme, or only specific ones?

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4980
Joined: 2015-12-09, 15:45
Contact:

Re: Menu icon for extension doesn't display in my daily use profile, only in a fresh one

Unread post by moonbat » 2020-06-26, 13:35

I guess it isn't theme specific. Tested with Moonscape, Australium and XMoon.
I use Moonscape on my usual profile, and just now added Australium to my development profile which doesn't have any extensions to test - and the icons have disappeared after a restart.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

Locked