Commit graph

168 commits

Author SHA1 Message Date
Ben Buhse
63f5fc1bcd
Implement variable single-window ratio 2026-03-19 15:15:28 -05:00
Ben Buhse
52785078b7
Handle finished events in WM and IM
I was silently ignoring these before, which wasn't bad, but mostly meant
we wouldn't close them if the compositor ever finished. For WM, we just
send SIGINT and exit the WM in main(). For IM, we destroy() and clean up
like we do in XkbConfig.
2026-03-18 08:51:00 -05:00
Ben Buhse
a1bd356943
Implement river-xkb-config-v1
This commit adds support for the river-xkb-config-v1 protocol. There's
a new keyboard_layout block in config that can take options from
xkeyboard-config(7).
2026-03-16 14:19:59 -05:00
Ben Buhse
799963ae42
Update river wayland protocols 2026-03-15 17:32:53 -05:00
Ben Buhse
ea8a5948a4
Bump version to 0.2.0-dev 2026-03-06 13:59:30 -06:00
Ben Buhse
ca3e77cca9
Release v0.1.0 2026-03-06 13:48:49 -06:00
Ben Buhse
411f679491
Fix bug where Buffers were never freed
The issue was that, when reiniting Buffers, the intrusive linkedlist
node was clobbered and we lost reference to it. That meant most of the
Buffers would be memory leaks. Now, we save the node during
reinitializion.
2026-03-06 11:37:21 -06:00
Ben Buhse
678d0563ed
Add exit_river keybinding
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.
2026-03-06 09:21:07 -06:00
Ben Buhse
38400c66d6
Merge branch 'new-tag-overlay' 2026-03-05 20:40:14 -06:00
Ben Buhse
6e85e0cffe
Remove zwlr_layer_shell_v1 bind
We don't need it anymore because everything using it has been switched
to river_shell_surfaces
2026-03-05 20:37:21 -06:00
Ben Buhse
3150d1a842
Switch TagOverlay to use river_shell_surface_v1
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.
2026-03-05 20:36:19 -06:00
bwbuhse
24374f3f62 Fix link to my ebuild repo 2026-03-04 16:25:44 +01:00
Ben Buhse
8b8efe2186
Switch Wallpaper to use river_shell_surface_v1
This changes it from using zwlr_layer_surface's to river shell surfaces
just so that the manage/render cycle matches as much of the rest of the
wm as possible.

I also made a few small fixes to Bar that I noticed while working on
the wallpaper change
2026-03-03 20:53:28 -06:00
Ben Buhse
ce01eeefe2
Move Wallpaper code into Wallpaper.zig
The Wallpaper used to (mostly) live inside of Output. This moves that
into a new Wallpaper.zig file with a similar structure to that of Bar.

The code from WallpaperImage.zig is not in Wallpaper.Image
2026-03-03 19:55:23 -06:00
Ben Buhse
167141ef15
Fix issue where the bar is rendered over fullscreen windows 2026-03-03 19:55:01 -06:00
Ben Buhse
ece7b7e5bd
Fix focus_next/prev_output command
I fixed trying to send windows to a new output before, but now this
fixes it for also switching output focus.
2026-03-02 15:16:10 -06:00
Ben Buhse
1145aad356
Remove the wl_output.mode listener
wl_output.mode provides the physical dimensions of the output, whereas
river_output_v1.dimensions provides the logical dimensions. In general,
we use the logical coordinates from the dimensions event except for a
few places where we do the scale math on the buffers. So, mode was
fairly useless. If I find a need in the future, I can add it back (but
not set the output width/height in it).
2026-02-28 15:57:42 -06:00
Ben Buhse
b4cb3e599a
Add screenshots to README 2026-02-27 20:04:07 -06:00
Ben Buhse
f10eecffc4
Try again when wl_display.flush() returns EAGAIN
This was causing us to exist when we probably shouldn't have been.
I think the main issue was all the syncNextCommit calls for the bar.

These changes have seeminglly fixed my crash
2026-02-27 13:39:08 -06:00
Ben Buhse
f76fa239ee
Add strftime(3) to see also for the beansprout(5)
Since the time format is customizable now, I might as well add it so
users who many not know about strftime can find all the format strings
2026-02-27 12:21:42 -06:00
Ben Buhse
f7dba63ed5 Merge pull request 'Add window title and wm info to Bar' (#2) from new-bar into main
Reviewed-on: https://codeberg.org/beansprout/beansprout/pulls/2
2026-02-27 19:09:05 +01:00
Ben Buhse
dfdea33389
Fix bug where windows don't have border on wm restart
Before, if you restarted the WM with windows already present, any
non-focused window would just not have a border (because borderes are
only drawn on focus change, which happens for all new windows, but not
exisiting ones). I guess this probably would've happened if users add
new windows appending and didn't focus on new window spawns? Anyways,
now we just tell new windows they're unfocused to draw the border on
first render.
2026-02-27 12:07:24 -06:00
Ben Buhse
040ccc14f3
Implement configurable component locations in bar
This allows the user to configure which component (title, wm_info, clock)
is rendered to which part of the bar (left, right, center).

You can also use `none` to hide the location.
2026-02-27 11:41:46 -06:00
Ben Buhse
bce58855ab
Fix Focus when switching tags
Now, we clear focus if we switch to new tags and no window is visible
2026-02-27 11:41:44 -06:00
Ben Buhse
0e7d652d24
Add time_format config for custom strftime strings
This lets the user change to any time format they want in the bar.
As part of this, we also change the bar to re-draw every second (to
allow using seconds in the time format string).
2026-02-27 11:02:45 -06:00
Ben Buhse
efd0222899
Add window title and wm info to Bar
This commit adds the focused window title to the left side of the bar
and some WM info (primary count/ratio and # of visible/total windows) to
the right side.

It also adds new vertical_padding and horizontal_padding config options
for the bar.
2026-02-27 11:02:42 -06:00
Ben Buhse
062748967c
Move Utf-8 -> codepoint conversion to utils
Once we add more text to the bar, it makes sense to move this into a
helper function.
2026-02-26 17:29:22 -06:00
Ben Buhse
98d15e3773
build: use type inference for manifest import 2026-02-26 17:26:52 -06:00
Ben Buhse
f00c8dbc37 Merge pull request 'Convert Bar to use river shell surface' (#1) from new-bar into main
Reviewed-on: https://codeberg.org/beansprout/beansprout/pulls/1
2026-02-26 23:56:56 +01:00
Ben Buhse
f349733051
Set bar.pending_manage.output_geometry to true on creation
Without this, if you had a config with no bar, added the bar, then
reloaded the config, its geometry would never be created because of the
early return in Bar.manage(), so nothing would ever get drawn.
2026-02-26 16:40:15 -06:00
Ben Buhse
a9473204ad
Convert Bar to use river-shell-surface
I want to implement more functionality to the bar, similar to what
machi has in its bar, but it seems a lot easier to just handle the bar
with the rest of the manage/render loop that rwm and beansprout use.

To do that, I had to convert the bar to use river-shell-surface instead
of zwlr-layer-shell.

In that process, I also removed support for zwlr-layer-shell exclusive
zones. It made calculating the usable area for the layout more annoying.
If someone *really* wants, I would consider adding it back, but the only
thing I can think of that requires exclusive area is a bar, and we don't
really support other bars, so I don't think it's needed.

I also switched a couple of places to use saturating subtraction on
unsigned ints.
2026-02-26 16:34:48 -06:00
Ben Buhse
2be1a1af18
Fix building docs from emerge
This is equivalent to the scdoc patch in the river ebuild
2026-02-25 16:25:26 -06:00
Ben Buhse
bc370573a8
Return an error if b.findProgram errors instead of just skipping 2026-02-25 16:12:44 -06:00
Ben Buhse
09f43674b5
Add man pages
beansprout(1) is basically just the README and beansprout(5) is basically
just docs/CONFIGURATION.md.

By default, the man pages are generated if scdoc is availabled, but they
can also be explicitly disabled with -Dman-pages.
2026-02-25 16:02:58 -06:00
Ben Buhse
164ae9a7ab
Implement left-side primary
This adds a new config `primary_side` that can be either `left` or `right`
and determines whether the primary stack is on the left or the right
side of the screen.
2026-02-25 15:16:48 -06:00
Ben Buhse
b921751100
Implement single_window_ratio
This is a new config option that allows the user to set the width ratio
when only a single window is tiled and visible. The main idea is that,
on ultrawides, a single window taking the full width could be ugly.
With this new config, you can make the window take a smaller width.

I also renamed consts to snake_case instead of SCREAMING_CASE and fixed
a bug where the default primary_count and primary_ratio weren't updated
on config reload.
2026-02-25 13:51:39 -06:00
Ben Buhse
07794019dc
Move old TODO comments to docs/TODO.md 2026-02-24 16:40:58 -06:00
Ben Buhse
bf5ee081d6
Add support for handling quotes in spawn args
The spawn keybind takes a command to launch with `std.process.Child.init`
but we weren't handling quotes in the arguments. We had to add special
tokenization to respect quotes.
2026-02-23 19:09:17 -06:00
Ben Buhse
8b5681a26f
Fix a de-init that I missed in 9fef3f70 2026-02-23 18:57:41 -06:00
Ben Buhse
0bb891a18b
Merge branch 'image-better' 2026-02-22 18:19:34 -06:00
Ben Buhse
006bae3532
Remove manual pixel conversion in WallpaperImage
I used to manually convert pixels from RGBA=>ARGB because Wayland
compositors are only guaranteed to support XRGB and ARGB, but zigimg
doesn't include either of those. This was a bit slow, especially on
debug builds (though not *super* noticeable on release builds).

I realized, though, that zigimg's Rgba32 format is the same as pixman's
a8b8g8r8... on little-endian. I kept the old code just in case someone
out there happens to be running beansprout on MIPS, but I have not
tested it.
2026-02-22 18:15:04 -06:00
Ben Buhse
4c58a3d842
Fix a number of typos in comments 2026-02-22 18:01:57 -06:00
Ben Buhse
b9d13583ab
Fix a number of typos in comments 2026-02-22 17:51:17 -06:00
Ben Buhse
8e6c28da7b
Fix some memory leaks 2026-02-22 17:38:28 -06:00
Ben Buhse
9fef3f70f5
Add XkbBinding.deinit()
Also fixed a crash if two non-spawn keybinds had the same keys
2026-02-22 14:57:41 -06:00
Ben Buhse
1b37ab7afd
Implement passthrough mode
When active, key presses are passed directly to the focused window.
I've mostly used this for testing beansprout, but I'm sure there are
other uses.
2026-02-22 08:59:45 -06:00
Ben Buhse
5f4d80f313
Fix sendTo{Prev,Next}Output commands
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.
2026-02-19 14:01:51 -06:00
Ben Buhse
7045b21534
Handle {exit_}fullscreen_requested events on Windows 2026-02-19 13:56:37 -06:00
Ben Buhse
de55f0c6ee
Move orphan window handling into wm.manage()
This just helps consolidate it into a single place
2026-02-18 17:12:51 -06:00
Ben Buhse
507b16521d Merge pull request 'Implement window rules' (#14) from window-rules into main
Reviewed-on: https://codeberg.org/bwbuhse/beansprout/pulls/14
2026-02-18 23:22:56 +01:00