mirror of https://github.com/fairyglade/ly.git
Added key binds to control brightness
I added keybinds to control brightness with brightnessctl. F5 to decrease brightness. f6 to increase brightness.
This commit is contained in:
parent
3d8d8d67df
commit
b71af04a23
13
src/main.zig
13
src/main.zig
|
@ -18,6 +18,9 @@ const Save = @import("config/Save.zig");
|
||||||
const migrator = @import("config/migrator.zig");
|
const migrator = @import("config/migrator.zig");
|
||||||
const SharedError = @import("SharedError.zig");
|
const SharedError = @import("SharedError.zig");
|
||||||
const utils = @import("tui/utils.zig");
|
const utils = @import("tui/utils.zig");
|
||||||
|
const c_import = @cImport({
|
||||||
|
@cInclude("unistd.h");
|
||||||
|
});
|
||||||
|
|
||||||
const Ini = ini.Ini;
|
const Ini = ini.Ini;
|
||||||
const termbox = interop.termbox;
|
const termbox = interop.termbox;
|
||||||
|
@ -476,6 +479,16 @@ pub fn main() !void {
|
||||||
var sleep = std.ChildProcess.init(&[_][]const u8{ "/bin/sh", "-c", sleep_cmd }, allocator);
|
var sleep = std.ChildProcess.init(&[_][]const u8{ "/bin/sh", "-c", sleep_cmd }, allocator);
|
||||||
_ = sleep.spawnAndWait() catch .{};
|
_ = sleep.spawnAndWait() catch .{};
|
||||||
}
|
}
|
||||||
|
} else if (pressed_key == 5) {
|
||||||
|
if (c_import.access("/usr/bin/brightnessctl", c_import.X_OK) == 0) {
|
||||||
|
var brightness = std.ChildProcess.init(&[_][]const u8{ "/usr/bin/brightnessctl", "-q", "s", "5%-" }, allocator);
|
||||||
|
_ = brightness.spawnAndWait()catch.{};
|
||||||
|
}
|
||||||
|
} else if (pressed_key == 6) {
|
||||||
|
if (c_import.access("/usr/bin/brightnessctl", c_import.X_OK) == 0) {
|
||||||
|
var brightness = std.ChildProcess.init(&[_][]const u8{ "/usr/bin/brightnessctl", "-q", "s", "+5%" }, allocator);
|
||||||
|
_ = brightness.spawnAndWait()catch.{};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
termbox.TB_KEY_CTRL_C => run = false,
|
termbox.TB_KEY_CTRL_C => run = false,
|
||||||
|
|
Loading…
Reference in New Issue