this post was submitted on 26 Dec 2023
1 points (100.0% liked)

Linux

48313 readers
1367 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 
  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?
you are viewing a single comment's thread
view the rest of the comments
[–] wwwgem@lemmy.ml 1 points 11 months ago (1 children)

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).

[–] questionAsker@lemmy.ml 0 points 11 months ago (1 children)

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.

[–] wwwgem@lemmy.ml 1 points 11 months ago

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.