Skip to content

Allow vertical switching. - #231

Open
AsocPro wants to merge 3 commits into
hrvach:mainfrom
AsocPro:main
Open

Allow vertical switching.#231
AsocPro wants to merge 3 commits into
hrvach:mainfrom
AsocPro:main

Conversation

@AsocPro

@AsocPro AsocPro commented Feb 26, 2025

Copy link
Copy Markdown

I want to enable vertical switching to be able to more easily support complex custom layouts. My current layout is three monitors side by side on one computer and then one on top in the middle that is on a separate computer I want to only be able to travel between computers at the top of the middle monitor and the bottom of the top monitor. This code allows for pretty trivial custom do_screen_switch functions. As an example the main part of mine is as follows:

if (state->active_output == OUTPUT_B) {
        if (output->screen_index == 1) {
            if (direction == RIGHT)
                switch_virtual_desktop(state, output, 2, direction);
        }
       else if (output->screen_index == 2) {
            if (direction == TOP)
                switch_to_another_pc(state, output, OUTPUT_A, direction);
            if (direction == RIGHT)
                switch_virtual_desktop(state, output, 3, direction);
            if (direction == LEFT)
                switch_virtual_desktop(state, output, 1, direction);
        }
       else if (output->screen_index == 3) {
            if (direction == LEFT)
                switch_virtual_desktop(state, output, 2, direction);
        }
            
    }
    else {
        if (direction == BOTTOM)
            switch_to_another_pc(state, output, OUTPUT_B, direction);

This is only really gonna work for my setup but I am also planning on writing a doc so that others with less standard layouts can also take advantage of this instead of pretending they are in a linear setup. I have not written this doc yet and if desired I can get it written and add it to this PR or I can do a future one to put it wherever would be best. I just wanted to get this PR up to make sure there wasn't anything that I'm doing here that is a good way to handle it and I don't need to change my approach before writing the doc.

I ran some basic tests with the stock do_screen_switch function and the changes seem to not have any side effects until the custom do_screen_switch logic is introduced.

@j1n6

j1n6 commented Oct 6, 2025

Copy link
Copy Markdown

@hrvach any thoughts on merging this implementation?

MaplestoryEnjoyer added a commit to MaplestoryEnjoyer/deskhop that referenced this pull request Jun 23, 2026
Re-implements the vertical-switching feature from AsocPro/deskhop PR hrvach#231 on
top of current main.

Primitives:
- structs.h: add TOP/BOTTOM to enum screen_pos_e.
- mouse.c: is_screen_switch_needed() now checks all four screen edges;
  switch_to_another_pc() places the cursor on the opposite edge for vertical
  (TOP/BOTTOM) jumps.

Custom layout (DESKHOP_LAYOUT_VERTICAL_3PLUS1, set in user_config.h):
- do_screen_switch() handles a bottom PC with 3 monitors (OUTPUT_B; middle =
  screen_index 1, left = 2, right = 3) and a single-monitor top PC (OUTPUT_A)
  mounted above the middle. The PCs cross only at the middle monitor top edge
  and the top PC bottom edge. Stock left/right switching is preserved under the
  #else branch.
- defaults.c: OUTPUT_B screen_count = 3; both outputs default to Windows.

Mapping the middle monitor to screen_index 1 keeps it on the absolute main
screen, so the vertical jump lands correctly on Windows, where non-primary
screens fall back to relative-mouse mode.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants