LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-24-2018, 09:37 PM   #1
Doug Hutcheson
Member
 
Registered: Jun 2009
Location: Queensland
Distribution: Fedora 30; HP Pavilion 8Gb and Acer Aspire 16Gb; both Intel Core-i7
Posts: 282

Rep: Reputation: 22
How to enable application icons in window title bar? Fedora 28 / Gnome 3


I am following a tutorial on PyQt5 programming and an exercise on application icons assumes they will appear a the left side of the title bar, but I do not see any application icons on any of my windows. Is there a way to toggle this behaviour?

The tutorial is here and the exercise is titled "An application icon".

Thanks in advance for any help. "8-)
 
Old 10-25-2018, 08:50 AM   #2
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Linux Mint
Posts: 1,715

Rep: Reputation: 400Reputation: 400Reputation: 400Reputation: 400Reputation: 400
I moved the icon file, web.png, to the same directory as the program code, and I execute the program code from that directory.
 
Old 10-25-2018, 06:02 PM   #3
Doug Hutcheson
Member
 
Registered: Jun 2009
Location: Queensland
Distribution: Fedora 30; HP Pavilion 8Gb and Acer Aspire 16Gb; both Intel Core-i7
Posts: 282

Original Poster
Rep: Reputation: 22
Quote:
Originally Posted by RockDoctor View Post
I moved the icon file, web.png, to the same directory as the program code
Hi RockDoctor and thanks for the reply.

I tried your idea, but for me the icon still does not appear in the window title bar. It does appear in the Task Bar at the top of the screen, so I know the code is correctly 'seeing' the icon on disk, but it just won't display in the window title bar. Curious behaviour and I would like to find out whether it can be corrected in Gnome 3. "8-)

Cheers,
Doug
 
Old 10-25-2018, 10:13 PM   #4
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware FreeBSD Win10 MX
Posts: 9,591

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
what is the search path for icons? I do not used GNOME, but I go this E running, and the desktop file I created wit path to the icon in the same dir as the app (popcortime) it still did not show up. So, I just put a copy of it in /usr/share/icons and it popped up in my menu and launcher bar I got set up.

so, maybe if you popped a icon/jpg into your icons dir for the system it might just work, or try coding it with absolute path
Code:
self.setWindowIcon(QIcon('/path/to/web.png'))
or research that function to see what it uses to look for default paths to find Icons, make sure your icon is a valid format.

Last edited by BW-userx; 10-25-2018 at 10:52 PM.
 
Old 10-26-2018, 02:25 AM   #5
Doug Hutcheson
Member
 
Registered: Jun 2009
Location: Queensland
Distribution: Fedora 30; HP Pavilion 8Gb and Acer Aspire 16Gb; both Intel Core-i7
Posts: 282

Original Poster
Rep: Reputation: 22
Thanks for replying, BW-userx.

Quote:
Originally Posted by BW-userx View Post
I do not used GNOME
I think that is the problem: 'no icon' seems to be the default window decoration style for Gnome 3 and I can't work out how to toggle it. The icon is valid and in the runtime directory; I can display it in the window but not in the title bar.

Most puzzling.
 
Old 10-26-2018, 09:54 AM   #6
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware FreeBSD Win10 MX
Posts: 9,591

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
I goggled that function name just like i posted it and got a few hits on it, you should do the same to see what others are saying about his issue you too are having with it.
 
Old 10-26-2018, 11:07 PM   #7
Doug Hutcheson
Member
 
Registered: Jun 2009
Location: Queensland
Distribution: Fedora 30; HP Pavilion 8Gb and Acer Aspire 16Gb; both Intel Core-i7
Posts: 282

Original Poster
Rep: Reputation: 22
Quote:
Originally Posted by BW-userx View Post
you should do the same to see what others are saying about his issue
Thanks for your reply, BW-userx

I think confusion is arising between "Window Icon" and "Application Icon". The code says this:
Code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

"""
ZetCode PyQt5 tutorial 

This example shows an icon
in the titlebar of the window.

Author: Jan Bodnar
Website: zetcode.com 
Last edited: August 2017
"""

import sys
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QIcon

class Example(QWidget):
    
    def __init__(self):
        super().__init__()
        
        self.initUI()
        
        
    def initUI(self):
        
        self.setGeometry(300, 300, 300, 220)
        self.setWindowTitle('Icon')
        self.setWindowIcon(QIcon('/usr/share/icons/gnome/256x256/emotes/face-glasses.png'))        
    
        self.show()
        
        
if __name__ == '__main__':
    
    app = QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())
The effect of the setWindowIcon method on my system is to set the application icon, but there is supposed (according to the tutorial) to be an icon at the left of the window's title bar as well.

In the text of this tutorial, Jan says
Quote:
Most window managers display the icon in the left corner of the titlebar and also on the taskbar.
SO, my question is not how to correct my code - which works and sets the application icon - but how to set Gnome 3 to display window icons.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to have the title bar of a X window at the bottom ? Linux.tar.gz Linux - Software 4 02-19-2011 06:25 AM
F8 compiz: window title bar covered by gnome-panel Kropotkin Fedora 2 11-13-2007 07:19 AM
Can I change title bar content in an application window? dhave Linux - Desktop 4 09-19-2007 02:27 PM
Please help. My window title bar has disappeared. robert_rowe Linux - Newbie 4 02-10-2007 02:19 PM
window without a title bar using xlib CarzyIvan Programming 1 02-11-2006 05:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration