baskerville / bspwm

A tiling window manager based on binary space partitioning
BSD 2-Clause "Simplified" License
7.72k stars 414 forks source link

Can't seem to chain desktop with focus=off #1074

Closed ghost closed 4 years ago

ghost commented 4 years ago

If I set the following rule.

bspc rule -a firefox focus=off

Firefox won't steal focus. When I try to chain the rule so I can also set the workspace I want it to stay on focus=off no longer works.

bspc rule -a firefox desktop='^2' focus=off
mifrandir commented 4 years ago

I just checked, it does work for me.

Can you give some more details on your setup? What do you expect to happen? What does actually happen?

ghost commented 4 years ago

I expect firefox to load on desktop #2, which it does. I also expect it to not take focus when a application sends a url to it. Currently it still steals focus. If i remove the desktop setting and only have focus=off then it stops stealing focus.

#!/bin/sh

bspc rule -r "*"

nm-applet &
xmodmap ~/.Xmodmap
killall sxhkd; sxhkd &
killall dunst; dunst &
killall compton; compton &
killall xautolock; xautolock -time 60 -locker "/home/gregf/dev/active/i3lock-fancy-multimonitor/lock -e -p" -secure &
killall flameshot; flameshot &
killall parcellite; parcellite &
! pgrep mpd && mpd &
! pgrep emacs && emacs &
! pgrep firefox && firefox &

~/bin/polybar.sh &
~/bin/wallpaper &

bspc monitor DVI-D-0 -d "1 " "2 " "3 " "4 " "5 "
bspc monitor DVI-D-1 -d "6 " "7 " "8 ♪" "9 "
bspc monitor HDMI-A-0 -d "10 "

bspc config border_width         2
bspc config window_gap           8

bspc config automatic_scheme     spiral

bspc config split_ratio          0.52
bspc config borderless_monocle   true
bspc config gapless_monocle      true
bspc config focus_follows_pointer true
bspc config pointer_follows_monitor true
bspc config honor_size_hints true
bspc config merge_overlapping_monitors true
bspc config pointer_action1 move
bspc config pointer_action2 resize_side
bspc config pointer_action3 resize_corner
# Set the border colors.
bspc config focused_border_color "#00C1FF"
bspc config normal_border_color "#586e75"
bspc config presel_feedback_color "#b89b94"

#polybar hidden when fullscreen for vlc, youtube, mpv ...
#find out the name of your monitor with xrandr
xdo below -t $(xdo id -n root) $(xdo id -a polybar-left_DVI-D-0)
xdo below -t $(xdo id -n root) $(xdo id -a polybar-right_DVI-D-1)

bspc rule -a Gimp state=floating follow=on
bspc rule -a Chromium desktop='^9' private=on
bspc rule -a firefox focus=off desktop="^2"
bspc rule -a Vivaldi-stable desktop='^2' private=on
bspc rule -a Emacs desktop='^3' private=on
bspc rule -a Navigator desktop='^2' private=on
bspc rule -a mpv state=floating center=true
bspc rule -a spotify desktop='^8' private=on
bspc rule -a Steam desktop='^5' private=on state=floating
bspc rule -a Kunst state=floating private=on
bspc rule -a gcolor2 state=floating center=true
bspc rule -a lxappearance state=floating center=true
bspc rule -a libreoffice state=tiled
bspc rule -a '*:libreofficedev' state=tiled
bspc rule -a Galculator state=floating center=true
bspc rule -a Pavucontrol state=floating center=true
bspc rule -a net-sourceforge-jnlp-runtime-Boot state=floating
bspc rule -a java-lang-Thread state=floating
bspc rule -a sun-awt-X11-XFramePeer state=floating
bspc rule -a Sxiv state=floating center=true
bspc rule -a Emacs state=tiled
bspc rule -a Caja state=floating center=true
bspc rule -a Uplay state=floating center=true desktop='^5' private=on
bspc rule -a Lutris state=floating center=true desktop='^4' private=on
bspc rule -a Filezilla desktop='^7' private=on
bspc rule -a "Genymotion Player" desktop='^5' privatee=on
bspc rule -a player desktop='^5' private=on
SeerLite commented 4 years ago

Did you try bspc config ignore_emwh_focus true?

AFAIK focus=off is only for when the program is started, not for when it's already running and requests focus.

ghost commented 4 years ago

@SeerLite just tried it, still taking focus.

SeerLite commented 4 years ago

Ah, it must be something else then.

If i remove the desktop setting and only have focus=off then it stops stealing focus.

I hadn't read this before. I'm kind of confused now. Does it not steal focus at all when you remove the other desktop rule but receives an URL from elsewhere?

SeerLite commented 4 years ago

I just tested it out. focus=off has no effect for me (makes sense since it shouldn't be related at all) and ignore_ewmh_focus... does stop Firefox from stealing focus... Ah, I made a typo before, sorry!

It's actually bspc config ignore_ewmh_focus true. Try that instead.

ghost commented 4 years ago

@SeerLite Still having the same issue. If I have the desktop set it steals focus with ignore_ewmh_focus true set. If I don't set a desktop for firefox to launch on then it works as expected. It appears they cannot be combined from what I have seen.

SeerLite commented 4 years ago

That's strange. It works all fine for me. Can you give an example of an URL being sent to firefox from another program? I'm testing it on my side by doing a simple firefox <URL> in a terminal. Are you doing something different?

Could you try recording your screen/take some descriptive screenshots of the behavior you're seeing? Maybe that'd help visualize what's happening.

Also important: what bspwm and Firefox versions are you running?

ghost commented 4 years ago

@SeerLite give me a little bit and I'll get obs-studio installed and record what's going on.

ghost commented 4 years ago

Well it was working before when I didn't have desktop="^2", but now it appears it doesn't work at all no matter what I set. I cleared all my rules, tried setting both bspc -a Navigator ignore_ewmh_focus=true, I tried focus=false, I tried Firefox instead of Navigator. Nothing stops it from stealing focus.

https://www.youtube.com/watch?v=VA3yGYj5lxY

SeerLite commented 4 years ago

Ahh I saw the problem right away in the video heh. I knew it was gonna help!

Run the command exactly as written here: bspc config ignore_ewmh_focus true Don't append anything to a rule subcommand. Just copy this and run it in a shell.

You see, ignore_ewmh_focus is a config setting, not a rule. config and rule are two different subcommands. config lets you modify the behavior of bspwm, while rule lets you change some properties about newly created nodes/windows. There's more information in the man page (man bspwm) about both subcommands and the different settings you can change with config.

Hopefully that solves the problem!

ghost commented 4 years ago

Wow do I feel stupid right now! Thank you!