mirror of https://github.com/fairyglade/ly.git
Fix config.brightnessctl missing + bugs
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
parent
872b15c0d4
commit
1314c57796
|
@ -41,6 +41,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
default_tty_str = try std.fmt.allocPrint(b.allocator, "{d}", .{default_tty});
|
default_tty_str = try std.fmt.allocPrint(b.allocator, "{d}", .{default_tty});
|
||||||
|
|
||||||
build_options.addOption([]const u8, "config_directory", bin_directory);
|
build_options.addOption([]const u8, "config_directory", bin_directory);
|
||||||
|
build_options.addOption([]const u8, "prefix_directory", prefix_directory);
|
||||||
build_options.addOption([]const u8, "version", version_str);
|
build_options.addOption([]const u8, "version", version_str);
|
||||||
build_options.addOption(u8, "tty", default_tty);
|
build_options.addOption(u8, "tty", default_tty);
|
||||||
build_options.addOption(bool, "enable_x11_support", enable_x11_support);
|
build_options.addOption(bool, "enable_x11_support", enable_x11_support);
|
||||||
|
|
|
@ -186,4 +186,5 @@ xsessions = $PREFIX_DIRECTORY/share/xsessions
|
||||||
# Brightness control
|
# Brightness control
|
||||||
brightness_down_key = F5
|
brightness_down_key = F5
|
||||||
brightness_up_key = F6
|
brightness_up_key = F6
|
||||||
|
brightnessctl = $PREFIX_DIRECTORY/bin/brightnessctl
|
||||||
brightness_change = 10
|
brightness_change = 10
|
||||||
|
|
|
@ -28,33 +28,33 @@ lang: []const u8 = "en",
|
||||||
load: bool = true,
|
load: bool = true,
|
||||||
margin_box_h: u8 = 2,
|
margin_box_h: u8 = 2,
|
||||||
margin_box_v: u8 = 1,
|
margin_box_v: u8 = 1,
|
||||||
mcookie_cmd: [:0]const u8 = "/usr/bin/mcookie",
|
mcookie_cmd: [:0]const u8 = build_options.prefix_directory ++ "/bin/mcookie",
|
||||||
min_refresh_delta: u16 = 5,
|
min_refresh_delta: u16 = 5,
|
||||||
numlock: bool = false,
|
numlock: bool = false,
|
||||||
path: ?[:0]const u8 = "/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin",
|
path: ?[:0]const u8 = "/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin",
|
||||||
restart_cmd: []const u8 = "/sbin/shutdown -r now",
|
restart_cmd: []const u8 = "/sbin/shutdown -r now",
|
||||||
restart_key: []const u8 = "F2",
|
restart_key: []const u8 = "F2",
|
||||||
save: bool = true,
|
save: bool = true,
|
||||||
save_file: []const u8 = "/etc/ly/save",
|
save_file: []const u8 = build_options.config_directory ++ "/ly/save",
|
||||||
service_name: [:0]const u8 = "ly",
|
service_name: [:0]const u8 = "ly",
|
||||||
shutdown_cmd: []const u8 = "/sbin/shutdown -a now",
|
shutdown_cmd: []const u8 = "/sbin/shutdown -a now",
|
||||||
shutdown_key: []const u8 = "F1",
|
shutdown_key: []const u8 = "F1",
|
||||||
sleep_cmd: ?[]const u8 = null,
|
sleep_cmd: ?[]const u8 = null,
|
||||||
sleep_key: []const u8 = "F3",
|
sleep_key: []const u8 = "F3",
|
||||||
term_reset_cmd: [:0]const u8 = "/usr/bin/tput reset",
|
term_reset_cmd: [:0]const u8 = build_options.prefix_directory ++ "/bin/tput reset",
|
||||||
term_restore_cursor_cmd: []const u8 = "/usr/bin/tput cnorm",
|
term_restore_cursor_cmd: []const u8 = build_options.prefix_directory ++ "/bin/tput cnorm",
|
||||||
tty: u8 = build_options.tty,
|
tty: u8 = build_options.tty,
|
||||||
vi_mode: bool = false,
|
vi_mode: bool = false,
|
||||||
vi_default_mode: ViMode = .normal,
|
vi_default_mode: ViMode = .normal,
|
||||||
wayland_cmd: []const u8 = build_options.config_directory ++ "/ly/wsetup.sh",
|
wayland_cmd: []const u8 = build_options.config_directory ++ "/ly/wsetup.sh",
|
||||||
waylandsessions: []const u8 = "/usr/share/wayland-sessions",
|
waylandsessions: []const u8 = build_options.prefix_directory ++ "/share/wayland-sessions",
|
||||||
x_cmd: []const u8 = "/usr/bin/X",
|
x_cmd: []const u8 = build_options.prefix_directory ++ "/bin/X",
|
||||||
xinitrc: ?[]const u8 = "~/.xinitrc",
|
xinitrc: ?[]const u8 = "~/.xinitrc",
|
||||||
x_cmd_setup: []const u8 = build_options.config_directory ++ "/ly/xsetup.sh",
|
x_cmd_setup: []const u8 = build_options.config_directory ++ "/ly/xsetup.sh",
|
||||||
xauth_cmd: []const u8 = "/usr/bin/xauth",
|
xauth_cmd: []const u8 = build_options.prefix_directory ++ "/bin/xauth",
|
||||||
xsessions: []const u8 = "/usr/share/xsessions",
|
xsessions: []const u8 = build_options.prefix_directory ++ "/share/xsessions",
|
||||||
brightness_down_key: []const u8 = "F5",
|
brightness_down_key: []const u8 = "F5",
|
||||||
brightness_up_key: []const u8 = "F6",
|
brightness_up_key: []const u8 = "F6",
|
||||||
brightnessctl: []const u8 = "/usr/bin/brightnessctl",
|
brightnessctl: [:0]const u8 = build_options.prefix_directory ++ "/bin/brightnessctl",
|
||||||
brightness_change: []const u8 = "10",
|
brightness_change: []const u8 = "10",
|
||||||
animation_timeout_sec: u12 = 0,
|
animation_timeout_sec: u12 = 0,
|
||||||
|
|
|
@ -594,7 +594,7 @@ pub fn main() !void {
|
||||||
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.spawnAndWait() catch .{};
|
||||||
}
|
}
|
||||||
} else if (pressed_key == brightness_down_key and unistd.access(&config.brightnessctl[0], unistd.X_OK) == 0) brightness_change: {
|
} else if (pressed_key == brightness_down_key and unistd.access(config.brightnessctl, unistd.X_OK) == 0) brightness_change: {
|
||||||
const brightness_str = std.fmt.allocPrint(allocator, "{s}%-", .{config.brightness_change}) catch {
|
const brightness_str = std.fmt.allocPrint(allocator, "{s}%-", .{config.brightness_change}) catch {
|
||||||
try info_line.addMessage(lang.err_brightness_change, config.error_bg, config.error_fg);
|
try info_line.addMessage(lang.err_brightness_change, config.error_bg, config.error_fg);
|
||||||
break :brightness_change;
|
break :brightness_change;
|
||||||
|
@ -602,7 +602,7 @@ pub fn main() !void {
|
||||||
defer allocator.free(brightness_str);
|
defer allocator.free(brightness_str);
|
||||||
var brightness = std.process.Child.init(&[_][]const u8{ config.brightnessctl, "-q", "s", brightness_str }, allocator);
|
var brightness = std.process.Child.init(&[_][]const u8{ config.brightnessctl, "-q", "s", brightness_str }, allocator);
|
||||||
_ = brightness.spawnAndWait() catch .{};
|
_ = brightness.spawnAndWait() catch .{};
|
||||||
} else if (pressed_key == brightness_up_key and unistd.access(&config.brightnessctl[0], unistd.X_OK) == 0) brightness_change: {
|
} else if (pressed_key == brightness_up_key and unistd.access(config.brightnessctl, unistd.X_OK) == 0) brightness_change: {
|
||||||
const brightness_str = std.fmt.allocPrint(allocator, "+{s}%", .{config.brightness_change}) catch {
|
const brightness_str = std.fmt.allocPrint(allocator, "+{s}%", .{config.brightness_change}) catch {
|
||||||
try info_line.addMessage(lang.err_brightness_change, config.error_bg, config.error_fg);
|
try info_line.addMessage(lang.err_brightness_change, config.error_bg, config.error_fg);
|
||||||
break :brightness_change;
|
break :brightness_change;
|
||||||
|
|
Loading…
Reference in New Issue