feat: add idle_commands config option
This commit is contained in:
parent
719eed4cfd
commit
b87a58accc
2 changed files with 4 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ animation_max_lag: usize = 50, //milliseconds
|
||||||
hover_time_ms: usize = 500, //milliseconds
|
hover_time_ms: usize = 500, //milliseconds
|
||||||
input_idle_time_ms: usize = 150, //milliseconds
|
input_idle_time_ms: usize = 150, //milliseconds
|
||||||
idle_actions: []const IdleAction = &default_actions,
|
idle_actions: []const IdleAction = &default_actions,
|
||||||
|
idle_commands: ?[]const []const u8 = null, // a list of simple commands
|
||||||
enable_format_on_save: bool = false,
|
enable_format_on_save: bool = false,
|
||||||
restore_last_cursor_position: bool = true,
|
restore_last_cursor_position: bool = true,
|
||||||
follow_cursor_on_buffer_switch: bool = false, //scroll cursor into view on buffer switch
|
follow_cursor_on_buffer_switch: bool = false, //scroll cursor into view on buffer switch
|
||||||
|
|
|
||||||
|
|
@ -318,6 +318,9 @@ fn handle_input_idle(self: *Self) void {
|
||||||
var buf: [32]u8 = undefined;
|
var buf: [32]u8 = undefined;
|
||||||
const m = tp.message.fmtbuf(&buf, .{"input_idle"}) catch return;
|
const m = tp.message.fmtbuf(&buf, .{"input_idle"}) catch return;
|
||||||
_ = self.send_widgets(tp.self_pid(), m) catch return;
|
_ = self.send_widgets(tp.self_pid(), m) catch return;
|
||||||
|
const idle_cmds = self.config_.idle_commands orelse return;
|
||||||
|
for (idle_cmds) |cmd|
|
||||||
|
command.executeName(cmd, .{}) catch |e| self.logger.print_err("idlerun", "idle run command '{s}' failed: {t}", .{ cmd, e });
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_input_idle_timer(self: *Self) void {
|
fn update_input_idle_timer(self: *Self) void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue