We had to fix a couple of compile errors that weren't showing while it
wasn't wired up (since I never just tried to compile TagOverlay.zig on
its own). We also changed the lifecycle to re-create/destroy the surface
to show/hide it, similar to the way that river-tag-overlay actually did
it.
Finally, I added @branchHint(.cold) to a few places in the event loop
where, if we're in the branch, the wm is definitely exiting, so it's
fine if they're cold (should almost never happen).
Both the wl_surface and layer_surface in each are always expected to
exist at the same time. Since they're optional, it makes more sense to
combine them into a single optional struct.
Since each bar has its own, it's easier to just share it. This does
create a consistent slight overhead, but may be useful anyways if we
care about the Env more further down the line.
I still needed to call setDefault, as well as handle the .focus_*
events from the river_layer_shell_seat_v1.
I also fixed a memory leak where the output wasn't destroying its
river_layer_shell_output_v1.
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 implements more of the text rendering and a clock was the easiest
part. I still need to add the tag bit. I'd also like to hide the tags
but still show the clock like beanclock when windows are fullscreened
parseArgs() contains all of the argument parsing logic in a single fn.
run() handles the event loop. To work with the bar, I had to re-write
the loop to use polling similar to the loop in `beanclock` instead of
just `while (true) dispatch`.
I was looking for places where it might have made sense to use something
like an arena or a fba instead of the C allocator, but almost all of the
allocations are for Wayland interfaces that are fairly long lived (and,
since they're using libwayland, need the C allocator).
Instead, I just found two places that could use buffers on the stack
instead. In Config.zig, we *were* allocating the config path with
fmt.AllocPrint, but std.fs.max_path_bytes exists, so we can just make
a buf of that size and save a heap allocation. This is only at start up
and on config reload so it doesn't do too much, but I'd like to remove
allocations when possible.
The other change is for utils.parseModifiers(). It was using
std.ascii.allocLowerString(), but we clamp the length of the string to
3-5 characters, so we can just make a 5 character buffer and then use
ascii.lowerString() instead. Again, not super helpful since the function
is (currently) only called when creating Configs, but it's still nice to
get rid of a heap alloc.
By default, each tag mask will use the default count and ratio. If the
mask gets modified by any of the commands, it gets added to a hash map.
When changing tag masks, the current count and ratio are stored, and
they're used again later if you switch back to that mask.
This commit also adds primary_count and primary_ratio to the general
settings for the config, so users can set a default count/ratio to use.
This uses KDL properties, i.e. "host=<hostname>" and can be applied to
any config type. An example is includes in examples/config.kdl.
```kdl
wallpaper_image_path "~/Pictures/desktop.png" host="desktop"
wallpaper_image_path "~/Pictures/laptop.png" host="laptop"
```
Only clear should_manage once the device is fully initialized (has an
associated input_device with a name). Previously, should_manage was
cleared unconditionally, so if manage_start fired before the device was
fully linked, configs would never be applied.
We need to defer config application to the first manage_start event
using a should_manage flag so that all *_support events have arrived
before we try applying the configs
This commit also has two other fixes
- fixes a potential use-after-free by telling InputDevice when a
LibinputDevice is .removed.
- fix logFn (removed "if (scope != .default) return;")
I used kwm to help figure out the manage pattern for the input config.
Link to kwm: https://github.com/kewuaa/kwm
It's a new node "input" that, if taking a name, includes the specific
input device the block should apply to. If no name is supplied,
the block applies to all inputs. Order matters and later config blocks
can override previous ones.
The config isn't actually used yet.
Right now, the support is still incomplete (no way to set config) but
we get the devices and set them up and handle current/support events
for the river_libinput_device_v1 devices.
I used flags.zig from Isaac Freund for parsing basic CLI arguments,
I don't need much else since most configuration is in Kdl.
e967499fb1/common/flags.zig
I also removed some of the duplicated bits for the exe_check step
since I realized I can just use the beansprout executable for all of it.
Mark reused buffers as busy before returning from nextBuffer (before,
they only got marked busy on init).
Re-attach wl_buffer listener after re-initializing a buffer. This lets
the re-inited buffer still get a released event.
Combine scale and translate matrices with multiply instead of overwriting
Use appendAssumeCapacity for pixel conversion loop (since we already
initialized the list with the correct size).
Load wallpaper_image_path from config with tilde expansion (environment
variables are not supported)
On the way for this commit, I also had to:
- Fix wallpaper not rendering on startup by triggering init from
the .wl_output handler, since wl_output.done is lost during the
initial roundtrip
- Re-render wallpapers on config reload when the path changes
- Fix crash in deinitWallpaperLayerSurface when wl_surface is null
This makes the WM run fine even if wallpaper_image fails to load for any
other reason. Right now, it's still just a black background. At some
point, I plan to add the ability to also just set a color as a
background but that's a fairly low priority.
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.
Added pixman and zigimg dependencies
Set up in build.zig, added to both exe and exe_check
Add new protocols:
river-layer-shell-v1
wlr-layer-shell-unstable-v1
xdg-shell (dep of wlr-layer-shell-unstable-v1)
Update Context.zig to hold wl_output, wl_shm, and a WallpaperImage
Also re-ordered all of its fields into alphabetical order
Context.create() now takes a Context.Options struct so that it takes
one arg instead of many smaller args.
Added new WallpaperImage.zig, but it's not yet actually used