When I added support for propose dimensions, I was foolishly just
choosing the min (or max) if only one was set. However, a lot of windows
will a set a very small min size with no max, which meant we would have
really tiny windows when first floating one. The fix was to try set to
75% but then clamp to the min/max dimensions the window gave.
After fixing that, there was still an issue where windows kept their
size after being floated. That's because there was a propose_dimensions
call happening later in Window.manage(). I'm skipping that now if a
window became floating in the same manage event.
This is currently only used when floating a window for the first time.
If the window has preferred dimensions, we will use those isntead of the
75% of the screen size rule we were using before.
This moves window initialization earlier in the manage sequence.
Previously, it was on the Window's first manage() call, but this is
after the layout has already been calculated, which matters both because
of tags and whether the window starts floating or not.
Now, initialization is handled in a separate function that gets called
in Output.calculatePrimaryStackLayout() instead.
At least tag rules seem to be working (but they're not frame perfect).
I might need to investigate more for float/no_float.
Rules are ANDed and only apply during window's first manage sequence,
so changing an appid/title doesn't affect anything.
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.
This actually renders a wallpaper for each output using the newly added
Buffer and BufferPool for shared-memory surfaces and creates a
wlr-layer-shell surface per output. Right now, each wallpaper
shares the same wallpaper (though scaled to each).
wl_output globals get added to a HashMap that is used by Output when it
gets an output event.
Fix null-safety in WindowManager when no seats/outputs exist and route
Window dimensions through pending_manage.
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.
Config goes in $XDG_CONFIG_HOME/beansprout/config.kdl or
$HOME/.config/beansprout/config.kdl
Config is in the kdl format. Right now, the supported options are
```zig
/// Width of window borders in pixels
border_width: u8 = 2,
/// Color of focused window's border in 0xRRGGBBAA or 0xRRGGBB form
border_color_focused: RiverColor = utils.parseRgbaComptime("0x89b4fa"),
/// Color of uffocused windows' borders in 0xRRGGBBAA or 0xRRGGBB form
border_color_unfocused: RiverColor = utils.parseRgbaComptime("0x1e1e2e"),
/// Where a new window should attach, top or bottom of the stack
attach_mode: AttachMode = .top,
/// Should focus change when the cursor moves onto a new window
focus_follows_pointer: bool = true,
/// Should the pointer warp to the center of newly-focused windows
pointer_warp_on_focus_change: bool = true,
```
I plan to add Keybinds shortly. If parsing the configuration fails,
the default config will be used and the WM will continue loading.
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.
For now, it's hardcoded to be a right-primary/stack layout (similar to
dwm but with the primary on the right) with the primary window getting
55% of the width of the screen.