Kröhnkite

repository·master·Indexed 24 days ago

https://github.com/esjeon/krohnkite

A dynamic tiling extension for KWin inspired by the dwm window manager. It integrates with KWin features such as multi-screen support, activities, and virtual desktops. The project includes a CLI tool, shortcut.py, for managing keyboard bindings and virtual desktop shortcuts.

Tokens
5.7K
Snippets
8
Records
35
Agent score
80%

What's inside krohnkite

  1. Enable User Configuration for Kröhnkite

    master

    Due to KWin scripting limitations, you must perform a manual step to enable the configuration button in System Settings.

    1. Create the symlink: Run the following command to link the script's metadata to the KServices directory:

    mkdir -p ~/.local/share/kservices5/
    ln -s ~/.local/share/kwin/scripts/krohnkite/metadata.desktop ~/.local/share/kservices5/krohnkite.desktop

    2. Reactivate the script to apply changes: After making configuration changes, you must toggle the script in the KWin Scripts dialog:

    1. In KWin Scripts settings, untick Kröhnkite.
    2. Click Apply.
    3. Tick Kröhnkite.
    4. Click Apply again.
  2. Prevent borders and shadows from disappearing on maximization

    master

    In the Breeze theme, maximizing a window removes its borders. To keep borders visible while maximized, use Window Rules:

    1. Go to System Settings > Window Management > Window Rules.
    2. Click + Add New....
    3. Set Window class to Unimportant.
    4. Set Window types to Normal Window.
    5. Click + Add Properties....
    6. Add both Maximized horizontally and Maximized vertically properties.
    7. Set the options for both to Force and No.
    8. Click Apply.
  3. Install Kröhnkite via .kwinscript package

    master

    You can install Kröhnkite by downloading a .kwinscript file and using the KDE System Settings GUI or the command line.

    Using System Settings:

    1. Download the krohnkite-x.x.kwinscript file.
    2. Open System Settings > Window Management > KWin Scripts.
    3. Click Import KWin script... in the top-right corner.
    4. Select the downloaded file.

    Using Command Line: To install a new script:

    plasmapkg2 -t kwinscript -i krohnkite.kwinscript

    To upgrade an existing script:

    plasmapkg2 -t kwinscript -u krohnkite.kwinscript

    To uninstall the script:

    plasmapkg2 -t kwinscript -r krohnkite
    plasmapkg2 -t kwinscript -i krohnkite.kwinscript
  4. Set Minimum Window Geometry to 0

    master

    Some applications (like Discord or KDE Settings) have minimum size requirements that prevent them from tiling correctly, causing overlaps. To fix this, force a minimum size of 0x0 for all windows:

    1. Go to System Settings > Window Management > Window Rules.
    2. Click + Add New....
    3. Set Window class to Unimportant.
    4. Set Window types to Normal Window.
    5. Click + Add Properties....
    6. Add the Minimum Size property.
    7. Set the fields to Force and 0 x 0.
    8. Click Apply.
  5. Install Kröhnkite from Git repository

    master

    The easiest way to install Kröhnkite is by cloning the repository and using make.

    Standard Installation: This builds and installs the kwinscript package automatically.

    make install

    To Uninstall:

    make uninstall

    Manual Package Building: If you want to generate the package file manually to import it via the System Settings GUI:

    make package
    make install
  6. Customize Window Border Colors

    master

    If you remove title bars, changing border colors helps identify the active window. You can modify the [WM] section in ~/.config/kdeglobals.

    Using kwriteconfig5 (Recommended):

    kwriteconfig5 --file ~/.config/kdeglobals --group WM --key frame 61,174,233
    kwriteconfig5 --file ~/.config/kdeglobals --group WM --key inactiveFrame 239,240,241

    Manual Method:

    1. Open ~/.config/kdeglobals.
    2. Find the [WM] section.
    3. Append:
      • frame=61,174,233 (Active window RGB)
      • inactiveFrame=239,240,241 (Inactive window RGB)

    Important: You must restart your session (re-login or reboot) for changes to take effect. You may also need to increase the border size in System Settings > Application Style > Window Decorations by unticking Use theme's default window border size and adjusting the value.

  7. Try Kröhnkite without installing

    master

    You can temporarily load Kröhnkite to test it without performing a permanent installation.

    To start the script:

    make run

    To stop the script:

    make stop

    Note: Kröhnkite can destroy itself completely once disabled; no restart is required to deactivate it.

    make run
  8. Configure Multi-Screen support

    master

    To unlock the full potential of Kröhnkite in a multi-monitor setup, configure KWin as follows:

    1. Enable Separate Focus: Go to Window Management > Window Behavior > Multiscreen Behaviour and enable Separate Screen Focus.
    2. Bind Screen Switching: Bind keys for the global shortcut Switch to Next/Previous Screen (Recommended: Meta + , and Meta + .).
    3. Bind Window Movement: Bind keys for the global shortcut Window to Next/Previous Screen (Recommended: Meta + < and Meta + >).

    Note: Separate Screen Focus only appears when multiple monitors are detected.

  9. Understand WindowState and window management modes

    master

    Kröhnkite manages windows using a WindowState enum. Windows can exist in several modes, which determine how they are handled by the tiling engine and how they interact with the backend.

    Window States

    • Unmanaged: The initial state of a window.
    • NativeFullscreen: The window is in fullscreen mode (controlled by the OS/driver).
    • NativeMaximized: The window is maximized (controlled by the OS/driver).
    • Floating: The window's geometry is not tightly managed by the tiling layout.
    • Maximized: The window is maximized via the Kröhnkite engine.
    • Tiled: The window is part of the current tiling layout.
    • TiledAfloat: A hybrid state where the window is part of the layout but retains floating characteristics.
    • Undecided: An internal state.

    Key Concepts for Consumers

    When interacting with a Window object, avoid comparing the state property directly. Instead, use these semantic helper properties:

    • tileable: Returns true if the window's state allows it to be managed by a layout (Tiled, Maximized, or TiledAfloat).
    • tiled: Returns true if the window is currently part of a layout (Tiled or Maximized).
    • floating: Returns true if the window is in a floating mode (Floating or TiledAfloat).
  10. How TilingController manages window events

    master

    The TilingController class acts as the high-level logic layer that translates windowing system events (like adding, removing, or moving windows) into tiling engine actions. It maintains a reference to a TilingEngine to perform the actual window management and arrangement.

    Key behaviors include:

    • Automatic Arrangement: Most event handlers (e.g., onWindowAdded, onWindowRemoved, onSurfaceUpdate) trigger this.engine.arrange(ctx) to ensure the layout is updated immediately.
    • Surface Overflow: When a window is added to a surface that has reached its layout capacity, the controller can automatically move the window to the next available surface.
    • Drag-and-Drop Interactions:
      • Swapping: If a tiled window is dragged over another tile, the controller triggers a swap operation.
      • Floating: If a tiled window is dragged a significant distance (threshold > 30) from its original position, it is converted to a Floating state.
    • Shortcut Handling: It maps user shortcuts to engine commands like focusing windows, resizing, swapping order, or cycling layouts.
  11. Manage Krohnkite shortcuts via the CLI

    master

    The shortcut.py script is a helper tool for managing Krohnkite keyboard shortcuts within KWin. It allows you to register default bindings, customize specific actions, or unregister all Krohnkite shortcuts.

    Requirements:

    • pyside2
    • dbus-python
  12. Default Key Bindings for Kröhnkite

    master
    KeyAction
    Meta + JFocus Down/Next
    Meta + KFocus Up/Previous
    Meta + HLeft
    Meta + LRight
    Meta + Shift + JMove Down/Next
    Meta + Shift + KMove Up/Previous
    Meta + Shift + HMove Left
    Meta + Shift + LMove Right
    Meta + IIncrease
    Meta + DDecrease
    Meta + FToggle Floating
    Meta + \Cycle Layout
    Meta + ReturnSet as Master
    Meta + TUse Tile Layout
    Meta + MUse Monocle Layout
    unboundUse Spread Layout
    unboundUse Stair Layout