Skip to content

Commit

Permalink
improve maximizing and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroxoneafour committed Apr 3, 2024
1 parent 695504f commit 7b79806
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 18 deletions.
11 changes: 9 additions & 2 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@

Follow the instructions [here](usage.html#getting-a-log).

### Why isn't <feature> from Bismuth/Sway/other WM in Polonium?

Other window managers, including Bismuth, have a much finer degree of control over how tiles are managed. Polonium works with the KWin tiling API instead of against it, which both simplifies
it and makes it less configurable. This is a delibrate design choice made to make Polonium feel more integrated with Plasma.

If you are looking for a more configurable tiling approach, I suggest [Hyprland](https://hyprland.org).

### How do I move windows with my mouse?

You can drag windows using, by default, `Meta+LMB`. Dragging windows will untile them. Holding `Shift` will allow you to place windows into tiles. Note that you cannot move windows into the root tile by using the mouse.
You can drag windows using, by default, `Meta+LMB`. Dragging windows will untile them. Holding `Shift` will allow you to place windows into tiles. Note that you cannot move windows into the root tile by using the mouse. You can also "quick tile" windows by dragging them into borders of screens, which will place them into the root tile if it is the only tile available.

### How do I move windows with my keyboard / shortcuts not working?

Make sure the shortcuts are set under the KWin tab of the Shortcuts setting. After setting the shortcuts, make sure to restart KWin. They should set by default unless a different shortcut is conflicting.

### This works on Wayland but not X11

X11 is not officially supported, but you can drop an issue and I can see if I can fix it. Include a log! If I personally don't encounter the error, there is a good chance it will not be fixed.
Plasma 6 has moved to Wayland by default. Support will not be provided for X11.

### Windows appear in strange places but go back to normal after I switch desktops/rebuild the layout

Expand Down
22 changes: 18 additions & 4 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,23 @@ Do one of the following -
- Go to the [KWin Store](https://store.kde.org/p/2140417) and download the latest `polonium.kwinscript`, then install it in KWin Scripts
- Go to KWin Scripts settings panel and Get New Scripts, then search for and select Polonium

It is recommended to install dbus-saver if you have a complex layout. To do this, follow the instructions [on the repo](https://github.com/zeroxoneafour/dbus-saver).
### Extras

## Uninstallation
Unlike Bismuth, Polonium is just a KWin Script and is not a comprehensive set of packages capable of emulating a window manager. Here are some packages and config settings I suggest for a more fluid feel.

Config settings -

* Window activation - Focus follows mouse (mouse precedence)
* Delay focus - 0ms
* Window actions modifier key - Meta

Additional (completely optional) components -

* [dbus-saver](https://github.com/zeroxoneafour/dbus-saver) - A systemd service for saving settings after logging out. **Officially supported.**
* [Active accent borders](https://github.com/nclarius/Plasma-window-decorations) - Bismuth-like borders for tiled windows. [KDE store](https://store.kde.org/p/1678088) and [AUR](https://aur.archlinux.org/packages/plasma-active-accent-decorations) packages available. **NOT officially supported.**
* [Geometry Change](https://github.com/peterfajdiga/kwin4_effect_geometry_change) - Fluid tiling animations. Available on the [KDE store](https://store.kde.org/p/2136283).

### Uninstallation

To uninstall Polonium, simply uninstall it through KWin Scripts. If you want to remove old shortcuts, edit `~/.config/kglobalshortcutsrc` and remove all mentions of Polonium. To uninstall dbus-saver,
do `cargo uninstall dbus-saver` and remove the systemd service.
Expand All @@ -23,15 +37,15 @@ Windows will be automatically tiled unless the whitelist option is enabled. Wind

### Removing windows

Windows will be removed from the tiling manager automatically as well
Windows will be removed from the tiling manager automatically as well. Windows can be added or removed manually with the Retile Window shortcut (default `Meta+Shift+Space`).

### Resizing tiled windows with your keyboard

The default keybinds to resize tiled windows with your keyboard are `Meta+Ctrl+<HJKL>`. In the Half and Three Column layouts, you can only resize windows left and right. In the BTree layout, you can resize windows in all directions.

### Resizing tiled windows with your mouse

By pressing the KWin tiles key (default - `Meta+T`) a tile configuration menu will appear. Adding or removing tiles will not have a lasting effect, but resizing tiles will for engines that support it. The clients of these tiles will be automatically resized as well.
By pressing the KWin tiles key (default - `Meta+T`) a tile configuration menu will appear. Adding or removing tiles will not have a lasting effect, but resizing tiles will for engines that support it. The clients of these tiles will be automatically resized as well. In this menu, you can also adjust gaps and padding by editing the setting in the top right corner.

### Moving windows with your keyboard

Expand Down
15 changes: 6 additions & 9 deletions src/controller/actions/windowhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,28 +232,25 @@ export class WindowHooks {
}

maximizedChanged(mode: MaximizeMode) {
const maximized = mode == MaximizeMode.MaximizeFull;
this.extensions.maximized = maximized;
// ignore if the driver is making windows maximized
if (this.ctrl.driverManager.buildingLayout) {
return;
}
// dont interfere with single maximized windows
// just dont handle maximizing for these
if (this.extensions.isSingleMaximized) {
return;
}
let maximized = mode == MaximizeMode.MaximizeFull;
this.logger.debug(
"Maximized on window",
this.window.resourceClass,
"set to",
maximized,
);
// root tile applies with "maximize single windows" and should be completely discarded
/*
if (this.ctrl.workspace.tilingForScreen(this.window.output).rootTile == this.window.tile) {
return;
}
*/
if (maximized && this.extensions.isTiled) {
if (
(maximized && this.extensions.isTiled)
) {
this.ctrl.driverManager.untileWindow(this.window);
this.ctrl.driverManager.rebuildLayout(this.window.output);
this.extensions.wasTiled = true;
Expand Down
14 changes: 11 additions & 3 deletions src/driver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ export class DriverManager {
}

private applyUntiled(window: Window): void {
this.ctrl.windowExtensions.get(window)!.isTiled = false;
const extensions = this.ctrl.windowExtensions.get(window)!;
extensions.isTiled = false;
extensions.isSingleMaximized = false;
if (this.config.keepTiledBelow) {
window.keepBelow = false;
}
Expand Down Expand Up @@ -212,13 +214,19 @@ export class DriverManager {
);
// make registered "untiled" clients appear untiled
for (const window of driver.untiledWindows) {
this.applyUntiled(window);
window.tile = null;
// sometimes effects on untiled windows dont properly apply
if (window.fullScreen) {
window.fullScreen = false;
window.fullScreen = true;
}
// maxmimized
const extensions = this.ctrl.windowExtensions.get(window)!;
const wasSingleMaximized = extensions.isSingleMaximized;
this.applyUntiled(window);
window.tile = null;
if (wasSingleMaximized) {
window.setMaximize(false, false);
}
}
}
this.buildingLayout = false;
Expand Down

0 comments on commit 7b79806

Please sign in to comment.