mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-15 12:02:39 +00:00
Fixes: #8862 Fixes: #10716 This adds the machinery to pass configuration settings received over DBus down to the GObject Surface so that that configuration information can be used to override some settings from the current "live" config when creating a new window. Currently it's only possible to override `--working-directory` and `--command`. `-e` on the `ghostty +new-window` CLI works as well. Adding more overridable settings is possible, but being able to fully override any possible setting would better be served with a major revamp of how Ghostty handles configs, which I is way out of scope at the moment.
16 lines
598 B
Zig
16 lines
598 B
Zig
const std = @import("std");
|
|
|
|
// This is a copy of std.mem.cutPrefix from 0.16. Once Ghostty has been ported
|
|
// to 0.16 this can be removed.
|
|
|
|
/// If slice starts with prefix, returns the rest of slice starting at
|
|
/// prefix.len.
|
|
pub fn cutPrefix(comptime T: type, slice: []const T, prefix: []const T) ?[]const T {
|
|
return if (std.mem.startsWith(T, slice, prefix)) slice[prefix.len..] else null;
|
|
}
|
|
|
|
test cutPrefix {
|
|
try std.testing.expectEqualStrings("foo", cutPrefix(u8, "--example=foo", "--example=").?);
|
|
try std.testing.expectEqual(null, cutPrefix(u8, "--example=foo", "-example="));
|
|
}
|