mirror of https://github.com/fairyglade/ly.git
* Prevent output of brightness cmds showing on screen (fixing #695) * Prevent output of sleep cmd showing on screen
This commit is contained in:
parent
215ca5edc7
commit
aea95b7724
26
src/main.zig
26
src/main.zig
|
@ -580,14 +580,26 @@ pub fn main() !void {
|
||||||
} else if (pressed_key == sleep_key) {
|
} else if (pressed_key == sleep_key) {
|
||||||
if (config.sleep_cmd) |sleep_cmd| {
|
if (config.sleep_cmd) |sleep_cmd| {
|
||||||
var sleep = std.process.Child.init(&[_][]const u8{ "/bin/sh", "-c", sleep_cmd }, allocator);
|
var sleep = std.process.Child.init(&[_][]const u8{ "/bin/sh", "-c", sleep_cmd }, allocator);
|
||||||
_ = sleep.spawnAndWait() catch .{};
|
sleep.stdout_behavior = .Ignore;
|
||||||
|
sleep.stderr_behavior = .Ignore;
|
||||||
|
|
||||||
|
_ = sleep.spawnAndWait() catch {};
|
||||||
|
}
|
||||||
|
} else if (pressed_key == brightness_down_key or pressed_key == brightness_up_key) {
|
||||||
|
const cmd = if (pressed_key == brightness_down_key) config.brightness_down_cmd else config.brightness_up_cmd;
|
||||||
|
|
||||||
|
var brightness = std.process.Child.init(&[_][]const u8{ "/bin/sh", "-c", cmd }, allocator);
|
||||||
|
brightness.stdout_behavior = .Ignore;
|
||||||
|
brightness.stderr_behavior = .Ignore;
|
||||||
|
|
||||||
|
handle_brightness_cmd: {
|
||||||
|
const process_result = brightness.spawnAndWait() catch {
|
||||||
|
break :handle_brightness_cmd;
|
||||||
|
};
|
||||||
|
if (process_result.Exited != 0) {
|
||||||
|
try info_line.addMessage(lang.err_brightness_change, config.error_bg, config.error_fg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (pressed_key == brightness_down_key) {
|
|
||||||
var brightness = std.process.Child.init(&[_][]const u8{ "/bin/sh", "-c", config.brightness_down_cmd }, allocator);
|
|
||||||
_ = brightness.spawnAndWait() catch .{};
|
|
||||||
} else if (pressed_key == brightness_up_key) {
|
|
||||||
var brightness = std.process.Child.init(&[_][]const u8{ "/bin/sh", "-c", config.brightness_up_cmd }, allocator);
|
|
||||||
_ = brightness.spawnAndWait() catch .{};
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
termbox.TB_KEY_CTRL_C => run = false,
|
termbox.TB_KEY_CTRL_C => run = false,
|
||||||
|
|
Loading…
Reference in New Issue