Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 911542 - net-p2p/qbittorrent-4.5.4: Doesn't recognize hicolor as default theme
Summary: net-p2p/qbittorrent-4.5.4: Doesn't recognize hicolor as default theme
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Eli Schwartz
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-01 00:18 UTC by konsolebox
Modified: 2024-11-04 16:53 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch that adds hicolor as fallback (hicolor.patch,558 bytes, patch)
2023-08-01 00:20 UTC, konsolebox
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description konsolebox 2023-08-01 00:18:59 UTC
It should be patched manually.

This probably happens to other Qt applications as well.

No I don't agree that qtgui or qtbase itself should be patched to have /usr/share/icons/hicolor as an added fallback by default.  Not unless a use flag is added.

Reproducible: Always

Steps to Reproduce:
1. Install qbittorrent-4.5.4.
2. Set current them to anything but hicolor.
3. Run qbittorrent.
Actual Results:  
System tray icon doesn't show when current theme is not hicolor.



https://doc.qt.io/qt-6/qicon.html#fromTheme

Need to test if https://github.com/qbittorrent/qBittorrent/commit/77aa85fbd3af12b319f8f0b8372f4ba186d10c80 has fixed this or if use of patch can be avoided with it.
Comment 1 konsolebox 2023-08-01 00:20:04 UTC
Created attachment 866758 [details, diff]
Patch that adds hicolor as fallback
Comment 2 konsolebox 2023-08-01 00:26:45 UTC
For the less adept, desktop.eclass uses hicolor as the default install theme:

