remove borders in tabbed and monocle
This commit is contained in:
@@ -182,7 +182,9 @@ separate setting, `repeat`, under [Input](#input).
|
|||||||
column is divided, so the bottom edge always lands exactly on the output edge.
|
column is divided, so the bottom edge always lands exactly on the output edge.
|
||||||
|
|
||||||
**monocle** — every window gets the full area; only the most recently focused
|
**monocle** — every window gets the full area; only the most recently focused
|
||||||
one is rendered.
|
one is rendered. Tiled windows are drawn without a border in the stacking
|
||||||
|
layouts, monocle and tabbed alike: with one window filling the area there is
|
||||||
|
nothing for a border to separate it from. Floating windows keep theirs.
|
||||||
|
|
||||||
In every layout a newly mapped window goes to the front of the arrangement
|
In every layout a newly mapped window goes to the front of the arrangement
|
||||||
order — the first master slot — and takes focus, as in dwm. A window spawned
|
order — the first master slot — and takes focus, as in dwm. A window spawned
|
||||||
|
|||||||
+22
-6
@@ -809,9 +809,21 @@ const tiled_all: river.WindowV1.Edges = .{
|
|||||||
.bottom = true,
|
.bottom = true,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn applyWindowState(self: *Wm) void {
|
/// How wide a border to give a window.
|
||||||
const bw = config.border_width;
|
///
|
||||||
|
/// The stacking layouts show one window filling the whole area, so a border
|
||||||
|
/// there frames the screen rather than separating anything from anything:
|
||||||
|
/// monocle and tabbed get none, and a fullscreen window never had one.
|
||||||
|
/// Floating windows keep theirs whatever the layout, since those really do
|
||||||
|
/// overlap.
|
||||||
|
fn borderWidth(win: *const Window) i32 {
|
||||||
|
if (win.fullscreen) return 0;
|
||||||
|
if (win.floating) return config.border_width;
|
||||||
|
const out = win.output orelse return config.border_width;
|
||||||
|
return if (out.stacked) 0 else config.border_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn applyWindowState(self: *Wm) void {
|
||||||
for (self.windows.items) |win| {
|
for (self.windows.items) |win| {
|
||||||
if (win.closed) continue;
|
if (win.closed) continue;
|
||||||
|
|
||||||
@@ -855,7 +867,7 @@ fn applyWindowState(self: *Wm) void {
|
|||||||
|
|
||||||
if (!win.visible) continue;
|
if (!win.visible) continue;
|
||||||
|
|
||||||
const content = win.cell.inset(bw);
|
const content = win.cell.inset(borderWidth(win));
|
||||||
const w, const h = win.clampSize(content.width, content.height);
|
const w, const h = win.clampSize(content.width, content.height);
|
||||||
if (w != win.proposed_width or h != win.proposed_height) {
|
if (w != win.proposed_width or h != win.proposed_height) {
|
||||||
win.window.proposeDimensions(w, h);
|
win.window.proposeDimensions(w, h);
|
||||||
@@ -872,7 +884,6 @@ fn applyWindowState(self: *Wm) void {
|
|||||||
|
|
||||||
fn render(self: *Wm) void {
|
fn render(self: *Wm) void {
|
||||||
const gpa = self.gpa;
|
const gpa = self.gpa;
|
||||||
const bw = config.border_width;
|
|
||||||
|
|
||||||
self.scratch_order.clearRetainingCapacity();
|
self.scratch_order.clearRetainingCapacity();
|
||||||
|
|
||||||
@@ -886,7 +897,7 @@ fn render(self: *Wm) void {
|
|||||||
self.setHidden(win, !show);
|
self.setHidden(win, !show);
|
||||||
if (!show) continue;
|
if (!show) continue;
|
||||||
|
|
||||||
self.place(win, bw);
|
self.place(win, borderWidth(win));
|
||||||
self.scratch_order.append(gpa, win) catch {};
|
self.scratch_order.append(gpa, win) catch {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -927,7 +938,7 @@ fn render(self: *Wm) void {
|
|||||||
}
|
}
|
||||||
std.mem.sort(*Window, self.scratch_windows.items, {}, lessByFocus);
|
std.mem.sort(*Window, self.scratch_windows.items, {}, lessByFocus);
|
||||||
for (self.scratch_windows.items) |win| {
|
for (self.scratch_windows.items) |win| {
|
||||||
self.place(win, bw);
|
self.place(win, borderWidth(win));
|
||||||
self.scratch_order.append(gpa, win) catch {};
|
self.scratch_order.append(gpa, win) catch {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -970,6 +981,11 @@ fn place(self: *Wm, win: *Window, bw: i32) void {
|
|||||||
const content = win.cell.inset(bw);
|
const content = win.cell.inset(bw);
|
||||||
if (win.getNode()) |node| node.setPosition(content.x, content.y);
|
if (win.getNode()) |node| node.setPosition(content.x, content.y);
|
||||||
|
|
||||||
|
if (bw == 0) {
|
||||||
|
win.window.setBorders(.{}, 0, 0, 0, 0, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const focused = self.isFocusedAnywhere(win);
|
const focused = self.isFocusedAnywhere(win);
|
||||||
const rgba = if (focused) config.border_focused else config.border_normal;
|
const rgba = if (focused) config.border_focused else config.border_normal;
|
||||||
const ch = color.toChannels(rgba);
|
const ch = color.toChannels(rgba);
|
||||||
|
|||||||
Reference in New Issue
Block a user