Bspwm: BSPWM not recognizing Spotify

Created on 29 Sep 2015  路  13Comments  路  Source: baskerville/bspwm

I'm trying to make a rule for Spotify, but it's not working. When I run 'bspc query -T', Spotify appears to have no name. Here's the output of bspc query -T:

HDMI3 1920x1080+0+0 50,0,0,0 *
    1 5 50 0,0,0,0 T - *
        V a 0.500000
            a Google-chrome Google-chrome 0x2000001 5 875x920+990+105 L --------
            H m 0.500000
                a URxvt urxvt 0x1200009 5 484x292+713+389 R -------- *
                V m 0.500000
                    m URxvt urxvt 0xE00009 5 484x292+713+389 R --------
                    m URxvt urxvt 0x1000009 5 484x292+713+389 R --------
    2 5 50 0,0,0,0 T -
        V m 0.500000
            m XFontSel xfontsel 0x1C0002A 5 574x181+668+444 R f------- *
            m   0x1600001 5 1810x920+55+105 R --------
    3 5 50 0,0,0,0 T -
    4 5 50 0,0,0,0 T -
    5 5 50 0,0,0,0 T -

Spotify is the line below XFontSel. It doesn't have a name, so I can't make a rule pertaining to it.

Most helpful comment

@Froziph A workaround for spotify is to get the _NET_WM_PID via xprop and then to grep the command name. An example for external_rules_command:

#!/bin/sh

id="${1?}" \
instance="$3" \
class="$2";

case "$class" in
    (foo)
        bar;;
    ("")
        unset -v _NET_WM_PID;
        . /dev/fd/0 2>/dev/null <<IN
        : \"\${$(
            xprop \
                -id "$id" \
                -notype \
                -f _NET_WM_PID 32c '=$0' \
                _NET_WM_PID;
        )}\";
IN
        case "$(ps -p "${_NET_WM_PID:?}" -o comm= 2>/dev/null)" in
            (spotify)
                echo desktop=^5;;
        esac;;
esac;

All 13 comments

I was able to make a rule that works with Spotify by using bspc rule -a "" fullscreen=on. Spotify's name is an empty string. Is this a BSPWM or Spotify issue?

I think this is a BSPWM issue and not a Spotify issue because Spotify's name is recognized by xprop.

What's the output of _xprop_?

_NET_WM_ICON(CARDINAL) = 
WM_CLASS(STRING) = "spotify", "Spotify"
WM_NAME(STRING) = "Spotify"
_NET_WM_NAME(UTF8_STRING) = "Spotify"
XdndProxy(WINDOW): window id # 0x1400002
_NET_WM_DESKTOP(CARDINAL) = 4
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        program specified location: 0, 0
        window gravity: Static
_NET_WM_PID(CARDINAL) = 5221
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLIENT_MACHINE(STRING) = "Server"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, _NET_WM_PING

What's the output of xlsw?

0x0400001  ui-  NA           NA
0x0C00001  -io  Xautolock/xautolock  xautolock
0x0800003  u--  NA           xcompmgr
0x0E00001  u--  Google-chrome/google-chrome  google-chrome
0x0E00003  u--  Google-chrome/google-chrome  google-chrome
0x0E0001F  u--  Google-chrome/google-chrome  google-chrome
0x0E00022  u--  Google-chrome/google-chrome  google-chrome
0x1400001  u--  NA           NA
0x1600009  u--  URxvt/urxvt  brett@Server:~
0x1000075  u--  Google-chrome  Some glyphs don't work, some are tiny... don't know what to do. 路 Issue #889 路 powerline/powerline - Google Chrome
0x2000001  u--  Spotify/spotify  Green Day - 21 Guns
0x100007B  u--  Google-chrome  How can I bind something to moving the scroll wheel left/right? 路 Issue #61 路 baskerville/sxhkd - Google Chrome
0x1000001  ---  Google-chrome  baskerville/xlsw - Google Chrome
0x1800009  ---  URxvt/urxvt  brett@Server:~/Downloads/xlsw-master
0x1200004  u--  NA           NA
0x0E00030  u-o  NA           NA
0x1000046  ui-  NA           Chromium clipboard
0x0E0021E  u--  Google-chrome/google-chrome  google-chrome
0x1000078  u-o  NA           NA
0x100007C  u-o  NA           NA
0x1E00001  u--  Spotify/spotify  spotify
0x2A00001  u--  NA           NA
0x1000057  u-o  NA           NA
0x0400000  ui-  NA           bspwm

_Spotify_ sets its WM_CLASS too late. This property should exist when the map request is received.

I get that Spotify should be the ones to fix this. But it worked before i updated bspwm (just did that today, haven't had time to create new configs before now). When it worked before, shouldn't it be fixable from bspwm's site? Any way to have a rule saying Spotify should spawn on a specific desktop? Some workaround?

@Froziph A workaround for spotify is to get the _NET_WM_PID via xprop and then to grep the command name. An example for external_rules_command:

#!/bin/sh

id="${1?}" \
instance="$3" \
class="$2";

case "$class" in
    (foo)
        bar;;
    ("")
        unset -v _NET_WM_PID;
        . /dev/fd/0 2>/dev/null <<IN
        : \"\${$(
            xprop \
                -id "$id" \
                -notype \
                -f _NET_WM_PID 32c '=$0' \
                _NET_WM_PID;
        )}\";
IN
        case "$(ps -p "${_NET_WM_PID:?}" -o comm= 2>/dev/null)" in
            (spotify)
                echo desktop=^5;;
        esac;;
esac;

@D630 I'm facing the same problem, can you explain how to use your solution?

Thanks a ton @D630

For posterity, this seems to be less spotify specific and more about electron apps in general? I have the same problem with slack from aur. Either way, @d630 's solution is a big help. :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rien333 picture rien333  路  5Comments

btlvr picture btlvr  路  5Comments

Th3Whit3Wolf picture Th3Whit3Wolf  路  4Comments

Fnux picture Fnux  路  4Comments

lukasino1214 picture lukasino1214  路  4Comments