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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
One was where WM was assuming that a seat existed during first manage,
but that's not always true, so we have to check that before running the
initialization code. I also split that off into its own function like in
Window.
The other crash was when trying to calculate the layout with the
output's width and/or height equal to zero, it would crash subtracting
the border width.
I discovered both of these when try to restart beansprout without
restarting River.
I found this when trying to restart beansprout after a separate crash.
Basically, the .window handler used to put new
windows on seat.focused_output for new windows,
but after a restart this is still null even when
an output (and windows) already exist.
Windows became orphans with output=null, breaking
the focused_window.output == focused_output assert
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.
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.
This helps us with de-duplication. Previously, if you had host-specific
keybinds on the same key combination, the compositor would choose the
first... which is the opposite of how everything else in our config
handling works.
Before, we were missing the initial events from the wl_output, including
the scale. This meant that we weren't scaling the bar clock correctly.
To fix it, we just moved the wl_global binding into the .wl_output event
We also got rid of the hashmap of outputs in Globals and Context.
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.
This adds a few new options for the bar (instead of hardcoding all of
them). fonts, text_color, background_color, positoon, and margins.
Also fixed a couple of bugs when reloading the config and destroying
layer shell and wl surfaces in the wrong order.