Tiling on multiple monitors (Desk Grid)

Hello! :wave:

Desk Grid works perfectly on a single monitor. On two, it looks like it calculates based on the geometry of the entire setup, not the current monitor. On a similar note, the F12 terminal opens too high up (partially off-screen) if the primary screen has a lower top than the big screen (in my setup, if I move eDP-1 down, set it to primary and press F12).

Is Desk Grid outdated and should I be using Cortile instead? I tried it but it says that the ‘tile’ command is not found :thinking:

24.02 Lstredd 6.1.77-2-MANJARO packages up-to-date

Hello,
You can try Cortile or Pygrid.
Mabox scripts (drawgrid, snapwin → renemed to superclick) are written for one monitor.

Hello @pseud0n ,
For the sake of simplicity I set same resolution on both monitors.
(maybe it’s not needed)
Installed ezquake because mabox terminal called by F12 uses
~/.config/mabox/.quake-term
After the first run of quake-term the content of the above file is
1600x434+1600+32
As my secondary monitor is on the left of my primary one and the origo is the leftmost
coordinate so pressing F12 the terminal appears on the right monitor. 32 is the y offset.
You can control the size and position of the ‘F12’ terminal by this .quake-term.

A quick move of the active window can be done to the next / other monitor
by inserting the following section into ~/.config/openbox/rc.xml

    <keybind key="W-C-Down">
     <action name="MoveResizeTo">
    <!-- move to next monitor -->
      <monitor>next</monitor>
     </action>
    </keybind>

Once you are on either of your monitors (either by clicking or moving a window there)
those 9 tiling shortcuts work locally like a charm.

1 Like

As we spoke about quake-terminal F12… it is easy to resize/ move it to desired position. Use Alt + Left Mouse drag to move, and Alt + RightMouseButton drag to resize. (Those methods of moving/resizing windows works on every other windows also).
Then to save new position as new default just hide/show terminal by hitting F12.

1 Like

I managed to connect my laptop to an old monitor so I can work on two monitors from time to time. Thus, it may be possible to add support for 2 monitors to superclick (formerly snapwin).

However, I can already see that this will not be a trivial task.

@pseud0n @zolw anyone using more than one monitor, could you please share the output from the command?

xrandr | grep \\bconnected
eDP-1 connected primary 1600x900+1600+0 (normal left inverted right x axis y axis) 344mm x 193mm
HDMI-1 connected 1600x900+0+0 (normal left inverted right x axis y axis) 640mm x 360mm

Or if I don’t care the extra repositioning step after having moved tiled windows between monitors:

eDP-1 connected primary 1920x1080+1600+0 (normal left inverted right x axis y axis) 344mm x 193mm
HDMI-1 connected 1600x900+0+0 (normal left inverted right x axis y axis) 640mm x 360mm
1 Like

My output:

$ xrandr | grep \\bconnected
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
HDMI-1 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 477mm x 268mm
1 Like
eDP-1 connected primary 1366x768+0+312 (normal left inverted right x axis y axis) 309mm x 174mm
HDMI-1 connected 1920x1080+1366+0 (normal left inverted right x axis y axis) 476mm x 268mm

1 Like

I found this SO answer in Perl.

Bash version:

eval $(xdotool getmouselocation --shell)
echo mouse $X $Y
while read -r line; do
    info=$(echo $line | awk '{print $3}')
    if [[ $info == primary ]]; then
        info=$(echo $line | awk '{print $4}')
    fi
    read width height x_offset y_offset <<< $(echo $info | awk -F[x+] '{print $1, $2, $3, $4}')
    if (( X >= x_offset && X <= width + x_offset && Y >= y_offset && Y <= height + y_offset )); then
        echo $width $height $x_offset $y_offset
        break
    fi
done < <(xrandr | grep connected)

watch -n 0.1 ./monitor.sh correctly shows the monitor size and offset for me based on mouse position.

The mouse will always be over the window when snapwin is used, right?

I’ll take a look tomorrow I think, see if I can integrate it into snapwin.

1 Like

I found the same post on stackoverflow :slight_smile:
Thanks for the Bash version, it will come in handy.
For now I have flu and fever and my brain is working very slowly, when I get better I will work on it. Hopefully in a few days.

Yes, exactly.
The script has separate functions for mouse and keyboard actions. The function for the mouse is called clicksnap.

1 Like

What is the next goal?
wmctrl -l
helps to identify the window (1st column is used) to move / resize. E.g.

xdotool windowmove 0x02c00003 1700 32
xdotool windowsize 0x02c00003 800 300
1 Like

Making progress but not sure how to deal with the taskbar(s).

$ xrandr | grep connected
eDP-1 connected primary 1366x768+1920+787 (normal left inverted right x axis y axis) 309mm x 174mm
HDMI-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 527mm x 296mm

Doesn’t show available area like wmctrl -d does, but that will show entire dimensions of setup.

I guess it’s not great to assume a single dock and subtract from a side.

Updated version of script is shipped with today mabox-tools package update.
Script name is superclick.
Use mb-reset to apply needed changes to openbox rc.xml

mb-reset -c obrcxml

Script seems to work fine only when your monitors are aligned to top. Like on screenshot:

1 Like