Skip to content

Conversation

@AsocPro
Copy link

@AsocPro AsocPro commented Feb 26, 2025

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
Copy link

j1n6 commented Oct 6, 2025

@hrvach any thoughts on merging this implementation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants