Files
DeeJanuzandClaude Opus 5.5 38843a4717 Launch apps floating, remember where they floated, and Launch as Standalone
ft-float launch APP / run COMMAND: ft-floatd starts the app and floats its
first window (matched by process or desktop file name for 30 s) where that
app last floated, or in front of you at the primary screen's density. Each
app's place (pose relative to the primary screen, size in pixels, scale) is
kept in ~/.config/frametop-float.json whenever one of its windows stops
floating; the scale isn't applied yet, since rescaling can loop (written up
in docs/floating-windows.md, Known problems).

Launch as Standalone (float/ft_apps.py): the session writes copies of the
apps' desktop files with that action and puts them first in XDG_DATA_DIRS,
so it shows in the Application Launcher's and the taskbar's right-click menus
in the Frametop desktop only. ft-floatd rewrites them when apps change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 22:20:36 -06:00

34 lines
1.5 KiB
Python
Executable File

#!/usr/bin/env python3
"""ft-float: talk to ft-floatd (floating windows in the Frametop desktop).
ft-float float [ID|active] float a window (default: the active one; for it, a toggle)
ft-float float pointer the float key: float the window under the pointer (else the
active one), or put it back if it floats
ft-float dock [ID|active] put a floating window back on the desktop
ft-float dock all put every floating window back
ft-float launch APP start an app (its desktop file name, e.g. org.kde.dolphin) and
float its first window where that app last floated
ft-float run COMMAND [ARG...] the same for a command
ft-float close ID close a window
ft-float list the spare outputs and what floats on them
FT_FLOAT_SOCKET names ft-floatd's socket (default frametop_float).
"""
import json
import os
import socket
import sys
if len(sys.argv) < 2 or sys.argv[1] in ("-h", "--help"):
sys.exit(__doc__)
s = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
s.bind("")
s.settimeout(5)
try:
text = "run " + json.dumps(sys.argv[2:]) if sys.argv[1] == "run" else " ".join(sys.argv[1:])
s.sendto(text.encode(), "\0" + os.environ.get("FT_FLOAT_SOCKET", "frametop_float"))
reply = s.recv(8192).decode()
except OSError as e:
sys.exit(f"ft-floatd didn't answer ({e}); is the Frametop desktop running?")
print(reply)
sys.exit(0 if reply.startswith("ok") else 1)