ArchLabs Linux

Bspwm - window/node stay focused after changing to another workspace

haven’t encountered it on any program other than discord. the problem doesn’t seem to occur when i switch workspaces using polybar (either clicking on the desired workspace or scrolling on the bar (bspwm-desknext/bspwm-deskprev). i didn’t have this problem on i3 before so i really doubt it’s related to discord.

my sxhd config is basically the default:

# focus or send to the given desktop
super + {_,shift + }{1-9,0}
	bspc {desktop -f,node -d} ^{1-9,10}

any help would be appreciated.

I think I understand what you’re saying.

Now please forgive me if I’m wrong here as I’m not a sxhkd user and the initial question was a touch vague.

The binding you show there is a compound (one for super+0-9 and one for super+shift+0-9) to view a given workspace or send/follow the focused window to the workspace.

{_,shift + }
# this either evaluates to _ aka nothing or the shift key
# however not both, a separate binding will be made for each sequence

In the latter case it’s supposed to stay focused. You want the non-shifted version I believe to just change workspaces??

using e.g. Super+1 changes to the first workspace, using Super+Shift+1 send that window to the first workspace

I don’t think I was clear enough in the first post sorry, you expect to get a notification when you receive a new message on discord if you are NOT on that workspace or focused on discord, right? well, in my case, Discord stays focused in the let’s say the fifth workspace, and when I change to the first, I don’t get a notification, because it’s still focused. :slightly_smiling_face: at first I thought it has something to do with dunst or my notifications in general, but it simply isn’t the case because I get notifications just fine (even on Discord when I use polybar)

Ahh I see, perhaps two calls to bspc?

Something like

bspc {desktop -f,node -d} ^{1-9,10} && bspc window -f # root? {root,_}? idk

Sorry at this point I’m out of my zone with this, might be able to find something on the wiki.

Edit: nope there’s barely anything ;(

From the manpage https://manned.org/bspc

   Desktop
       General Syntax
           desktop [DESKTOP_SEL] COMMANDS

           If DESKTOP_SEL is omitted, focused is assumed.

       COMMANDS
           -f, --focus [DESKTOP_SEL]
               Focus the selected or given desktop.

           -a, --activate [DESKTOP_SEL]
               Activate the selected or given desktop.

So maybe

bspc {desktop -fa,node -d} ....

nope, -fa gives the error desktop: Unknown command: '-fa'. :frowning:
is it possible to make it so when i switch to a different workspace/desktop it clicks somewhere and goes back to where it was again?
using xdotool mousemove 960 1080 click 1 ; bspc desktop -f ^$NUMBER works but the cursor stays on a really irrelevant place. (the middle point of the bottom of the screen) :smiley:
I also tried doing xdotool mousemove 960 1080 click 1 ; bspc desktop -f ^$NUMBER ; xdotool mousemove restore but no luck.

I think I found a “temporary” solution and it does what I exactly wanted. :thinking::thinking: the only downside is that the cursor blinks every time, it’s only a visual disturbance though. im still open to other suggestions

super + {1-9,0}
    eval "$(xdotool getmouselocation --shell)" &&\
    xdotool mousemove 960 1080 &&\
    bspc desktop -f '^{1-9,10}' &&\
    xdotool mousemove --screen $SCREEN $X $Y

Nice little hack :slight_smile:

I’ll do a bsp install tomorrow and see if I can’t find a way to do it with bspc, I’m sure there is a way.