mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Update HACKING.md for KWin script loading
This commit is contained in:
parent
756259bb01
commit
e2429b6bda
1 changed files with 28 additions and 9 deletions
37
HACKING.md
37
HACKING.md
|
|
@ -171,10 +171,9 @@ Create `preview.sh` in the project root:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Launch Shift in a nested KWin window for testing.
|
# Launch Shift in a nested KWin window for testing.
|
||||||
#
|
#
|
||||||
# kwin_wayland --exit-with-session takes exactly ONE path argument (no
|
# kwin_wayland runs on the host (needs direct GPU access) with the project
|
||||||
# extra args), and passing distrobox inline causes argument mangling.
|
# prefix paths so it can load the convergentwindows KWin script and resolve
|
||||||
# So this script writes a small inner launcher to a temp file and points
|
# its QML imports. plasmashell runs inside the distrobox container.
|
||||||
# --exit-with-session at it. The temp file is cleaned up on exit.
|
|
||||||
#
|
#
|
||||||
# Usage: ./preview.sh [WIDTHxHEIGHT]
|
# Usage: ./preview.sh [WIDTHxHEIGHT]
|
||||||
# e.g. ./preview.sh # 1280x720
|
# e.g. ./preview.sh # 1280x720
|
||||||
|
|
@ -187,6 +186,8 @@ SIZE="${1:-1280x720}"
|
||||||
WIDTH="${SIZE%%x*}"
|
WIDTH="${SIZE%%x*}"
|
||||||
HEIGHT="${SIZE##*x}"
|
HEIGHT="${SIZE##*x}"
|
||||||
|
|
||||||
|
PREFIX="$SCRIPT_DIR/.prefix"
|
||||||
|
|
||||||
# Write an ephemeral inner launcher (kwin needs a single executable path)
|
# Write an ephemeral inner launcher (kwin needs a single executable path)
|
||||||
INNER=$(mktemp /tmp/shift-inner.XXXXXX.sh)
|
INNER=$(mktemp /tmp/shift-inner.XXXXXX.sh)
|
||||||
chmod +x "$INNER"
|
chmod +x "$INNER"
|
||||||
|
|
@ -210,6 +211,15 @@ exec plasmashell --replace -p org.kde.plasma.mobileshell
|
||||||
'
|
'
|
||||||
ENDSCRIPT
|
ENDSCRIPT
|
||||||
|
|
||||||
|
# Expose the project prefix to the host kwin_wayland so it can find
|
||||||
|
# KWin scripts (convergentwindows) and their QML dependencies.
|
||||||
|
# Also overlay ~/.config/plasma-mobile so KWin reads the mobile kwinrc
|
||||||
|
# (envmanager writes convergentwindowsEnabled, Placement, etc. there).
|
||||||
|
export XDG_DATA_DIRS="$PREFIX/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
|
||||||
|
export XDG_CONFIG_DIRS="$HOME/.config/plasma-mobile:${XDG_CONFIG_DIRS:-/etc/xdg}"
|
||||||
|
export QT_PLUGIN_PATH="$PREFIX/lib64/plugins:${QT_PLUGIN_PATH:-}"
|
||||||
|
export QML2_IMPORT_PATH="$PREFIX/lib64/qml:${QML2_IMPORT_PATH:-}"
|
||||||
|
|
||||||
exec dbus-run-session \
|
exec dbus-run-session \
|
||||||
kwin_wayland --xwayland \
|
kwin_wayland --xwayland \
|
||||||
--socket shift-kwin \
|
--socket shift-kwin \
|
||||||
|
|
@ -224,13 +234,19 @@ Make it executable: `chmod +x preview.sh`.
|
||||||
|
|
||||||
1. `dbus-run-session` spins up an isolated D-Bus session so the nested
|
1. `dbus-run-session` spins up an isolated D-Bus session so the nested
|
||||||
compositor doesn't clash with your running desktop.
|
compositor doesn't clash with your running desktop.
|
||||||
2. `kwin_wayland` opens a window on your current desktop and creates a
|
2. Four environment exports give the **host** `kwin_wayland` access to
|
||||||
Wayland socket named `shift-kwin`.
|
the project's `.prefix` (KWin scripts, QML plugins) and to
|
||||||
3. The inner script enters the distrobox, sources `prefix.sh` to put
|
`~/.config/plasma-mobile` (where envmanager writes convergence
|
||||||
|
settings like `convergentwindowsEnabled`, `Placement`, etc.).
|
||||||
|
3. `kwin_wayland` opens a window on your current desktop and creates a
|
||||||
|
Wayland socket named `shift-kwin`. Because of the exports it can
|
||||||
|
load the `convergentwindows` script, which handles maximising
|
||||||
|
windows on undock and restoring decorations on dock.
|
||||||
|
4. The inner script enters the distrobox, sources `prefix.sh` to put
|
||||||
the custom build first in all search paths, then starts
|
the custom build first in all search paths, then starts
|
||||||
`plasmashell` from the container's `/usr/bin/plasmashell` — but with
|
`plasmashell` from the container's `/usr/bin/plasmashell` — but with
|
||||||
our plugins loaded from `.prefix`.
|
our plugins loaded from `.prefix`.
|
||||||
4. `--exit-with-session` makes kwin close when plasmashell exits, and
|
5. `--exit-with-session` makes kwin close when plasmashell exits, and
|
||||||
vice versa.
|
vice versa.
|
||||||
|
|
||||||
### Running it
|
### Running it
|
||||||
|
|
@ -375,7 +391,10 @@ Shift/
|
||||||
│ ├── homescreens/folio/ # Folio homescreen applet
|
│ ├── homescreens/folio/ # Folio homescreen applet
|
||||||
│ ├── panel/ # Status bar
|
│ ├── panel/ # Status bar
|
||||||
│ └── taskpanel/ # Navigation bar / gesture panel
|
│ └── taskpanel/ # Navigation bar / gesture panel
|
||||||
|
├── envmanager/ # Applies KWin/KDE config on convergence mode changes
|
||||||
├── quicksettings/ # Action drawer quick-setting tiles
|
├── quicksettings/ # Action drawer quick-setting tiles
|
||||||
├── kcms/ # System Settings modules
|
├── kcms/ # System Settings modules
|
||||||
└── kwin/ # KWin task-switcher plugin
|
└── kwin/
|
||||||
|
├── mobiletaskswitcher/ # KWin task-switcher plugin
|
||||||
|
└── scripts/convergentwindows/ # KWin script: maximize on undock, restore borders on dock
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue