Giter Club home page Giter Club logo

grid-tiling-kwin's Introduction

Kwin Grid-Tiling Script

Install

mkdir -p ~/.local/share/kwin/scripts/grid-tiling
cd ~/.local/share/kwin/scripts/grid-tiling
ln -s <path>/contents
ln -s <path>/metadata.json
  • <path> is the path to this repository.
  • in order to uninstall, delete the linked or copied files that you created during installation
  • to install script system wide, do the process for /usr/share instead of ~/.local/share
  • kpackagetool6 is at this moment of writing broken and unable to install declarative kwin scripts without a main.js

Functionality

  • automatically tile windows, up to any custom grid size per desktop and per screen
    • new windows are first attempted to be added to the desktop and screen that the application itself set
    • insufficient space will result in the script automatically trying other screens first before trying other desktops, ultimately resorting to not tiling the new window if none have any space.
  • grid size can be configured on a per screen basis using a comma separated list of integers in the configuration user interface
    • screen rows and columns defines the defaults per screen, example: rows=2,2 and colums=2,3 results screen 1: 2x2, screen 2: 2x3
    • rows and columns for screens that were not defined will default to the first element
    • desktop rows, columns and names define overrides based on matching the desktop name using regex
  • moving windows within a grid done by drag and drop and global shortcuts
  • restriction of minimum space a window can occupy on a desktop, as in the amount of windows this window can share a desktop with, matching based on regex
    • a size of 1 is the largest and fully takes up a desktop, size of 2 means that it takes up at least half of the virtual desktop and so forth...
  • settings for many variables: gap, border, tiling, etc... and global shortcuts for toggling them
  • supports native KWin signals
    • movement of windows between desktops, screens and activities
    • resizing of windows, provides additional global shortcuts
    • minimization of windows, provides additional global shortcut to toggle for all windows on a desktop
  • blacklist and whitelist windows from tiling by matching regex

Recommended Setup

