Xfce Forum

Sub domains
 

You are not logged in.

#1 2017-08-14 21:39:33

m3n3chm0
Member
Registered: 2014-08-25
Posts: 2

Customize icon app on panel running apps and workspace ?

Dear all,

I want to customize nightly firefox icon like this. For now only could get menu-system-internet and plank OK. But for panel icon I didn't reach out how to..


PROBLEM:

h_1502746552_7898477_05facfac19.png

OK

s_1502746623_8148689_56975a4a8d.png

OK
s_1502746716_5582998_c6965e8bd8.png

Offline

#2 2017-08-15 02:12:35

ToZ
Moderator
From: Toronto, Canada
Registered: 2011-06-02
Posts: 3,749

Re: Customize icon app on panel running apps and workspace ?

There are a number of threads on this board regarding this issue. Let me sum up what I know here.

The Window buttons plugin (and xfwm4) use EWMH to select which icon to use. To see this icon, you could run "xprop" and click on the window in question. Look at the _NET_WM_ICON(CARDINAL) field.

If you want to change this, you need to use a tool like xseticon to change this icon. (make sure you install it - if you're distro doesn't offer it, you may need to build it from source).

I know of two ways to change this icon:

  1. Using Devilspie. Install the devilspie package and create a .ds file in ~/.devilspie (e.g. ~/.devilspie/firefox.ds) with the following content:

    ( if
     ( is ( window_class ) "Firefox" )
      ( begin
       ( spawn_async
       ( str "xseticon -id "
       ( window_xid ) " /path/to/new/icon.png" ) )
       ( println "match" )
      )
    )

    ...and:

    • ensure that the "window_class" is correct (xprop will show you the window class)

    • change "/path/to/new/icon.png" to the actual path to the new png icon that you want to use

    • Start up devilspie via "devilspie -a" and the icon should change.

    If this works, add "devilspie" to your autostart programs.
    .

  2. Using a wrapper script. Since on most systems, /usr/local/bin comes before /usr/bin in the path, you can drop a "firefox" wrapper script in /usr/local/bin that will start the app and change the icon. You could use a wrapper script like:

    #!/bin/bash
    
    ### EDIT THESE VALUES #########################################################
    APP="/usr/bin/firefox"                  # path to real executable
    ICON="/full/path/to/png/icon"   # icon file - only png supported
    WAIT=1                			         # wait time for application window to display - adjust to suit
    ###############################################################################
    
    ###############################################################################
    ### DON'T CHANGE ANYTHING BELOW
    ###############################################################################
    function change-panel-icon {
    
        sleep $WAIT
        activeWinLine=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)")
        activeWinId="${activeWinLine:40}"
    
        xseticon -id "$activeWinId" "$ICON"
    }
    
    $APP & change-panel-icon

    ...ensure:

    • that the APP variable points to the correct _real_ executable

    • change the ICON variable to point to the new png icon

    • make this file executable.

    When you next start firefox via your menuing system or from a command line, this wrapper script will execute, start the program and change the icon.

Hope this helps.


How To Ask For Help           Xfce FAQ                            Xfce Release Information
The Xfce Community          Xfce Tips and Tricks

Offline

Board footer

Powered by FluxBB