# @FUNCTION: _iconins
# @INTERNAL
# @DESCRIPTION:
# function for use in doicon and newicon
_iconins() {
	(
	# wrap the env here so that the 'insinto' call
	# doesn't corrupt the env of the caller
	insopts -m 0644
	local funcname=$1; shift
	local size dir
	local context=apps
	local theme=hicolor

	while [[ $# -gt 0 ]] ; do
		case $1 in
		-s|--size)
			if [[ ${2%%x*}x${2%%x*} == "$2" ]] ; then
				size=${2%%x*}
			else
				size=${2}
			fi
			case ${size} in
			16|22|24|32|36|48|64|72|96|128|192|256|512|1024)
				size=${size}x${size};;
			symbolic|scalable)
				;;
			*)
				eerror "${size} is an unsupported icon size!"
				exit 1;;
			esac
			shift 2;;
		-t|--theme)
			theme=${2}
			shift 2;;
		-c|--context)
			context=${2}
			shift 2;;
		*)
			if [[ -z ${size} ]] ; then
				insinto /usr/share/pixmaps
			else
				insinto /usr/share/icons/${theme}/${size}/${context}
			fi

			if [[ ${funcname} == doicon ]] ; then
				if [[ -f $1 ]] ; then
					doins "${1}"
				elif [[ -d $1 ]] ; then
					shopt -s nullglob
					doins "${1}"/*.{png,svg}
					shopt -u nullglob
				else
					eerror "${1} is not a valid file/directory!"
					exit 1
				fi
			else
				break
			fi
			shift 1;;
		esac
	done
	if [[ ${funcname} == newicon ]] ; then
		newins "$@"
	fi
	) || die
}
Comment 3 Piotr Karbowski (RETIRED) gentoo-dev 2023-08-03 07:05:41 UTC
I am unsure about this patch, at the very least it would conflict with prefix installations.

You also linked upstream commit that might have fixed it. Let me know if it did, I much rather backport upstream commit until they release a new version with it.
Comment 4 konsolebox 2023-08-04 10:49:12 UTC
> it would conflict with prefix installations.

I'm a bit surprised why that matters for qbittorrent especially just for a system tray icon, but a line in the patch can be changed to this and then you can call eprefixify to the modified source file in the ebuild.

+    QIcon::setFallbackSearchPaths(QIcon::fallbackSearchPaths() << QString::fromUtf8("@GENTOO_PORTAGE_EPREFIX@/usr/share/icons/hicolor"));

> You also linked upstream commit that might have fixed it. Let me know if it did, I much rather backport upstream commit until they release a new version with it.

I'll check if it fixes it but I don't think it's worth backporting as it comes with a feature and many modifications.  I mainly shared it as a heads up; something that might be worth examining for an alternative solution, and something to look forward to in the next release.  But so far I think the solution I contributed already suffice and the additional mental effort to pick the right lines to backport isn't worth it.
Comment 5 konsolebox 2023-08-04 11:34:19 UTC
I reinstalled qbittorrent using `sudo EGIT_COMMIT=77aa85fbd3af12b319f8f0b8372f4ba186d10c80 FEATURES=-userpatches ebuild /usr/portage/net-p2p/qbittorrent/qbittorrent-9999.ebuild merge`.


And ran it from a temporary user shell instance.  The system tray icon is showing.  Version shows 4.6.0alpha1 in About dialog.
Comment 6 Piotr Karbowski (RETIRED) gentoo-dev 2023-08-04 12:50:45 UTC
I am unable to reproduce the problem. From what you wrote it would sounds that if there's no hicolor style set, there's no tray icon. I have style Fusion with icon theme Tango and the tray icon is shown in polybar just fine.
Comment 7 konsolebox 2023-08-04 13:38:20 UTC
> I am unable to reproduce the problem.

With 4.5.4?
Comment 8 Piotr Karbowski (RETIRED) gentoo-dev 2023-08-04 13:43:35 UTC
This is correct, net-p2p/qbittorrent-4.5.4
Comment 9 konsolebox 2023-08-04 15:22:46 UTC
For some reason running qbittorrent 4.5.4 without the patch displays the correct icon in the system tray, but only with the user I've been testing it with.  However, running qbittorrent from another user that has logged in from the Linux console, has all files in its $HOME deleted before startx, and doesn't share X or any form of session with another user, the system tray doesn't appear.  It's invisibile.  Must be a cache or retained runtime setting that allows it to continually show?
Comment 10 konsolebox 2023-08-04 15:25:20 UTC
*system tray icon
Comment 11 Piotr Karbowski (RETIRED) gentoo-dev 2023-08-04 15:37:11 UTC
That sounds as if any of your configuration changes triggers it in qbittorrent and by default the tray would be there.

Seems like old issue, check my comment from 2019 at https://github.com/qbittorrent/qBittorrent/issues/9518#issuecomment-455966320
Comment 12 konsolebox 2023-08-04 15:55:55 UTC
Ok this is what I discovered.  Unless I select an icon from the system's Appearance settings (I'm using XFCE), qbittorrent's icon won't appear in the system tray.  Tested with 77aa85fbd3af12b319f8f0b8372f4ba186d10c80.  Also tested with 4.5.4 unpatched but only with the not appearing part.  I haven't tried running it with an Icon setting selected.  The icon set selected doesn't seem to matter.  I tried both Adwaita and Breeze in different instances.  Selecting a theme/style isn't enough.  An icon set has to be selected.

However with 4.5.4 and my patch it doesn't matter.  The icon will always appear.
Comment 13 konsolebox 2023-08-04 15:57:27 UTC
I have to add that with every test I had to remove all of the temporary user's files before rerunning startx.  I don't deselect an Icon setting to test.  It's not even possible.
Comment 14 konsolebox 2023-08-04 16:06:21 UTC
> Seems like old issue, check my comment from 2019 at https://github.com/qbittorrent/qBittorrent/issues/9518#issuecomment-455966320

Sorry I didn't read thoroughly before examining the issue.  That looks similar to what I discovered.  It's quite an interesting case how it worked when an Icon set is simply selected; as if Qt automatically selects the icon set for Qbittorrent or maybe mix icons up.
Comment 15 konsolebox 2023-08-04 16:34:49 UTC
Ok so apparently it "works" when an Icon theme is selected, simply because the icon theme inherits hicolor.

[Icon Theme]
Name=Adwaita
Comment=The Only One
Example=folder
Inherits=hicolor

This method is pretty weak in my opinion.  A system tray icon that's independent of a theme icon should not have the theme as a dependency.  Hicolor should be programmatically enforced as the default theme icon instead since that's the repository used by all applications, either system-wide or per-package.
Comment 16 Piotr Karbowski (RETIRED) gentoo-dev 2023-08-04 16:43:06 UTC
I think you have a good cause to bring up upstream and link the related bugs since you already did all the discovery and debugging
Comment 17 konsolebox 2023-08-04 17:20:57 UTC
> I think you have a good cause to bring up upstream and link the related bugs since you already did all the discovery and debugging

I'll think about it.  I spent enough effort already for such a simple fix.  How about the patch, will it be ignored, or will you just wait for a patch to be approved and then have it backported?
Comment 18 Piotr Karbowski (RETIRED) gentoo-dev 2023-08-04 19:13:16 UTC
The patch while simple does hard code the EPREFIX and requires string replacement to support it properly, I'd like to see what upstream has to say about it before going forward with this patch, so far you are the only other affected user I know off and you already uses local patches, then depending on what upstream says about it it can be solved in one way or another.
Comment 19 konsolebox 2023-08-16 10:16:44 UTC
I created an issue: https://github.com/qbittorrent/qBittorrent/issues/19476