Action Shortcut
Window to Next Desktop Meta+End
Window to Previous Desktop Meta+Home
Switch to Next Desktop Meta+Right
Switch to Previous Desktop Meta+Left
Toggle Overview Meta+Space
Move Window to Next Screen Meta+PgUp
Move Window to Previous Screen Meta+PgDown
Switch to Next Screen Meta+Up
Switch to Previous Screen Meta+Down
Grid Tiling: Move Left Meta+Ctrl+Left
Grid Tiling: Move Right Meta+Ctrl+Right
Grid Tiling: Move Up Meta+Ctrl+Up
Grid Tiling: Move Down Meta+Ctrl+Down
Switch to Window Left Meta+Alt+Left
Switch to Window Right Meta+Alt+Right
Switch to Window Above Meta+Alt+Up
Switch to Window Below Meta+Alt+Down
Grid Tiling: Increase Size Meta+=
Grid Tiling: Decrease Size Meta+-
Grid Tiling: Maximize Size Meta++
Grid Tiling: Minimize Size Meta+_
Grid Tiling: Tile/Float Meta+T
Grid Tiling: Toggle Gap Meta+G
Grid Tiling: Toggle Border Meta+B
Minimize Window Meta+N
Grid Tiling: Toggle Minimize Desktop Meta+M
Window Operations Menu Meta+`
Grid Tiling: Refresh Meta+R
Grid Tiling: Reset Meta+Ctrl+R
Close Window Meta+W
Grid Tiling: Close Desktop Meta+Q

Additional Info & Tips

  • screen edges can be configured to move windows between virtual desktops when dragged
  • focus policy can be configured to follow the cursor
  • this version of the script uses the latest KWin API methods. If you're using an older version of KWin, choose the appropriate branch
  • after installing a KWin script you can activate it in the system settings, here you'll also find the configuration button
  • when you adjust the settings in the menu, this script needs to be restarted before the settings are applied. You can do this by turning the script off, apply, turn it back on and apply again or a complete KWin restart (re-log/reboot)
  • after updates, some of the shortcuts may have been renamed, but KWin still keeps the old ones registered. To remove the no longer used shortcuts, first disable this script, then go to the shortcuts settings window and use the delete button on the KWin application that contains the shortcuts to this script. Restart KWin and then activate the script again and the old unused shortcuts should now all be gone
  • script assumes that the amount of desktops does not change. For the best result make sure you have more virtual desktops than you have windows normally. The script can handle more windows but once all desktops and screens are full, all new windows will start as floating instead of tiling until there is space again to tile new windows
  • name matching is performed using the javascript RegExp class which is build using the string that the user provides and then the test method is used on the window class (application) property (equivalent JS code RegExp(config).test(window.resourceName)). You can find the value for these properties on a window by opening the Windows Operations Menu (there is a global shortcut for this). For some examples check out the min space section of the configuration interface
  • if you never plan on using multiple screens you could also consider repurposing the KWin shortcuts for moving windows between screens to desktops instead. So you have more flexibility to move windows between the grid of desktops, while sacrificing the shortcuts that allow you to move them between screens
  • logging can be obtained from your system log, for example in wayland using journalctl _COMM=kwin_wayland

grid-tiling-kwin's People

Contributors

alex1701c avatar lingtjien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grid-tiling-kwin's Issues

Compatibility?

HI,

Apologies for a beginner question but I'm running linux mint 19.1 cinnamon. Will this app work on there? I'm assuming it's KDE only, but I can only hope! Looks incredible and exactly what i'm after

Thanks
Sunny

Issue resizing window

Not sure what is causing this but, I can't resize any window. If I try I get some tearing like in windows frozen program, but the size of the windows is the same. I have enforce window decorations on gtk+ window, grid tiling and MinimizeAll scripts activated. I thought perhaps Sticky Window Snapping was the cause but doesn't seem to be it because I have disabled it (restart system, and kwin separately)...

I also mention that the kwin global shortcuts for this script do not work either.

script stop working when one window is active on every desktop

Hi,

I think the script may stop working when I'm doing specifics steps.
What I did:

  • Setting shortcuts as recommended -> Everything works with good tiling
  • Setting chrome as with Grid-Tiling: float -> Everything works with good tiling
  • alt+F3 on chrome to open window settings
  • On the settings -> move to -> all desktops -> The script doesn't respond to any shorcuts

If I restart the script via Settings -> Window Management -> KWin Scripts, then it's working again.
I'm running the script on Ubuntu 18.04.1 LTS with KDE Plasma Version 5.12.7

I would need the option to keep one video on all desktops of one screen (got dual screen) so I can keep my chrome session at anytime across desktops.

Thanks for the work you have put into this scripts, this one is the more powerful I've tried.

EDIT: I don't understand, it seems to work sometimes or maybe it was only bugging with the settings window

New Features in Develop

I refactored most of the code and added more features

If you have any comments and or bugs related to this then please post them here

Features

  • User

    • custom grid sizes per screen
    • moving clients between desktops in all directions
    • improved UI
    • improved README
  • Me

    • rewrite the old method of rendering, switching and moving as these were highly interlinked (bad)
    • went from ~1400 lines of code to ~1000 and ~1250 sloc to ~850 sloc, less code yay
    • eslint
    • combine duplicate methods

Potential Bugs

  • I don't have an extra display at home to test the part of the code that handles the multiple screens, so there might be some bugs there...

Will close this Issue once I finish it and merge it into master

Multiple Screens Behavior

I've noticed a few bugs and strange behaviors when it comes to having multiple physical screens.

  1. The KWIN shortcut 'Window to Next/Previous Screen' doesn't behave nicely with the script. If you move a window to another screen with the shortcut it will snap back to it's original spot whenever another window is opened, or the screen is refreshed, or you attempt to move the window manually again with the mouse, etc. It also has tons of visual bugs that don't get fixed with a 'refresh'.
  2. The included shortcut 'Grid-Tiling: Move Next/Previous Desktop/Screen' will move the window in a way that it will stay put, however it doesn't work well when using multiple rows of desktops. It will skip a desktop sometimes when cycling the window through them. It will also skip screens sometimes when cycling through them, likely because my secondary monitor is set to be extended to the left. You can replicate this problem by making a 2x2 grid of desktops. And 'extend left' for your second monitor. Then try to cycle through them and it will behave erratically.

As it stands, working with multiple monitors is a serious pain. The quickest and easiest workaround I've found is to switch the window to 'float', move it to the other screen, then switch it back to 'tile'. Otherwise the script has been amazing. This is with the 'master' branch by the way.

Moving windows with default kwin shortcuts

If I use the kwin-actions Window One Desktop to the <direction> or Window to Desktop <number>, the moved window will keep its shape and jump back to its original desktop, if I create a new window.
Unfortunately, there is no Tiling-Gaps-action to move windows up and down, to only to move them to the next or previous desktop. Is it possible, to use the default kwin-actions together with your tiling-script?

Full Screen when only one app is running in desktop

Hello !

First, thank you very much for your script. I use it on a daily basis :)
Now, I would want to make an app "fullscreen" (no margin) when there is only one application on my virtual desktop. How could I achieve that ?

Thanks in advance

Placement of new window when screen is full

Hello,

Thank you very much for this awesome script!

Does it control where new windows are placed?

With multiple screens, if the focused screen is full of windows e.g. 6/6 and if there is still space on a second screen, a new window is created in a new workspace instead of creating it on a different screen in the same workspace. I find the latter to be preferable. Is this intended? Is this in the script's scope?

Plasma freezes on opening system settings

When I got windows open and arranged in a grid and open the system settings application, the UI freezes completley. Moving the mouse is still possible, but not activating any windows. There's no solution but to restart the X server.

This does not happen when no X applications are open.

Versions:
OS: Gentoo Linux
KDE Plasma Version: 5.17.0
KDE Frameworks Version: 5.63.0
Qt Version: 5.12.5

Start window in floating mode

Not really an issue, but I was wondering if there's a way to start an application in floating mode? Not to be confused with 'ignored clients' or 'ignored captions'.

It would be nice to be able to start a terminal in floating mode and add the tiling only if needed.

Btw, nice going with the project. This is amazing!

Moving windows to other desktops return client to original one if a new client is added.

Hey LinG; one thing I notice is that when you move a window to another virtual desktop if you open another client the windows you previously move returns to the original desktop; for example, client A original desktop is 1, so I move it to desktop 2, in desktop 2 I open a client B and then client A returns to desktop 1 and so on for any client for any desktop.. in other words an X client has to stay on the same desktop in order to maintan position if you want to open another cleint with that X client in particular.
if you open X client and leave it in the same Desktop tilling behavior works just fine.
You think that will be possible to attain tilling after mover X client to any other desktop if any other client is added?

How to move clients between cols/rows?

I can't seem to find in README or shortcuts, when I open a new application it is opening the window under another, what I'm finding myself having to do is close windows, swap two windows then launch. Not a big deal but it'd be nice not to have to restore state in application when I mess up

minimize

By minimizing the windows the grid is not updated and the space remains. Is there a way to fix it?

Clarify window rearranging algorithm

Hi,
I really like this project, but can you clarify the window rearranging algorithm? I use default settings in following examples. So initially I open 4 windows:

1  2
3  4

Script works as expected if I drag one of windows to the neighbouring vertical/horizontal cell (windows switch places with each other):

3 -> 4 | 3 -> 1
-------|-------
 1  2  |  3  2 
 4  3  |  1  4 

However window don't just switch places if I drag window into opposite corner:

1 -> 4 | 2 -> 3
-------|-------
 2  4  |  3  1 
 3  1  |  2  4 

And I expected that following would happen:

1 -> 4 | 2 -> 3
-------|-------
 4  2  |  1  3 
 3  1  |  2  4 

Another situation which seems not not quite convenient is when I open 3 windows:

1  2
3  2

I don't understand what do I need to do to put window 2 in the corner and make either window 1 or 3 take half screen? If I drag window 1 into lower right corner, then columns switch places and 1 and 3 also switch places vertically:

 pre | post
-----|-----
1  2 | 2  3
3  2 | 2  1

Same thing happens even if I minimize large window 2, try to drag window 1 into lower right corner, then restore window 2:

 pre  | minimized | post | restore 
------|-----------|------|--------
 1  2 |   1  _    | _  3 |  2  3
 3  2 |   3  _    | _  1 |  2  1

Issues on Manjaro

Hi! Looks like a very handy tool for multitaskers. Thanks for your work!

I have an issue whilst following your installation instructions on my Manjaro:
"The desktop entry of type Service is unknown."

I tried to replace the type=Service with type=Application, but it brought me to another issue:
"The desktop entry file file:///home/me/Grid-Tiling-Kwin/metadata.desktop is not valid."

Any thoughts on that?

Preview

Note: GitHub does not support viewing videos in the ReadMe, if you want to see an example just watch the tiling-gaps.mp4 in the preview folder

Someone could make a .gif for this and put it in the ReadMe :)

I don't know how to do it myself though.

Ignored clients list is ignored

Arch linux, newest KDE apps, tried to write some apps to ignored clients list in ~/.local/share/kwin/scripts/grid-tiling/contents/config/main.xml but nothing changed, even after few reboots and script enabling/disabling

When disconnecting monitor, my windows get dis-tiled

Setup is simple. I have windows tiled on my HDMI monitor. I disconnect HDMI monitor. After the screen settles, all my windows are not tiled anymore and they are overlayed one another. I think it's because of the difference in resolution between the primary monitor and the external one.

Asking to get re-tiled automatically is too much I think. But rather would a shortcut to re-tile them to arbitrary positions be possible? Is this already provided by kwin? I couldn't find any.

Does this happen to nobody else?

One thing I do to re-tile the windows is drag them just a bit and it works, but it's cumbersome and sometimes they're in inaccessible spots fully hidden behind another window and I'm starting to develop monitor disconnect anxiety.

Suggestion: Moving Focus

Before I start: love your work. Use it everyday!

Is it possible to surface shortcut commands for moving focus to the next/previous window? Previously, I had mapped move focus in i3, or in tmux/vim to a hotkey plus h,j,k,l (arrow keys work as well but they're not my preferred movement keys) and it would be dynamite if I could do the same in KDE.

I realize that you can Alt+Tab to choose the active window, but the movement keys feel more efficient.

Question: Setting one instance of a desktop to tile and another to float

Hey, I am wondering if it is possible to set up a desktop so that when windows are added they are floating, and then on another desktop have them so they tile.

Also, I think it would be great if you added a feature to toggle on/off tiling for all windows.

Awesome script

Many thanks,

Jordan

the README file needs correction

In the README.md, for the local installation part,
mkdir -p ~/.local/share/kservices5and
ln -s ../kwin/scripts/grid-tiling/metadata.desktop kwin-script-grid-tiling.desktop
there should be
cd ~/.local/share/kservices5 in between

Is there a list of kewyboard shortcuts?

Sorry, I am very new to tiling managers. I was wondering if there is a list of keyboard shortcuts and how to tweak settings anywhere? Really hoping to vamp up my workflow timing with this!

Thanks for this cool project!

David

Shortcuts that don't work

I have two machines with identical setup (I hope). On one of them, tiling works, the shortcuts do their job and everything's fine. On the other machine, most shortcuts do work, but some of them don't, like increasing or decreasing the size (but the window is flickering when I press them). What could be the reason for that? What does the script need to do its job?

Does not work with plasma 5.14.4 ?

I followed the installation procedure and can even see it being listed when run plasmapkg2 -t kwinscript -l, nevertheless after re-login to KDE it cannot be found in system global key bindings ...

Increase number of windows allowed on a desktop

Is there a way to increase the maximum number of windows allowed on a desktop to more than 4? Not visible windows, but total windows? If I have 4 windows open (even if theyre minimised) and I attempt to open another, it is placed on a new desktop. Can I allow more than 4 windows (including minimised ones) on a desktop at once?

UI freezes after grid maximum

I am using Ubuntu 19.04 with KDE Plasma and my UI freezes after opening an application when the grid is full. Mouse is still working, but everything else is frozen, causing me to reboot.

Steps to reproduce:

  1. Open Kwin Grid Tiling settings
  2. Set rows to 2
  3. Set columns to 2
  4. Relog
  5. Open 4 Konsole's
  6. Open a 5th one
  7. Freeze

Expected behaviour:
The 5th application either open as a floating window so the grid will stay the same or the grid expands and 5th application opens in the grid.

Workaround:
Increase the rows and columns to a size where I am sure I won't reach the maximum.

Move to Desktop (from action menu) does not work

Hi,

When you click window's action menu and move the window to a specific desktop, refresh action brings it back.

Grid tiling should grab the signal that the window has changed desktop and treat it appropriately.

On a general note:
It would be nice to add some comments into the source code, or elaborate more in order to help others to help you.

Thanks a lot for your efforts!

Configuration window dissapeared

image
So I was trying to configure my grid tilling settings to add some programs to ignore, and I noticed that the button to open the settings dissapeared, is there another way to open them?

Loss of focus when moving window to different desktop

When moving some applications (KSysGuard and Dolphin, among others) to a different desktop, the moved applications are no longer in focus, obligating me to shake the cursor a little in order to grab focus back.

This happens even if the cursor is over the moved application with the recommended "Focus Follows Mouse - Mouse Preference" focus policy. Trying to grab back focus through keyboard shortcuts does not work either.

Prioritize Columns over Rows?

I'm using the script with a 21:9 Ultrawide and love it. But is there a possibility to prioritize the creation of columns?

I set the grid to 2x3 and as an Ultrawide user its fine to work with the screen split in 3 columns. So my idea is to first create 3 cols and after that begin with splitting the rows.

Is there a option I have overlooked or a quick modification I can do?

Row/Column Setting Not Working

I'm trying to change the grid size to be 3 Columns by 2 Rows. But I cannot get the script to do anything but 2x2. I have 3 virtual desktops on a single 34inch UltraWide screen.

screenshot_20181117_193739

Firefox gets automatically ignored if only Tor is added to the ignored list

I added firefox to the clients to be ignored in order to test it. It worked as expected and firefox was no longer tiled or manageable through the script.
I then turned-off the script, applied, turned it back on, removed firefox from ignored clients and applied the change. However, firefox is still being ignored (even though not present in the list). I also logged out/in and shut down the computer before reactivating the script. Nothing worked and firefox is still being ignored.

EDIT: Ok after fiddling with it, it seems that the real issue comes when "Tor" is added to the ignored list. In that case, Tor Browser is ignored (as expected) but Firefox as well.

RFE: Create New Virtual Desktop

Shortcut Key to create New Virtual Desktop + One to Create New and Send Current Active Window to it would be nice as well.

RFE: Shortcut Key for Opening Next Windows Horizontal or Vertical

I played around with i3wm a bit and one thing that I found very useful was the ability to decide how the next window should open. So if you wanted the next window to open vertical you hit meta+o as an exmple and it would open the next application vertically. Then if you wanted to open horizontal you hit meta+e and the next app would open horizontal. This has some advantages in that you can decide how the next app should open depending what you are going to be doing.

Toggling full screen / tiling

Thanks for the amazing work! I really like the script.

At the moment, there is support for maximization and minimization in your script but they use different key bindings. Is it possible to use the same key binding to toggle minimization / maximization (similar to i3 Mod+f).

Similarly, toggling between tiling and floating with the same key would be really useful!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.