0

I want to open a pdf-viewer (okular) with different icons from the gnome-console.

Basically I want to differentiate between pdfs I am reading. Some would have the default okular icon, but I would like to have a different/special icon for the pdf generated by the LaTeX document I am editing.

Thinking about how to do this, I realized that I am not sure how gnome knows what icon to use when I execute /usr/bin/okular from the console. How is that bin related with an icon, no .desktop file involved right?

phcerdan
  • 730
  • 7
  • 16
  • When you mention icon, you're referring to the application icon in the top bar and/or the running-applications panel in the Overview, right? Not the file-browser icon for the files themselves? – FeRD Jul 18 '17 at 12:02
  • Yes, the first one, the icon that appears when alt-tab between applications. Not the file-browser. – phcerdan Jul 19 '17 at 02:49

1 Answers1

1

Applications set their icon at launch, to a compiled-in value. Most do it using the API of their graphics toolkit (Gtk provides various forms of the gtk_window_set_icon API call), but it has its roots in an X Windows window-manager property that's as old as dirt — which is why, for example, okular still has an application icon in Gnome Shell even though it's a KDE application.

You can see a grayscale representation of the icon(s) an application is exporting if you type xprop in a terminal, then click the application's window. (You need to have the correct utilities package installed, it's called xorg-x11-utils in Fedora.)

The application icon doesn't depend on Gnome or on the .desktop file under any circumstances.

(In fact, you could create your own $HOME/.local/share/applications/okular.desktop file that represented the application with a different icon, and launch it by clicking that icon, but it would be ignored in favor of the one that's compiled in to the application once it started. I have some custom launchers in my Favorites panel for different VNC sessions, using a different icon for each, but they all show up as TigerVNC with the standard icon when launched.)

AFAIK the only way to do what you want would be to compile your own separate version of okular with the icon changed to something else. That's just not the way application icons were meant to be used, sorry.

FeRD
  • 1,699
  • 15
  • 24
  • I should note, as a final additional wrinkle, that many applications set their icon to the _name_ of an installed icon, rather than setting it directly to a particular image, as that allows the icon to be themed. So, an application _can_ have a different icon depending on the selected theme. But there's still a 1:1 relationship between application and icon — a theme can change the icon for _all_ instances of the application, but not just some of them. – FeRD Jul 18 '17 at 13:00