358.15. kwin-script-kdos-runraise-1.0.0
KDOS run-or-raise for KWin — one key per terminal program raises its Konsole window or opens one
| Version | 1.0.0, release 1 |
| Source tree | src/desktop/kwin-script-kdos-runraise/ |
| Phase | 50_desktop (Desktop), 70 of 92 in build order |
| Licence | MIT |
| Homepage | https://github.com/kunaldawn/kdos |
| Build time | 0.1 SBU |
| Installed size | 10.8 KiB in 10 files |
| Recipe | src/desktop/kwin-script-kdos-runraise/kpkgbuild |
About
kwin-script-kdos-runraise gives each of KDOS’s terminal programs one key. The key raises the program’s window when one is open and opens one in Konsole when none is; pressed again from one of the program’s windows it moves to the next, so repeated presses walk all of them.
| Key | Program |
|---|---|
| Meta+Shift+M | mc, files |
| Meta+Shift+E | aerc, mail |
| Meta+Shift+B | lynx, the web |
| Meta+Shift+U | rmpc, music |
| Meta+Shift+C | ikhal, the calendar |
| Meta+Shift+G | iamb, chat |
| Meta+Shift+W | micro, the editor |
It is a KWin script written in QML, a KWin/Script package installed to /usr/share/kwin/scripts/kdos_runraise/, with one desktop entry per program in /usr/share/kglobalaccel/. The keys are KWin actions, so they are listed under KWin on System Settings’ Shortcuts page, where each can be changed, and on the key card, each as “Raise or Open
Why it is in KDOS
The comment above the 4 ports from kdos-kwin-motion to kwin-script-kdos-window-memory in script/phases/50_desktop/packages.txt:
KWin's KDOS pieces: the CRT motion effects, the key card on Meta+F1, run-or-raise for the terminal programs and the window position memory.
Sources
None: the port builds from its own directory, /kdos/src/desktop/kwin-script-kdos-runraise.
Dependencies
Depends on: cmake, ninja, extra-cmake-modules, kpackage, kwin, kglobalacceld, konsole.
Required by (1): kde-plasma.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/50_desktop/phase.env && kpkg install kwin-script-kdos-runraise'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /kdos/src/desktop/kwin-script-kdos-runraise.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/kwin-script-kdos-runraise
SRC=$SRC_ROOT/kwin-script-kdos-runraise-1.0.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
cmake -S "$PORT_SRC" -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D KDE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_TESTING=OFF \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
The switches, and why each is set:
-D BUILD_TESTING=OFF— Build no tests. The test is QML (tests/tst_raise.qml.in), run byqmltestrunner;testing/plasmatest.shbuilds it in the development container, where Qt’s test runner is.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/kwin-script-kdos-runraise, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf kwin-script-kdos-runraise-1.0.0-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/kwin-script-kdos-runraise, and runs the triggers its paths call for.
Other files in the port directory, read by build.sh: CMakeLists.txt, kglobalaccel/, package/, tests/.
Contents
Installed directories: /usr/share/kwin/scripts/kdos_runraise.
Notes
Konsole gives every window one application id, org.kde.konsole, so a program’s window is found by its caption. A window the key opened runs konsole --hold -p tabtitle=<program> -e <program>, whose caption is the program’s name; a window opened any other way, from the application menu or by typing the name in a shell, carries Konsole’s own tab title <dir> : <program>, and both are matched. A program that sets its own window title does not change either, because Konsole shows that title in the caption only when “Show window title on the title bar” is turned on.
A KWin script cannot start a program. Each program’s desktop entry in /usr/share/kglobalaccel/ is loaded by kglobalacceld as a component of its own, and the script opens a window by invoking that component’s _launch action over D-Bus, which runs the entry’s Exec line through KIO. The entries carry no key: a key has one owner, and it is the script’s. They are on the Shortcuts page as “
--hold keeps the window after the program exits, so a program that cannot start (rmpc with no MPD to connect to, iamb with no configuration) leaves its error on screen instead of a window that closes before it can be read. A window held after a normal quit keeps its caption, so the key raises it until it is closed.
No program here is a dependency of the port: each is a terminal program a person may remove without losing the rest. The port is on the installation medium and of its seven programs only lynx is, through xdg-utils; the other six install with sudo kdos update install mc aerc rmpc khal iamb micro (ikhal is khal’s). A program that is not installed still has its key, which opens a Konsole window titled after the program holding a shell; Konsole’s “could not find” line comes before the shell’s greeting, which scrolls it out of view.