impl autoexec support for a single script file
This commit is contained in:
parent
6024066488
commit
b35962606d
2 changed files with 17 additions and 1 deletions
|
|
@ -16,6 +16,9 @@ border_color_focused: RiverColor = utils.parseRgbaComptime("0x89b4fa"),
|
||||||
/// Color of unfocused windows' borders in 0xRRGGBBAA or 0xRRGGBB form
|
/// Color of unfocused windows' borders in 0xRRGGBBAA or 0xRRGGBB form
|
||||||
border_color_unfocused: RiverColor = utils.parseRgbaComptime("0x1e1e2e"),
|
border_color_unfocused: RiverColor = utils.parseRgbaComptime("0x1e1e2e"),
|
||||||
|
|
||||||
|
/// Autoexec script path
|
||||||
|
autoexec_path: ?[]const u8 = null,
|
||||||
|
|
||||||
/// Number of windows in the primary stack
|
/// Number of windows in the primary stack
|
||||||
/// This is a global default, but each tagmask can have its own value
|
/// This is a global default, but each tagmask can have its own value
|
||||||
primary_count: u8 = 1,
|
primary_count: u8 = 1,
|
||||||
|
|
@ -70,6 +73,7 @@ pub const PrimarySide = enum { left, right };
|
||||||
pub const AttachMode = enum { top, bottom };
|
pub const AttachMode = enum { top, bottom };
|
||||||
|
|
||||||
const NodeName = enum {
|
const NodeName = enum {
|
||||||
|
autoexec,
|
||||||
attach_mode,
|
attach_mode,
|
||||||
primary_count,
|
primary_count,
|
||||||
primary_ratio,
|
primary_ratio,
|
||||||
|
|
@ -225,6 +229,13 @@ fn load(config: *Config, reader: *Io.Reader) !void {
|
||||||
}
|
}
|
||||||
// Next, we have to check the specifics for the NodeName
|
// Next, we have to check the specifics for the NodeName
|
||||||
switch (name) {
|
switch (name) {
|
||||||
|
.autoexec => {
|
||||||
|
const autoexec_path = node.arg(&parser, 0);
|
||||||
|
if (autoexec_path) |path| {
|
||||||
|
config.autoexec_path = utils.gpa.dupe(u8, path) catch @panic("Out of memory");
|
||||||
|
}
|
||||||
|
logDebugSettingNode(name, autoexec_path.?);
|
||||||
|
},
|
||||||
.primary_count => {
|
.primary_count => {
|
||||||
const count_str = utils.stripQuotes(node.arg(&parser, 0) orelse "");
|
const count_str = utils.stripQuotes(node.arg(&parser, 0) orelse "");
|
||||||
// Use @max to ensure a minimum of 1
|
// Use @max to ensure a minimum of 1
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,12 @@ pub fn main() !void {
|
||||||
.config = config,
|
.config = config,
|
||||||
});
|
});
|
||||||
defer context.destroy();
|
defer context.destroy();
|
||||||
|
if (context.config.autoexec_path) |path| {
|
||||||
|
std.log.debug("Path: {s}", .{path});
|
||||||
|
const argv = [_][]const u8{"/bin/sh", "-c", path };
|
||||||
|
var child = std.process.Child.init(&argv, utils.gpa);
|
||||||
|
try child.spawn();
|
||||||
|
}
|
||||||
try run(wl_display, context);
|
try run(wl_display, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue