Previously, beansprout used std.process.Child.spawn without ever calling
wait(), leaving exited children as zombies. This commit switches to a
double-fork based off river-classic's spawn handling, where the actual
spawned process gets orphaned and reparented to PID 1. This way, the
parent (i.e. beansprout) only has to wait for the intermediate child.
Also switch tokenizeShell and expandTilde to produce [:0]const u8 tokens
so the argv array for execvpeZ can be built without copying each string.
Fixes: #12
In commit 75308a04, I added an assertion to Output.destroy() to verify
that all of its windows had been removed already. The issue is, that
only happened when Output received a .removed event, but that never
came when killing the WM directly. Instead, I simplified the handling
for the .removed event and moved most of that into destroy().
I also changed where structs have their wl_list.link removed (to inside
of their destroys) to make it more consistent. Finally,
XkbBinding.sendWindowToOutput asserts that the current output is actually
focused. Users *should* never have a focused window if there's not also
a focused output.
Recently, river removed the hardcoded Ctrl+Alt Delete keybinding that
exits river and replaces it with a new `exit_session` request. This adds
support for that request via the new `exit_session` bind. We also added
3 hardcoded default keybinds to: exit river, reload the config, and
open foot. This way, if the config fails to load or is missing, you
should still be able to try reload. I guess you're still SOL if you have
at least one keybind and it's not reload_config, but you do what you can
do.
This follows the same patterns that Wallpaper and Bar did and makes
TagOverlay use the same manage/render cycle as the rest of the WM.
We also switched to just use a poll timer like river-tag-overlay instead
of using the timerfd. I realized that the Zig stdlib doesn't actually
support timerfds for FreeBSD right now and I don't feel like adding them.
Before, they would try send the window to the "next" output even if
there was only one output... which really just means sending the window
to the bottom of the stack. Instead, they should be a noop.
Also fixed a bug when removing all outputs where the seat wouldn't
clear its focused output.
There were two bugs:
1) If we were focused on the first window and then tried to use the
zoom keybind, we looked for the next tiled window in the list
(correctly skipping floating windows), but we didn't also check the
tags. This meant that if the next window was on a non-visible tag,
it didn't work.
2) After fixing that, we weren't updating the focus to the newly
promoted window, so the border would flash around the window that got
moved to 2nd for a frame. We just needed to update the pending focus
window for seat if we had to swap windows.
Also fixed a crash that I'm really not sure how I didn't have happen
before during Output.create()
Right now, only Window is updated to use Rect. I'll try updating all
instances of x,y,width,height combo to use it.
Now, I actually save the river-layer-shell-v1 and keep track of the
non-exclusive area. The layout calculation uses the usable area instead
of the entire output's geometry.
I removed boundary clamping for the floating windows because it was a
bit janky when hitting the edges. I'll probably add it back at some
point. I also made windows default to 75% of the usable area instead of
keeping their tiled size so that maximized windows look decent when
floating for the first time. Finally, since I removed the clamping, I
added a center_float keybind to center a floating window. If you're
cycling through focused windows and one isn't on the screen, you can use
the center_float bind to get the window visible again.
Replaced all divTrunc with divFloor to be consistent. I think they
should all be positive, anyways, so they'd be the same, but I like just
having one.
They should use gpa.destroy() instead of foo.destroy() because (most) of
them have fields that may not be initialized by the first error, so
the foo.destroy() could crash.
Add interactive move/resize operations using configurable pointer bindings
(Mod4+BTN_LEFT to move, Mod4+BTN_RIGHT to resize). Tiled windows
automatically float when dragged or resized.
Add keyboard commands for floating windows:
- move_up/down/left/right: move by pixel amount
- resize_width/height: resize by pixel amount
- swap_next/swap_prev: swap position in window stack
Fix float dimension initialization when windows first become floating,
and fix clamp crash when resizing windows larger than output bounds.
Update example config with documented keybinds and new pointer_binds block.
As of this commit, there's not-yet a way to resize or move floating
windows, but it's possible to create one and focus through all windows.
Floating windows are always above tiled windows and, if floating window
is focused, that window is always above any another floating windows.
Windows have a separate float_{x, y, width, height} to remember their
floating location if they go from float=>tiled=>float again.
Primary ratio is per-output.
If an output is disconnected/disabled, its windows get sent to the
previous output in the output list. If all outputs are disconnected,
windows are added to an orphan list in the WM. Once an output is
re-added, the orphans are all given to that output.
When a window is sent to a new output, it keeps the same tags as it
had before. I may add an option to take the new output's tags.
- Rename focus_next/focus_prev to focus_next_window/focus_prev_window
- Add focus_next_output/focus_prev_output
- Add send_to_next_output/send_to_prev_output commands to move windows
between outputs
Split Seat.PendingManage.PendingFocus into separate pending output
and pending window structs
Fix window outputs when closing outputs
Keybinds go in a "keybinds" block and follow the format
<command> <modifiers> <keysym> <options>
But there's also a special "tag_bind" command that just takes modifiers
and one of set_output_tags, set_window_tags, toggle_output_tags, and
toggle_window_tags. It will automatically be used to loop through the
1-9 keys on tags 1<<0 to 1<<9, however, you can still implement those
commands individually if you want.
I added 7 new Commands to XkbKeybinds.Commands, though 3 of them don't
work yet.
The new commands that *work* are
+ set_output_tags: u32,
+ set_window_tags: u32,
+ toggle_output_tags: u32,
+ toggle_window_tags: u32,
They each take a 32-bit value as a bitmask to set (or toggle) tags.
The 3 unimplemented commands are
+ spawn_tagmask: u32,
+ focus_previous_tags,
+ send_to_previous_tags,
and they will all panic if they're used.
For now, default keybinds are hardcoded as part of WindowManager's
initializing in the first \`manage_start\` event. Multi-output support
is not added yet, so this will still all happen on a single Output.
Right now, essentially nothing has changed, there is still no multi-
output support and not even a way to change/set/toggle/view/etc. tags.
However, tags *are* implemented at a core level. Next step is to add
keybinds for the various tag actions.
After that, I will work on multi-output support.
Right now, colors are hardcoded in the Config in main.zig.
This commit also adds a couple of new keybinds for navigating between
windows. All keybinds are hardcoded as well right now.