mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 05:00:08 +02:00
Frametop's own window decoration (decoration/), a QML decoration for KWin's Aurorae engine drawn like Breeze, puts a float button left of Close. It's the Keep Below button with its own glyph: the KWin script floats a window when keep-below is set and docks it when it's cleared, and keeps the flag set on every floating window, so the button shows "back to the desktop" there. The session script installs the decoration for the Frametop desktop only; decoration/apply.sh switches a running desktop to it or back to Breeze. Not yet tried in a running KWin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.7 KiB
Bash
Executable File
36 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Switch the running Frametop desktop's window decoration without restarting it: Frametop's
|
|
# own (this folder, with the float button) or back to Breeze. The session script does the
|
|
# same at every desktop start (session/frametop-session.sh), so this is for trying changes.
|
|
# decoration/apply.sh install this folder's copy and use it
|
|
# decoration/apply.sh --off back to Breeze (until the next desktop start)
|
|
set -euo pipefail
|
|
here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
deco=kwin4_decoration_qml_frametop
|
|
cfg=$HOME/.config/frametop
|
|
kwinrc=$cfg/kwinrc
|
|
|
|
# The desktop's KWin: the one using Frametop's config folder. Its D-Bus is the session's.
|
|
bus=
|
|
for pid in $(pgrep -x kwin_wayland); do
|
|
env=$(tr '\0' '\n' < "/proc/$pid/environ" 2>/dev/null) || continue
|
|
grep -qx "XDG_CONFIG_HOME=$cfg" <<<"$env" || continue
|
|
bus=$(sed -n 's/^DBUS_SESSION_BUS_ADDRESS=//p' <<<"$env")
|
|
done
|
|
[ -n "$bus" ] || { echo "the Frametop desktop isn't running" >&2; exit 1; }
|
|
|
|
if [ "${1:-}" = --off ]; then
|
|
kwriteconfig6 --file "$kwinrc" --group org.kde.kdecoration2 --key library --delete
|
|
kwriteconfig6 --file "$kwinrc" --group org.kde.kdecoration2 --key theme --delete
|
|
else
|
|
dir=${XDG_DATA_HOME:-$HOME/.local/share}/kwin/decorations/$deco
|
|
rm -rf "$dir"
|
|
mkdir -p "$(dirname "$dir")"
|
|
cp -r "$here" "$dir"
|
|
rm -f "$dir/apply.sh"
|
|
kwriteconfig6 --file "$kwinrc" --group org.kde.kdecoration2 --key library org.kde.kwin.aurorae
|
|
kwriteconfig6 --file "$kwinrc" --group org.kde.kdecoration2 --key theme "$deco"
|
|
fi
|
|
DBUS_SESSION_BUS_ADDRESS=$bus gdbus call --session -d org.kde.KWin -o /KWin -m org.kde.KWin.reconfigure >/dev/null
|
|
echo "decoration: $(kreadconfig6 --file "$kwinrc" --group org.kde.kdecoration2 --key theme --default Breeze)"
|