Xfce Forum

Sub domains
 

You are not logged in.

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

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

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
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,007

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 #########################################################
    # set APP to real executable
     APP="/usr/bin/firefox"              
    # set ICON to icon file - only png supported
     ICON="/full/path/to/png/icon"      
    # wait time for application window to display - adjust to suit
     WAIT=1                          
    ###############################################################################
    
    ###############################################################################
    ### 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.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2018-09-04 12:45:07

boodo6
Member
Registered: 2018-09-04
Posts: 2

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

I use .desktop launchers for different Firefox profiles -- each one with a different icon.

The launcher files have the different icon set:

Exec=/opt/firefox/firefox -p home %u
Icon=/home/boodo/.icons/letter-h-128.png

These are nicely shown in the XFCE applications menu etc.

The problem is that the window buttons all default to the main Firefox icon.

Is there some smart solution for XFCE to use the right icon for the window -- maybe an extra command / wrapper in the Exec line of the launcher file?

(I imagine I can't use devilspie as they're all called "Firefox". Using a launcher to call an .sh script seems ugly to me, would be nice to take care of it all in the launcher. Anything more elegant than putting all those lines in the launcher?)

Last edited by boodo6 (2018-09-04 12:49:44)

Offline

#4 2018-09-04 14:18:39

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,007

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

You can start firefox and pass a new class name to it:

/opt/firefox/firefox --class FFhome -p home %u

...and then use devilspie to match on that new class name.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2018-09-04 15:07:06

boodo6
Member
Registered: 2018-09-04
Posts: 2

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

Works great, thank you!

Offline

#6 2022-06-27 08:54:56

xfce-amateur
Member
Registered: 2021-06-23
Posts: 11

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

A version of xseticon is now maintained by xeyownt, who also provides build instructions.

Devilspie is no longer maintained, but there is now a devilspie2.

Devilspie2 uses lua as its scripting language:

if (get_class_instance_name() == "Firefox") then
  os.execute("xseticon -id " .. get_window_xid() .. " /path/to/icon.png");
end

Last edited by xfce-amateur (2022-06-27 10:34:20)

Offline

Board footer

Powered by FluxBB