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

Pixellated icon in KDE Large Icons task switcher #302

Closed
Richard-Payne opened this issue Dec 13, 2020 · 12 comments
Closed

Pixellated icon in KDE Large Icons task switcher #302

Richard-Payne opened this issue Dec 13, 2020 · 12 comments

Comments

@Richard-Payne
Copy link

Describe the bug
The large icons task switcher in KDE is displaying an upscaled icon for opensnitch.
image

To Reproduce
Run Manjaro. Select the Large Icons task switcher
image
Press alt-tab

Expected behavior (optional)
A non-pixelated 512x512 icon to be displayed.

OS (please complete the following information):

Additional context
I thought this might be an easy one to fix, and I could just submit a PR for you, but my Python skills are lacking.

I have tried switching the setup.py script to placing the opensnitch-ui.png file in 512x512 hicolor directory, instead of 48x48. That didn't help.

I read that KWin reads icons from the Window, not the desktop file. Interestingly, xprop reveals the issue:
image

Compare to Firefox:
image
image
image
image

The Firefox window has multiple icon resources attached. OpenSnitch only has the 48x48 icon.
However, I'm not sure why this is the case. From what I can see, the window setup code is loading the window icon from ui/opensnitch/res/icon-white.svg. Lacking any knowledge of how Qt handles svg sizing for icons, I tried switching it out for the png version which is sized at 512x512 already. That made no difference. I also tried editing the svg file manually to set the size. This didn't help.

@gustavo-iniguez-goya
Copy link
Collaborator

Hi Richard! thank you for reporting this.

I'll try to reroduce it and find a way of solving it.

@gustavo-iniguez-goya
Copy link
Collaborator

Ok, solved with this snippet under stats.py, init:222:

app_icon = QtGui.QIcon("/usr/share/icons/hicolor/scalable/apps/opensnitch-ui.svg")
self.setWindowIcon(app_icon)

But maybe it's better to add it as resource of the dialog definition, instead of hardcoding it there. I'll test both options.

@Richard-Payne
Copy link
Author

Richard-Payne commented Dec 13, 2020

That doesn't fix it for me. Is there more than just that snippet?
Or maybe my build is no good. I'm doing:

make clean
make
sudo make install

The binary in /usr/bin seems to be updated. I am getting a warning during the build:

protoc -I. ui.proto --go_out=plugins=grpc:../daemon/ui/protocol/
2020/12/13 16:08:20 WARNING: Missing 'go_package' option in "ui.proto", please specify:
        option go_package = ".;protocol";
A future release of protoc-gen-go will require this be specified.
See https://developers.google.com/protocol-buffers/docs/reference/go-generated#package for more information.

Not sure if it's relevant.

@gustavo-iniguez-goya
Copy link
Collaborator

gustavo-iniguez-goya commented Dec 13, 2020

Is there more than just that snippet?

nope, only those 2 lines after https://github.com/evilsocket/opensnitch/blob/master/ui/opensnitch/dialogs/stats.py#L210 in /usr/lib/python3/opensnitch/dialogs/stats.py

tested with kde plasma 5.19.5 , framework 5.74.0

If you have it installed and running, edit /usr/lib/python3/opensnitch/dialogs/stats.py , close the GUI completely (not just the stats window) and relaunch it again.

By the way, don't you use the AUR package?

@Richard-Payne
Copy link
Author

I had the AUR package originally but I removed it because I planned to fix it myself and submit a PR, so I was build and installing the package from a repo clone using make.

I'm on plasma 5.20.4, framework 5.76.0.

I just installed the opensnitch-git package but there is no opensnitch dir in /usr/lib/python3.8.

@gustavo-iniguez-goya
Copy link
Collaborator

It would be good if you could identify where is located the installation of the GUI, maybe you have several installations at different locations. I don't know about the AUR package, but installing it manually should be under /usr/local/lib/python3 or python3.x (whatever /usr/bin/python3 points to). It could also be located under /usr/lib/pythonX.Y/

Once that solved, try again modifying the stats.py which is being used to show the window, either adding the lines above or :

app_icon = QtGui.QIcon(":/icon-white.png") 
self.setWindowIcon(app_icon)

which should load the default icon from the resources store of size 512px.

I'll test it on more systems.

@Richard-Payne
Copy link
Author

Aha, problem solved.

My sys.path reports: ['', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/richard/.local/lib/python3.8/site-packages', '/usr/lib/python3.8/site-packages']

There is: /usr/lib/python3.8/site-packages/opensnitch/ which it is taking in preference to the one /usr/lib/python3.8.

@gustavo-iniguez-goya
Copy link
Collaborator

Sorry, it should be:

app_icon = QtGui.QIcon(":/pics/icon-white.png") 
self.setWindowIcon(app_icon)

If that works (it should load the 512px icon), I can embed the .svg and use it as the window icon.

@Richard-Payne
Copy link
Author

Sorry, this response should have been posted 6 days ago but apparently I forgot to hit send!

Aha, problem solved.

My sys.path reports: ['', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/richard/.local/lib/python3.8/site-packages', '/usr/lib/python3.8/site-packages']

There is: /usr/lib/python3.8/site-packages/opensnitch/ which it is taking in preference to the one /usr/lib/python3.8.

@gustavo-iniguez-goya
Copy link
Collaborator

ok, good news then. But just for clarification, you have had to add this snippet, haven't you?

app_icon = QtGui.QIcon(":/icon-white.png") 
self.setWindowIcon(app_icon)

@Richard-Payne
Copy link
Author

Yes, I did. It's problem solved on both fronts. Your code snippet fixed the reported issue and the noticing the python sys.path issue allowed me to apply your fix without waiting for it to be included in a proper release.

Thanks

@gustavo-iniguez-goya
Copy link
Collaborator

ok, I'll add the change so others can benefit also from it. Thank you!

gustavo-iniguez-goya added a commit that referenced this issue Dec 21, 2020
gustavo-iniguez-goya added a commit to gustavo-iniguez-goya/opensnitch that referenced this issue Dec 22, 2020
gustavo-iniguez-goya added a commit to gustavo-iniguez-goya/opensnitch that referenced this issue Dec 22, 2020
gustavo-iniguez-goya added a commit to gustavo-iniguez-goya/opensnitch that referenced this issue Jan 1, 2021
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

No branches or pull requests

2 participants