mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 04:04:09 +02:00
Merge floating-windows into experimental
Floating windows join the keyboard and the hand cutouts. Floating panels don't get cutouts yet: their panel and popups show crops of the client buffer (texture bounds), which the side-by-side cutout buffer doesn't match. KWin gets both the spare outputs and our input method, and the pointer helper's frametop. prefix already covers the float panels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
4493b789fd
14 files changed
+2020
-93
No files matched your search
@@ -34,7 +34,7 @@ for var in $(compgen -e); do
|
||||
done
|
||||
|
||||
conf=$HOME/.config/frametop.conf
|
||||
BACKEND=screens SCREENS=2 WIDTH=1920 HEIGHT=1080 PHYS_WIDTH=1.6 REMOTE=0
|
||||
BACKEND=screens SCREENS=2 WIDTH=1920 HEIGHT=1080 PHYS_WIDTH=1.6 REMOTE=0 FLOAT_SLOTS=8 FLOAT_MARGIN=300
|
||||
# shellcheck disable=SC1090
|
||||
[ -f "$conf" ] && . "$conf"
|
||||
backend=${FT_BACKEND:-$BACKEND}
|
||||
@@ -43,6 +43,13 @@ width=${FT_WIDTH:-$WIDTH}
|
||||
height=${FT_HEIGHT:-$HEIGHT}
|
||||
phys_width=${FT_PHYS_WIDTH:-$PHYS_WIDTH}
|
||||
remote=${FT_REMOTE:-$REMOTE}
|
||||
# Floating windows (screens backend): KWin gets this many spare outputs after the screens,
|
||||
# and ft-floatd floats a window on each (docs/floating-windows.md). Changing it takes a
|
||||
# desktop restart.
|
||||
float_slots=${FT_FLOAT_SLOTS:-$FLOAT_SLOTS}
|
||||
[[ $float_slots =~ ^[0-9]+$ ]] || float_slots=8
|
||||
[ "$float_slots" -le 16 ] || float_slots=16
|
||||
[ "$backend" = screens ] || float_slots=0
|
||||
if [ "$backend" = gamescope ] && [ $((width * height)) -gt $((1920 * 1080)) ]; then
|
||||
# gamescope's VR backend aborts above 1920x1080 worth of pixels (its upload buffer;
|
||||
# see docs/design.md). Shrink a bigger size to fit, keeping its shape.
|
||||
@@ -84,10 +91,10 @@ if [ "${1:-}" != --inner ]; then
|
||||
# Plasma stay on the host and connect to its socket.
|
||||
socket=ft-screens-0
|
||||
read -ra screen_args <<< "$("$here/../layout/ft-layout" screen-args)"
|
||||
export FT_SCREEN_COUNT=$(( ${#screen_args[@]} / 2 ))
|
||||
export FT_SCREEN_COUNT=$(( ${#screen_args[@]} / 2 )) FT_FLOAT_SLOTS=$float_slots
|
||||
"$here/../scripts/container-up.sh" # not owned by this desktop, or stopping it would stop the container
|
||||
"$HOME/.local/bin/distrobox" enter dev -- "$here/../screens/build/ft-screens" --socket "$socket" \
|
||||
"${screen_args[@]}" > /tmp/frametop-screens.log 2>&1 < /dev/null &
|
||||
"${screen_args[@]}" --spares "$float_slots" > /tmp/frametop-screens.log 2>&1 < /dev/null &
|
||||
stop_screens() { pkill -x ft-screens 2>/dev/null || true; }
|
||||
trap stop_screens EXIT
|
||||
for _ in $(seq 100); do [ -S "$XDG_RUNTIME_DIR/$socket" ] && break; sleep 0.2; done
|
||||
@@ -142,8 +149,8 @@ fi
|
||||
textinput=$(readlink -f "$here/../input/ft-textinput")
|
||||
cat > "$runtime/bin/kwin_wayland_wrapper" <<EOF
|
||||
#!/bin/sh
|
||||
exec /usr/bin/kwin_wayland_wrapper --width $width --height $height --output-count $screens --no-lockscreen \\
|
||||
--inputmethod $textinput "\$@"
|
||||
exec /usr/bin/kwin_wayland_wrapper --width $width --height $height --output-count $((screens + float_slots)) \\
|
||||
--no-lockscreen --inputmethod $textinput "\$@"
|
||||
EOF
|
||||
chmod +x "$runtime/bin/kwin_wayland_wrapper"
|
||||
export PATH=$runtime/bin:$PATH
|
||||
@@ -171,4 +178,21 @@ if [ "$remote" = 1 ]; then
|
||||
"$here/vnc-bridge.sh" "$width" "$height" > /tmp/frametop-vnc.log 2>&1 &
|
||||
fi
|
||||
|
||||
# ft-floatd (floating windows) runs inside the Plasma session, on its D-Bus: started from
|
||||
# the session's autostart, which only this desktop reads (XDG_CONFIG_HOME above).
|
||||
autostart=$XDG_CONFIG_HOME/autostart/frametop-floatd.desktop
|
||||
if [ "$float_slots" -gt 0 ]; then
|
||||
mkdir -p "$(dirname "$autostart")"
|
||||
cat > "$autostart" <<EOF
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Frametop floating windows
|
||||
Exec=sh -c 'exec "$here/../float/ft-floatd" --screens $screens --slots $float_slots > /tmp/frametop-floatd.log 2>&1'
|
||||
X-KDE-autostart-phase=2
|
||||
NoDisplay=true
|
||||
EOF
|
||||
else
|
||||
rm -f "$autostart"
|
||||
fi
|
||||
|
||||
dbus-run-session startplasma-wayland
|
||||
Reference in new issue
Block a user