[ home / rules / faq / search ] [ overboard / sfw / alt ] [ leftypol / edu / labor / siberia / lgbt / latam / hobby / tech / games / anime / music / draw / AKM / ufo ] [ meta ] [ wiki / shop / tv / tiktok / twitter / patreon ] [ GET / ref / marx / booru ]

/tech/ - Technology

"Technology reveals the active relation of man to nature" - Karl Marx
Name
Options
Subject
Comment
Flag
File
Embed
Password(For file deletion.)

Check out our new store at shop.leftypol.org!


File: 1749730345228.webm (634.18 KB, 1280x1024, wm.webm)

 

This might not sound that impressive, but i've just managed to get program-agnostic rio-style window creation working flawlessly in FVWM. Previously it was a flickery, unreliable mess of xdotool commands, but now it's spawning every window iconified, hooking into the window creation event to set geometry from my rectangle selection program and deiconifying it to its correct position.

If you could keep track of all terminals and from which one a particular program is spawned, you might be able to reach true rio emulation closer than even the plan9port version.

Desktop and window management general, i guess.

Oh neat, it really feels like you're opening a window doing it like that.

this looks like trying to force the sphere through the square shape. x11 doesn't have a concept of processes so you are going to have to do something like write your own terminal emulator that can keep track of things under the hood and then a patch for fvwm to talk with the fake terminal and kind of bypass x11

>>30154
Keeping track of terminals is only a matter of adding a script to /etc/profile, tracing the window creation hierarchy would be the only significant problem and either it's possible to do with a small script, or it's near impossible requiring kludges like polling window focus. Curiously x has some sort of window hierarchy built in, but it doesn't work that way. I'm not really attached to rio emulation anyway, that it could potentially emulate some things better than an actual port just speaks to the strengths of FVWM. The last thing i did was adding keybindings to resume normal window placement or "abort" the window to the rectangle program.

Impressive!

>>30155
>Keeping track of terminals
you have to keep track of what the terminal does, or of all fork calls for that matter, not the terminals themselves

>>30157
I have a very specific scheme in mind, which i'd hoped would be aided by something like inheritable x properties, but since they don't exist a kludge it is:
/etc/profile runs a script writing the window id to /run/foo/$$. If a new window is spawned, get the process id with _NET_WM_PID (fails with 9term, so much for icccm compliance), then walk up the process tree using ps until encountering a process in /run/foo containing the window id with which to set the correct geometry.

>>30158
Wait, i think i've found a near-perfect solution. Terminals mimicing xterm will set the WINDOWID environment variable, so for every non-terminal child process you could get the parent terminal with an SUID script like:
#!/bin/sh
strings /proc/"$1"/environ | grep '^WINDOWID=' | cut -d= -f 2-

>>30152
That's cool and I don't want to sound like a dick but have you considered using 9wm or Wio? They are Rio-like WMs for Linux.

>>30174
In rio only the plan9 terminal (which gets its geometry passed in plan9port) can be created this way. As you can see from the xterms, which don't accept pixel coordinates, my scheme works for every program. Also notice the sloppy focus in the video, what you don't see are the 3x3x5 virtual desktops, so there's that. My next step is programming keybindings that align with my emacs muscle memory to work, but the scripting language is finicky and a module would clearly be overkill.

>>30176
Update: I got multi-key commands working in fvwm, with
FvwmMap RootMap $[FVWM_USERDIR]/root.map
Key Space A 4 RootMap

Now i can restart fvwm with a simple s-Space C-x C-r. It calls the following awk script:
#!/usr/bin/awk -f
BEGIN {
	FS = " "
	senter = ""
	sexit = ""
	name = ARGV[1]
	ARGV[1] = ""
	lines = 0
}
/^#/ {
	next
}
{
	senter = senter "+ I Key " $1 " A " $2 " WithExit" name
	for (i=3; i<=NF; i++)
		senter = senter " " $i
	senter = senter "\n"
	sexit = sexit "+ I Key " $1 " A " $2 " -\n"
}
END {
	print "DestroyFunc Exit" name
	print "AddToFunc Exit" name
	print sexit

	print "DestroyFunc " name
	print "AddToFunc " name
	print senter

	print "DestroyFunc WithExit" name
	print "AddToFunc WithExit" name
	print "+ I Exit" name
	print "+ I $*"
}

The top-level command map looks currently like this:
K N Close
P N Stick
T N Exec xterm
X N Exec dmenu | rc
Tab N Next (!Focused, CurrentGlobalPage) FocusWindow
Return N term
B C Direction W (CurrentScreen, CurrentGlobalPage) FocusWindow
F C Direction E (CurrentScreen, CurrentGlobalPage) FocusWindow
G C EscapeFunc
N C Direction N (CurrentScreen, CurrentGlobalPage) FocusWindow
P C Direction S (CurrentScreen, CurrentGlobalPage) FocusWindow
X C ExtendedMap
B M Direction W (!CurrentScreen, CurrentGlobalPage) FocusWindow
F M Direction E (!CurrentScreen, CurrentGlobalPage) FocusWindow
G M GotoMap
N M Direction N (!CurrentScreen, CurrentGlobalPage) FocusWindow
P M Direction S (!CurrentScreen, CurrentGlobalPage) FocusWindow

>>31661
>X N Exec dmenu | rc
To avoid confusion, this is my private dmenu fork, which doesn't do menus or suggestions. I reduced it to a simple prompt.

>>31661
after reading OP again, I didn't notice back then, but I don't think you should be using fvwm or xdotool at all. a barebones x11 wm is like 300 lines of c, and you could implement one with these features in, I would say, 500 lines if you don't care about compatibility and only need it to work on your machine. the wm I used for a long time was 500 lines of zig

because to me it looks more like you are wrestling with fvwm than with the complexity of the task itself. the way to do this with barebones x would be to create windows out of the screen and only move them in when the user does the rectangle gesture

>>31664
No, you see i use a lot of FVWM featureset, like sloppy focus, cascading window placement, the anti-aliased menus and the virtual desktop stuff, which were implemented over a span of decades by a lot of smart people. Besides OP marked the point i managed to recreate the "rectangle gesture" in terms of FVWM primitives, so there are no more xdotool kludges. Maybe sometime i will publish the config and all of the helper programs as their own fvwm-based desktop. For now i will look into adding window groups 0-9 in a way the Next command understands.


Unique IPs: 6

[Return][Go to top] [Catalog] | [Home][Post a Reply]
Delete Post [ ]
[ home / rules / faq / search ] [ overboard / sfw / alt ] [ leftypol / edu / labor / siberia / lgbt / latam / hobby / tech / games / anime / music / draw / AKM / ufo ] [ meta ] [ wiki / shop / tv / tiktok / twitter / patreon ] [ GET / ref / marx / booru ]