[Question] Some questions about BSPWM tiling manager

questionAsker@lemmy.ml to Linux@lemmy.ml – 26 points –
  1. I have a rule for vscode: bspc rule -a Code follow=on desktop='^4'. If I manually move one vscode instance to another workspace, work in that and than drag'n'drop smth (or any other action initiating popup menu), dialog will appear on 4th workspace rather than on current one. How to fix that?
  2. How to transfer workspaces(applications on them) correctly in the easiest way when switching to external monitor and returning?
3

The behavior you are requesting of bspwm is counter-intuitive to this rule you specifically wrote. Nonetheless, if VS Code popup windows have a different instance name, you could have a script running in the background which checks instance name of any new window and execute the command bspc desktop -f last when a VS Code popup appears.
If the instance name is the same for VS Code main app and its popup windows, you may listen to the state of VS Code windows (using bspc subscribe; see the manpage) and execute the previous command on VS Code floating windows (because popups will be floating).
For example, apply this to all VS Code windows:

while bspc subscribe -c 1 node_focus node_state > /dev/null; do
    bspc query -N -n "focused.floating" | while read -r wid; do
    bspc desktop -n $wid -f last
done

For your second question, if I understand correctly you're trying to have a given workspace moving to your external monitor when available and returning to your primary monitor if no other monitor is connected. You can look at the archwiki to learn how to setup bspwm for multi monitors. Using the same if conditions as explained in this wiki you could also have for example a rule bspc rule -a Code follow=on desktop='^4' when only one monitor is connected, and bspc rule -a Code follow=on desktop='^7' when an external monitor is connected (and workspace 7 will be defined to be shown on your external monitor).

Sadly, popup window name is same as for vscode itself. I will have a look on that script, that's something to begin with. I use only one monitor at time, I don't use "extended mode". And what I really want - to transfer already opened applications to workspaces from different monitor: I have vscode opened on 4th workspace on laptop, after I plug in external monitor and setup xrandr for it, than I turn it off and want to continue working with vscode on 4th workspace on latop. Right now this is not possible from the box.

If you're using only one monitor, simply duplicate and scale your laptop screen instead of using the extended approach.
To give you a rough idea, this will look to something like this:
xrandr --output eDP1 --mode 1366x768 --scale 1x1 --output HDMI1 --same-as eDP1 --mode 1920x1080 --scale 0.711x0.711
Use xrandr to find the monitors names and resolution. The scale option is simply the ratio between your 2 resolutions.