Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: layouts per display #4

Open
smolypawa opened this issue Sep 26, 2022 · 20 comments
Open

Feature Request: layouts per display #4

smolypawa opened this issue Sep 26, 2022 · 20 comments
Labels
enhancement New feature or request

Comments

@smolypawa
Copy link

It would be nice to see layout per display (monitor) feature. Great script btw!

@gerritdevriese gerritdevriese added the enhancement New feature or request label Sep 26, 2022
@Bstiler
Copy link

Bstiler commented Oct 13, 2022

Actually, I have a more helpful suggestion: a new property monitor for the zones.
The biggest challenge in my view would be finding a way to identify monitors uniquely. I don't know what APIs plasma provides for this. But if we could identify each individual hardware monitor, things would be interesting.

Just think about it, instead of memorizing a specific keybinding to move a window to another monitor and another one for tiling it, we could just use the tiling keybindings. This way, multi-monitor setups would work more seamlessly on linux.

For zones without the monitor property, the current behavior still applies. Just tile it on the current monitor.

@BadCo-NZ
Copy link

Came here looking for this, hopefully this gets implemented soon, otherwise the script looks good!

@jmta
Copy link

jmta commented Jan 1, 2023

I've got a single line fix for this if you are happy to just have a single layout per display and not swap between layouts.

Firstly, have however many layouts you have as monitors, with the first for the monitor identified as 0, second for 1, etc...
Then, add a line in the refreshClientArea function, "currentLayout = workspace.activeScreen". This means each time the monitor the window is currently on the layout swaps to the one related to that screen.

@ghost
Copy link

ghost commented Jan 19, 2023

I've got a single line fix for this if you are happy to just have a single layout per display and not swap between layouts.

Firstly, have however many layouts you have as monitors, with the first for the monitor identified as 0, second for 1, etc... Then, add a line in the refreshClientArea function, "currentLayout = workspace.activeScreen". This means each time the monitor the window is currently on the layout swaps to the one related to that screen.

I can assure that it functions properly on the following system.

                   ./sssso-                ---------------- 
                 `:osssssss+-              OS: EndeavourOS Linux x86_64 
               `:+sssssssssso/.            Host: Z370 AORUS Ultra Gaming 
             `-/ossssssssssssso/.          Kernel: 6.1.6-arch1-3 
           `-/+sssssssssssssssso+:`        Uptime: 23 mins 
         `-:/+sssssssssssssssssso+/.       Packages: 1142 (pacman) 
       `.://osssssssssssssssssssso++-      Shell: bash 5.1.16 
      .://+ssssssssssssssssssssssso++:     Resolution: 2560x1440, 1440x2560 
    .:///ossssssssssssssssssssssssso++:    DE: Plasma 5.26.5 
  `:////ssssssssssssssssssssssssssso+++.   WM: KWin 
`-////+ssssssssssssssssssssssssssso++++-   Theme: [Plasma], Breeze [GTK2/3] 
 `..-+oosssssssssssssssssssssssso+++++/`   Icons: [Plasma], breeze [GTK2/3] 
   ./++++++++++++++++++++++++++++++/:.     Terminal: konsole 
  `:::::::::::::::::::::::::------``       CPU: Intel i7-8700K (12) @ 4.700GHz 
                                           GPU: NVIDIA GeForce GTX 1070 Ti 
                                           Memory: 3261MiB / 32039MiB 

                                                                   
                                                                   

P.S.: Is it possible to add a donations link? : )

@Farmerbrown87
Copy link

I've got a single line fix for this if you are happy to just have a single layout per display and not swap between layouts.

Firstly, have however many layouts you have as monitors, with the first for the monitor identified as 0, second for 1, etc... Then, add a line in the refreshClientArea function, "currentLayout = workspace.activeScreen". This means each time the monitor the window is currently on the layout swaps to the one related to that screen.

I'm a bit new at this... Which file would you add that line too?

thanks in advance

@jmta
Copy link

jmta commented Jan 29, 2023

contents/ui/main.qml

I should really try and find a bit of time at some point to put together a PR for this.

@gerritdevriese - Any preference on an implementation for this, mine isn't ideal as you lose a bit of functionality with regards to changeable layouts.

I have thought of a few ideas, multiplying monitor id by configuration number for example. Or a configuration for each display. Are either, or an alternative more in keeping with your design philosophy?

@Farmerbrown87
Copy link

Thank you, I have found it.

I have added the line to the refreshClientArea function as below, and I have labelled by layouts as "0", "1" and "2".

    function refreshClientArea() {
        activeScreen = workspace.activeScreen
        clientArea = workspace.clientArea(KWin.FullScreenArea, workspace.activeScreen, workspace.currentDesktop)
        currentLayout = workspace.activeScreen
    }

Then I have disabled/applied/enabled/applied the script in KWin scripts. However, the only change is the Layout is labelled "0" on all monitors.

I'm not sure if I'm missing something which supports this option or whether I have entered something incorrectly at this stage.

@dkomljenovic2502
Copy link

Reboot your pc! That also confused me.
Or there is a test with running kwin something in the terminal (i dont remember the command, and i am not by my pc to check). But that was just executed til i ctrl+c it
Also i had issues with a freezing window which worked when i resized when my screem was 25-75% on the left, but 26-74% was no freezing

@jmta
Copy link

jmta commented Jan 29, 2023

Install via KDE Store or clone this repo and run the ./build script.

Running the build script was all I needed from memory

@Farmerbrown87
Copy link

Reboot your pc! That also confused me. Or there is a test with running kwin something in the terminal (i dont remember the command, and i am not by my pc to check). But that was just executed til i ctrl+c it Also i had issues with a freezing window which worked when i resized when my screem was 25-75% on the left, but 26-74% was no freezing

Rebooting worked! Thank you.

I have an issue with the way I have set up my third monitor, I'll enable debug mode later on and see if I can fix. I'm sure it's just a confusion with the monitor positioning or positive/neg y positioning.

@dkomljenovic2502
Copy link

If you can write how you will debug it and solve that would be nice!

@Farmerbrown87
Copy link

I located problem between the keyboard and chair.
The squishy part controlling the keyboard managed to enter several values in the json incorrectly.
I'd advise others to correctly caffeinate themselves whilst entering the layout values. Corrected json below.

[
    {
        "name": "0",
        "padding": 10,
        "zones": [
            {
                "name": "1",
                "x": 0,
                "y": 0,
                "height": 100,
                "width": 25
            },
            {
                "name": "2",
                "x": 25,
                "y": 0,
                "height": 100,
                "width": 50
            },
            {
                "name": "3",
                "x": 75,
                "y": 0,
                "height": 100,
                "width": 25
            }
        ]
    },
    {
        "name": "1",
        "padding": 10,
        "zones": [
            {
                "name": "1",
                "x": 0,
                "y": 0,
                "height": 30,
                "width": 100
            },
            {
                "name": "2",
                "x": 0,
                "y": 30,
                "height": 40,
                "width": 100
            },
            {
                "name": "3",
                "x": 0,
                "y": 70,
                "height": 30,
                "width": 100
            }
        ]
    },
    {
        "name": "2",
        "padding": 10,
        "zones": [
            {
                "name": "1",
                "x": 0,
                "y": 0,
                "height": 100,
                "width": 25
            },
            {
                "name": "2",
                "x": 25,
                "y": 0,
                "height": 100,
                "width": 50
            },
            {
                "name": "3",
                "x": 75,
                "y": 0,
                "height": 100,
                "width": 25
            }
        ]
    }
]

@ghost
Copy link

ghost commented Jan 30, 2023

I'm a bit new at this... Which file would you add that line too?

thanks in advance

Hi there! Sorry for the delayed response, I just received the notification. It seems that you were able to resolve the issue on your own. Although, when windows are snapped on the primary display they dont resize at all. It may be related to X11 idk.. I will try to create a bug report in the coming days.

trivoldus28 added a commit to trivoldus28/kzones that referenced this issue Jul 31, 2023
Layout is now tracked per screen/desktop/activity, instead of one single activity across everything. This should address feature request gerritdevriese#4

Adding support for screen was a bit tricky to tease out because of the difference between the "active screen" (where the mouse is pointing to) and the "active client" (where the window is on), but otherwise pretty straightforward. The only thing to note is that the default layout for all screen is now the first layout, which might be a bit inconvenient if the user is used to have a main layout that is not the first one in the list. Maybe this could be an config option.
@trivoldus28
Copy link
Contributor

Hi all I think I got layout per display/virtual desktop/activity to work with the pull req above ;). It's a hack, nothing fancy, and pretty rudimentary but works for my needs. I think it should be working correctly but maybe more testing is needed. If you want you can try the feature before it merged with my fork of the script (https://github.com/trivoldus28/kzones/tree/layout_per_screen2).

@ldsands
Copy link

ldsands commented Jan 12, 2024

Hi all I think I got layout per display/virtual desktop/activity to work with the pull req above ;). It's a hack, nothing fancy, and pretty rudimentary but works for my needs. I think it should be working correctly but maybe more testing is needed. If you want you can try the feature before it merged with my fork of the script (https://github.com/trivoldus28/kzones/tree/layout_per_screen2).

I just tried this out and it seems to work fine. Any chance that this could lead to a release?

@gerritdevriese
Copy link
Owner

@trivoldus28 Can you create a PR for this?

@sesu-tech
Copy link

+1, just adding my voice here. I'm maining KZones and it's the best replacement for FancyZones for me on Linux! :)

@ldsands
Copy link

ldsands commented Jan 31, 2024

This should probably be a new issue, but until the Trivoldus28's feature/hack is merged, I thought this may be a better place for it.

I've noticed that KZones (using trivoldus28's feature/hack) doesn't remember which layout I chose per monitor. To illustrate with an example, I have one monitor horizontal and one vertical (on its side). To accommodate this, I have two layouts. Each time I restart, both monitors default to the first layout specified in my .json file. I also use virtual desktops so that could be related.

@trivoldus28
Copy link
Contributor

Sorry people, just got time now to get to this, made a PR for review @gerritdevriese : #60

@ldsands Do you mean you want the selected layout to be remembered across reboots?

@ldsands
Copy link

ldsands commented Feb 20, 2024

Sorry people, just got time now to get to this, made a PR for review @gerritdevriese : #60

@ldsands Do you mean you want the selected layout to be remembered across reboots?

Yup, that would be ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

10 participants