<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ruslan&#39;s Tech Blog</title>
    <link>https://blog.bekenev.net/tags/weechat-terminal.html</link>
    <description>Software development related stuff</description>
    <language>en-us</language>
    <lastBuildDate>Sun, 25 Mar 2018 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.bekenev.net/tags/weechat-terminal/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Custom icon for terminal application in gnome-shell</title>
      <link>https://blog.bekenev.net/2018/03/25/weechat-icon-gnome-shell.html</link>
      <pubDate>Sun, 25 Mar 2018 00:00:00 +0000</pubDate>
      <guid>https://blog.bekenev.net/2018/03/25/weechat-icon-gnome-shell.html</guid>
      <description>&lt;p&gt;Hey,&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-problem&#34;&gt;The problem&lt;/h2&gt;&#xA;&lt;p&gt;Recently I wanted to create separated &amp;ldquo;window&amp;rdquo; for my weechat&#xA;so I can easily alt-tab to it.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve wrote the .desktop file and place it to &lt;code&gt;~/.local/share/applications&lt;/code&gt; so&#xA;gnome-shell (I&amp;rsquo;m on ubuntu 17.10) will show me it.&lt;/p&gt;&#xA;&lt;p&gt;And it did, BUT when I start the weechat the icon turned to &amp;ldquo;terminal-like&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;Hm&amp;hellip;&lt;/p&gt;&#xA;&lt;h2 id=&#34;play-with-terminal-icon&#34;&gt;play with terminal icon&lt;/h2&gt;&#xA;&lt;p&gt;Ok, there is terminals like &lt;code&gt;xfce4-terminal&lt;/code&gt; that allows to set custom icon&#xA;when terminal is starting&amp;hellip; so let&amp;rsquo;s try&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;xfce4-terminal -I /the/icon/i/need -e /usr/bin/weechat&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;br/&gt;&#xA;&lt;p&gt;&amp;hellip;aaaand nothing!&lt;/p&gt;&#xA;&lt;p&gt;There are other temrinals allows us to set custom icon but non of them was working.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-reason&#34;&gt;The reason&lt;/h2&gt;&#xA;&lt;p&gt;It turned out the gnome-shell overrides everything it thinks is a terminal with the icon from theme currently used.&lt;/p&gt;&#xA;&lt;h2 id=&#34;solution&#34;&gt;Solution&lt;/h2&gt;&#xA;&lt;p&gt;Discarding some guesses I decided that gnome-shell determines that app belongs to &amp;ldquo;terminal family&amp;rdquo; based on WM_CLASS&#xA;window property (you can see them using &lt;code&gt;xprop&lt;/code&gt;). Thanks god (or gnome developers) the gnome-terminal has &lt;code&gt;--class&lt;/code&gt; option&#xA;that overrides the WM_CLASS property. After that my .desktop file just works.&lt;/p&gt;&#xA;&lt;p&gt;Here is an example:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[Desktop Entry]&#xA;Version=1.9.1&#xA;Name=Weechat&#xA;Comment=Weechat the IRC client&#xA;Exec=gnome-terminal --role=weechat --class=weechat -- /usr/bin/weechat&#xA;Icon=/usr/share/icons/hicolor/32x32/apps/weechat.png&#xA;Terminal=False&#xA;Type=Application&#xA;Categories=Chat;Development;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;See &lt;code&gt;Exec&lt;/code&gt; value with &lt;code&gt;--role&lt;/code&gt; and &lt;code&gt;--class&lt;/code&gt; options.&lt;/p&gt;&#xA;</description>
    </item>
  </channel>
</rss>
