summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-18 14:21:38 -0300
committerGabriel Schneider <[email protected]>2026-08-18 23:45:30 -0300
commit382abe3dafb872b3e6c9792a9cc0abcf6267e180 (patch)
treee30f47d911561db9b02e714287a1658822c77a09 /src/gui
parentc24a9e40215bc30c68c9db7675f1c6a07d9bbae3 (diff)
downloadpardes-382abe3dafb872b3e6c9792a9cc0abcf6267e180.tar.gz
pardes-382abe3dafb872b3e6c9792a9cc0abcf6267e180.zip
file_watch + builtins + config: richer watch semantics, new builtins, config docs
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.zig25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index d0757d7f..dda843b5 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -17,6 +17,7 @@ const config = @import("../config.zig");
const look = @import("../look.zig");
const message = @import("../message.zig");
const file_watch = @import("../file_watch.zig");
+const user_config = @import("../user_config.zig");
const deck = @import("deck.zig");
const crt = @import("crt.zig");
const fonts = @import("../fonts.zig"); // the Font builtin's half of the seam
@@ -1946,7 +1947,7 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options) !void {
// the replay core's pane ids mean new things, and the dying core's
// `watch off` effects go into a queue nobody drains — drop the lot
// here. The new core emits its own `on`s as it builds its panes.
- for (0..watches.len) |wid| file_watch.watchPane(
+ for (0..pardes.MAX_PANES) |wid| file_watch.watchPane(
inotify_fd,
&watches,
@intCast(wid),
@@ -1954,6 +1955,7 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options) !void {
0,
.{ .text = 0 },
);
+ _ = file_watch.applyThemeEffect(core, gpa, inotify_fd, &watches, 0, false, false);
clearNativeImages(&g);
g.presented_images.clearRetainingCapacity();
g.prepared_images.clearRetainingCapacity();
@@ -3082,6 +3084,16 @@ fn drainEffects(
core.setLastDump(path);
_ = libc.close(fd);
},
+ .dump_themes => |request| {
+ const config_dir = core.opts.config_dir orelse continue;
+ const out_dir = user_config.dumpThemes(io, gpa, config_dir, pardes.themes) catch |err| {
+ core.reportError(request.pane, "dump themes", err);
+ continue;
+ };
+ defer gpa.free(out_dir);
+ var mbuf: [256]u8 = undefined;
+ core.setMessage(request.pane, message.stamp(&mbuf, "dumped themes", out_dir));
+ },
.set_clipboard => {
if (g == null) continue;
const y = core.yank orelse continue;
@@ -3108,6 +3120,17 @@ fn drainEffects(
if (file_watch.applyEffect(core, io, gpa, inotify_fd, watches, w.pane, w.on))
queue.push(.files_changed);
},
+ .theme_file => |request| {
+ if (file_watch.applyThemeEffect(
+ core,
+ gpa,
+ inotify_fd,
+ watches,
+ request.generation,
+ request.on,
+ threads_ok,
+ )) queue.push(.files_changed);
+ },
.quit => {},
};
}