mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 01:00:06 +02:00
ft-floatd loads the script into the desktop's KWin, which reports windows over D-Bus and takes commands through a long poll. Floating a window (the window menu's Float in VR, Meta+Shift+F, or ft-float) turns on a spare output sized to the window plus a margin, moves the window onto it, and tells ft-screens the panel's crop, density, and place; docking puts it back and turns the spare off. Tested on the headless test desktop; the panel side in ft-screens comes next. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
952 B
Python
Executable File
26 lines
952 B
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 dock [ID|active] put a floating window back on the desktop
|
|
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 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:
|
|
s.sendto(" ".join(sys.argv[1:]).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)
|