mirror of https://github.com/fairyglade/ly.git
Fix merge conflict
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
commit
e577c454da
|
@ -208,6 +208,7 @@ fn install_ly(allocator: std.mem.Allocator, patch_map: PatchMap, install_config:
|
|||
"fr.ini",
|
||||
"it.ini",
|
||||
"ja_JP.ini",
|
||||
"lv.ini",
|
||||
"pl.ini",
|
||||
"pt.ini",
|
||||
"pt_BR.ini",
|
||||
|
|
|
@ -68,13 +68,13 @@ border_fg = 0x00FFFFFF
|
|||
box_title = null
|
||||
|
||||
# Brightness decrease command
|
||||
brightness_down_cmd = $PREFIX_DIRECTORY/bin/brightnessctl -q s 10%-
|
||||
brightness_down_cmd = $PREFIX_DIRECTORY/bin/brightnessctl -q -n s 10%-
|
||||
|
||||
# Brightness decrease key, or null to disable
|
||||
brightness_down_key = F5
|
||||
|
||||
# Brightness increase command
|
||||
brightness_up_cmd = $PREFIX_DIRECTORY/bin/brightnessctl -q s +10%
|
||||
brightness_up_cmd = $PREFIX_DIRECTORY/bin/brightnessctl -q -n s +10%
|
||||
|
||||
# Brightness increase key, or null to disable
|
||||
brightness_up_key = F6
|
||||
|
@ -189,6 +189,10 @@ hide_version_string = false
|
|||
# Remove power management command hints
|
||||
hide_key_hints = false
|
||||
|
||||
# Set to null to disable battery status display
|
||||
# Default is BAT0, the typical identifier for the primary battery
|
||||
battery_id = null
|
||||
|
||||
# Initial text to show on the info line
|
||||
# If set to null, the info line defaults to the hostname
|
||||
initial_info_text = null
|
||||
|
|
|
@ -43,6 +43,7 @@ err_perm_user = فشل في تخفيض صلاحيات المستخدم (User per
|
|||
err_pwnam = فشل في جلب معلومات المستخدم
|
||||
err_sleep = فشل في تنفيذ أمر sleep
|
||||
|
||||
|
||||
err_tty_ctrl = فشل في نقل تحكم الطرفية (TTY)
|
||||
|
||||
err_user_gid = فشل في تعيين معرّف المجموعة (GID) للمستخدم
|
||||
|
|
|
@ -45,6 +45,7 @@ err_pwnam = error en obtenir la informació de l'usuari
|
|||
|
||||
|
||||
|
||||
|
||||
err_user_gid = error en establir el GID de l'usuari
|
||||
err_user_init = error en inicialitzar usuari
|
||||
err_user_uid = error en establir l'UID de l'usuari
|
||||
|
|
|
@ -45,6 +45,7 @@ err_pwnam = nelze získat informace o uživateli
|
|||
|
||||
|
||||
|
||||
|
||||
err_user_gid = nastavení GID uživatele selhalo
|
||||
err_user_init = inicializace uživatele selhala
|
||||
err_user_uid = nastavení UID uživateli selhalo
|
||||
|
|
|
@ -43,6 +43,7 @@ err_perm_user = Fehler beim Heruntersetzen der Nutzerberechtigungen
|
|||
err_pwnam = Abrufen der Benutzerinformationen fehlgeschlagen
|
||||
err_sleep = Sleep-Befehl fehlgeschlagen
|
||||
|
||||
|
||||
err_tty_ctrl = Fehler bei der TTY-Uebergabe
|
||||
|
||||
err_user_gid = Fehler beim Setzen der Gruppen-ID
|
||||
|
|
|
@ -42,6 +42,7 @@ err_perm_group = failed to downgrade group permissions
|
|||
err_perm_user = failed to downgrade user permissions
|
||||
err_pwnam = failed to get user info
|
||||
err_sleep = failed to execute sleep command
|
||||
err_battery = failed to load battery status
|
||||
err_switch_tty = failed to switch tty
|
||||
err_tty_ctrl = tty control transfer failed
|
||||
err_no_users = no users found
|
||||
|
|
|
@ -45,6 +45,7 @@ err_pwnam = error al obtener la información del usuario
|
|||
|
||||
|
||||
|
||||
|
||||
err_user_gid = error al establecer el GID del usuario
|
||||
err_user_init = error al inicializar usuario
|
||||
err_user_uid = error al establecer el UID del usuario
|
||||
|
|
|
@ -42,6 +42,7 @@ err_perm_group = échec du déclassement des permissions de groupe
|
|||
err_perm_user = échec du déclassement des permissions utilisateur
|
||||
err_pwnam = échec de lecture des infos utilisateur
|
||||
err_sleep = échec de l'exécution de la commande de veille
|
||||
|
||||
err_switch_tty = échec du changement de terminal
|
||||
err_tty_ctrl = échec du transfert de contrôle du terminal
|
||||
err_no_users = aucun utilisateur trouvé
|
||||
|
|
|
@ -45,6 +45,7 @@ err_pwnam = impossibile ottenere dati utente
|
|||
|
||||
|
||||
|
||||
|
||||
err_user_gid = impossibile impostare GID utente
|
||||
err_user_init = impossibile inizializzare utente
|
||||
err_user_uid = impossible impostare UID utente
|
||||
|
|
|
@ -43,6 +43,7 @@ err_perm_user = ユーザー権限のダウングレードに失敗しました
|
|||
err_pwnam = ユーザー情報の取得に失敗しました
|
||||
err_sleep = スリープコマンドの実行に失敗しました
|
||||
|
||||
|
||||
err_tty_ctrl = TTY制御の転送に失敗しました
|
||||
|
||||
err_user_gid = ユーザーGIDの設定に失敗しました
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
authenticating = autentificējas...
|
||||
brightness_down = samazināt spilgtumu
|
||||
brightness_up = palielināt spilgtumu
|
||||
capslock = caps lock
|
||||
custom = pielāgots
|
||||
err_alloc = neizdevās atmiņas piešķiršana
|
||||
err_bounds = indekss ārpus robežām
|
||||
err_brightness_change = neizdevās mainīt spilgtumu
|
||||
err_chdir = neizdevās atvērt mājas mapi
|
||||
err_clock_too_long = pulksteņa virkne pārāk gara
|
||||
err_config = neizdevās parsēt konfigurācijas failu
|
||||
err_dgn_oob = žurnāla ziņojums
|
||||
err_domain = nederīgs domēns
|
||||
err_empty_password = tukša parole nav atļauta
|
||||
err_envlist = neizdevās iegūt vides mainīgo sarakstu
|
||||
err_get_active_tty = neizdevās iegūt aktīvo tty
|
||||
err_hostname = neizdevās iegūt hostname
|
||||
err_lock_state = neizdevās iegūt bloķēšanas stāvokli
|
||||
err_log = neizdevās atvērt žurnāla failu
|
||||
err_mlock = neizdevās bloķēt paroles atmiņu
|
||||
err_null = null rādītājs
|
||||
err_numlock = neizdevās iestatīt numlock
|
||||
err_pam = pam transakcija neizdevās
|
||||
err_pam_abort = pam transakcija pārtraukta
|
||||
err_pam_acct_expired = konts novecojis
|
||||
err_pam_auth = autentifikācijas kļūda
|
||||
err_pam_authinfo_unavail = neizdevās iegūt lietotāja informāciju
|
||||
err_pam_authok_reqd = žetons beidzies
|
||||
err_pam_buf = atmiņas bufera kļūda
|
||||
err_pam_cred_err = neizdevās iestatīt akreditācijas datus
|
||||
err_pam_cred_expired = akreditācijas dati novecojuši
|
||||
err_pam_cred_insufficient = nepietiekami akreditācijas dati
|
||||
err_pam_cred_unavail = neizdevās iegūt akreditācijas datus
|
||||
err_pam_maxtries = sasniegts maksimālais mēģinājumu skaits
|
||||
err_pam_perm_denied = piekļuve liegta
|
||||
err_pam_session = sesijas kļūda
|
||||
err_pam_sys = sistēmas kļūda
|
||||
err_pam_user_unknown = nezināms lietotājs
|
||||
err_path = neizdevās iestatīt ceļu
|
||||
err_perm_dir = neizdevās mainīt pašreizējo mapi
|
||||
err_perm_group = neizdevās pazemināt grupas atļaujas
|
||||
err_perm_user = neizdevās pazemināt lietotāja atļaujas
|
||||
err_pwnam = neizdevās iegūt lietotāja informāciju
|
||||
err_sleep = neizdevās izpildīt miega komandu
|
||||
err_battery = neizdevās ielādēt akumulatora stāvokli
|
||||
err_switch_tty = neizdevās pārslēgt tty
|
||||
err_tty_ctrl = tty vadības nodošana neizdevās
|
||||
err_no_users = lietotāji nav atrasti
|
||||
err_user_gid = neizdevās iestatīt lietotāja GID
|
||||
err_user_init = neizdevās inicializēt lietotāju
|
||||
err_user_uid = neizdevās iestatīt lietotāja UID
|
||||
err_xauth = xauth komanda neizdevās
|
||||
err_xcb_conn = xcb savienojums neizdevās
|
||||
err_xsessions_dir = neizdevās atrast sesiju mapi
|
||||
err_xsessions_open = neizdevās atvērt sesiju mapi
|
||||
insert = ievietot
|
||||
login = lietotājs
|
||||
logout = iziet
|
||||
no_x11_support = x11 atbalsts atspējots kompilācijas laikā
|
||||
normal = parastais
|
||||
numlock = numlock
|
||||
other = cits
|
||||
password = parole
|
||||
restart = restartēt
|
||||
shell = terminālis
|
||||
shutdown = izslēgt
|
||||
sleep = snauda
|
||||
wayland = wayland
|
||||
x11 = x11
|
||||
xinitrc = xinitrc
|
||||
|
|
@ -43,6 +43,7 @@ err_perm_user = nie udało się obniżyć uprawnień użytkownika
|
|||
err_pwnam = nie udało się uzyskać informacji o użytkowniku
|
||||
err_sleep = nie udało się wykonać polecenia sleep
|
||||
|
||||
|
||||
err_tty_ctrl = nie udało się przekazać kontroli tty
|
||||
|
||||
err_user_gid = nie udało się ustawić GID użytkownika
|
||||
|
|
|
@ -45,6 +45,7 @@ err_pwnam = erro ao obter informação do utilizador
|
|||
|
||||
|
||||
|
||||
|
||||
err_user_gid = erro ao definir o GID do utilizador
|
||||
err_user_init = erro ao iniciar o utilizador
|
||||
err_user_uid = erro ao definir o UID do utilizador
|
||||
|
|
|
@ -45,6 +45,7 @@ err_pwnam = não foi possível obter informações do usuário
|
|||
|
||||
|
||||
|
||||
|
||||
err_user_gid = não foi possível definir o GID do usuário
|
||||
err_user_init = não foi possível iniciar o usuário
|
||||
err_user_uid = não foi possível definir o UID do usuário
|
||||
|
|
|
@ -53,6 +53,7 @@ err_perm_user = nu s-a putut face downgrade permisiunilor de utilizator
|
|||
|
||||
|
||||
|
||||
|
||||
login = utilizator
|
||||
logout = opreşte sesiunea
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ err_perm_group = не удалось понизить права доступа
|
|||
err_perm_user = не удалось понизить права доступа пользователя
|
||||
err_pwnam = не удалось получить информацию о пользователе
|
||||
err_sleep = не удалось выполнить команду sleep
|
||||
|
||||
err_switch_tty = не удалось переключить tty
|
||||
err_tty_ctrl = передача управления tty не удалась
|
||||
err_no_users = пользователи не найдены
|
||||
|
|
|
@ -45,6 +45,7 @@ err_pwnam = neuspijesno skupljanje informacija o korisniku
|
|||
|
||||
|
||||
|
||||
|
||||
err_user_gid = neuspijesno postavljanje korisničkog GID-a
|
||||
err_user_init = neuspijensa inicijalizacija korisnika
|
||||
err_user_uid = neuspijesno postavljanje UID-a korisnika
|
||||
|
|
|
@ -45,6 +45,7 @@ err_pwnam = misslyckades att hämta användarinfo
|
|||
|
||||
|
||||
|
||||
|
||||
err_user_gid = misslyckades att ställa in användar-GID
|
||||
err_user_init = misslyckades att initialisera användaren
|
||||
err_user_uid = misslyckades att ställa in användar-UID
|
||||
|
|
|
@ -45,6 +45,7 @@ err_pwnam = kullanici bilgileri alinamadi
|
|||
|
||||
|
||||
|
||||
|
||||
err_user_gid = kullanici icin GID ayarlanamadi
|
||||
err_user_init = kullanici oturumu baslatilamadi
|
||||
err_user_uid = kullanici icin UID ayarlanamadi
|
||||
|
|
|
@ -45,6 +45,7 @@ err_pwnam = не вдалося отримати дані користувача
|
|||
|
||||
|
||||
|
||||
|
||||
err_user_gid = не вдалося змінити GID користувача
|
||||
err_user_init = не вдалося ініціалізувати користувача
|
||||
err_user_uid = не вдалося змінити UID користувача
|
||||
|
|
|
@ -45,6 +45,7 @@ err_pwnam = 获取用户信息失败
|
|||
|
||||
|
||||
|
||||
|
||||
err_user_gid = 设置用户GID失败
|
||||
err_user_init = 初始化用户失败
|
||||
err_user_uid = 设置用户UID失败
|
||||
|
|
|
@ -18,9 +18,9 @@ bigclock_seconds: bool = false,
|
|||
blank_box: bool = true,
|
||||
border_fg: u32 = 0x00FFFFFF,
|
||||
box_title: ?[]const u8 = null,
|
||||
brightness_down_cmd: [:0]const u8 = build_options.prefix_directory ++ "/bin/brightnessctl -q s 10%-",
|
||||
brightness_down_cmd: [:0]const u8 = build_options.prefix_directory ++ "/bin/brightnessctl -q -n s 10%-",
|
||||
brightness_down_key: ?[]const u8 = "F5",
|
||||
brightness_up_cmd: [:0]const u8 = build_options.prefix_directory ++ "/bin/brightnessctl -q s +10%",
|
||||
brightness_up_cmd: [:0]const u8 = build_options.prefix_directory ++ "/bin/brightnessctl -q -n s +10%",
|
||||
brightness_up_key: ?[]const u8 = "F6",
|
||||
clear_password: bool = false,
|
||||
clock: ?[:0]const u8 = null,
|
||||
|
@ -49,6 +49,7 @@ gameoflife_initial_density: f32 = 0.4,
|
|||
hide_borders: bool = false,
|
||||
hide_version_string: bool = false,
|
||||
hide_key_hints: bool = false,
|
||||
battery_id: ?[]const u8 = "BAT0",
|
||||
initial_info_text: ?[]const u8 = null,
|
||||
input_len: u8 = 34,
|
||||
lang: []const u8 = "en",
|
||||
|
|
|
@ -47,6 +47,7 @@ err_perm_group: []const u8 = "failed to downgrade group permissions",
|
|||
err_perm_user: []const u8 = "failed to downgrade user permissions",
|
||||
err_pwnam: []const u8 = "failed to get user info",
|
||||
err_sleep: []const u8 = "failed to execute sleep command",
|
||||
err_battery: []const u8 = "failed to load battery status",
|
||||
err_switch_tty: []const u8 = "failed to switch tty",
|
||||
err_tty_ctrl: []const u8 = "tty control transfer failed",
|
||||
err_no_users: []const u8 = "no users found",
|
||||
|
|
37
src/main.zig
37
src/main.zig
|
@ -33,7 +33,7 @@ const DisplayServer = enums.DisplayServer;
|
|||
const Entry = Environment.Entry;
|
||||
const termbox = interop.termbox;
|
||||
const temporary_allocator = std.heap.page_allocator;
|
||||
const ly_top_str = "Ly version " ++ build_options.version;
|
||||
const ly_version_str = "Ly version " ++ build_options.version;
|
||||
|
||||
var session_pid: std.posix.pid_t = -1;
|
||||
fn signalHandler(i: c_int) callconv(.c) void {
|
||||
|
@ -589,8 +589,23 @@ pub fn main() !void {
|
|||
if (!animation_timed_out) animation.draw();
|
||||
|
||||
if (!config.hide_version_string) {
|
||||
buffer.drawLabel(ly_top_str, length, 0);
|
||||
length += ly_top_str.len + 1;
|
||||
buffer.drawLabel(ly_version_str, 0, buffer.height - 1);
|
||||
}
|
||||
|
||||
var battery_bar_shown = false;
|
||||
if (config.battery_id) |id| draw_battery: {
|
||||
const battery_percentage = getBatteryPercentage(id) catch |err| {
|
||||
try log_writer.print("failed to get battery percentage: {s}\n", .{@errorName(err)});
|
||||
try info_line.addMessage(lang.err_battery, config.error_bg, config.error_fg);
|
||||
break :draw_battery;
|
||||
};
|
||||
|
||||
var battery_buf: [16:0]u8 = undefined;
|
||||
const battery_str = std.fmt.bufPrintZ(&battery_buf, "BAT: {d}%", .{battery_percentage}) catch break :draw_battery;
|
||||
|
||||
const battery_y: usize = if (config.hide_key_hints) 0 else 1;
|
||||
buffer.drawLabel(battery_str, 0, battery_y);
|
||||
battery_bar_shown = true;
|
||||
}
|
||||
|
||||
if (config.bigclock != .none and buffer.box_height + (bigclock.HEIGHT + 2) * 2 < buffer.height) {
|
||||
|
@ -1194,6 +1209,22 @@ fn adjustBrightness(allocator: std.mem.Allocator, cmd: []const u8) !void {
|
|||
}
|
||||
}
|
||||
|
||||
fn getBatteryPercentage(battery_id: []const u8) !u8 {
|
||||
const path = try std.fmt.allocPrint(temporary_allocator, "/sys/class/power_supply/{s}/capacity", .{battery_id});
|
||||
defer temporary_allocator.free(path);
|
||||
|
||||
const battery_file = try std.fs.cwd().openFile(path, .{});
|
||||
defer battery_file.close();
|
||||
|
||||
var buffer: [8]u8 = undefined;
|
||||
const bytes_read = try battery_file.read(&buffer);
|
||||
const capacity_str = buffer[0..bytes_read];
|
||||
|
||||
const trimmed = std.mem.trimRight(u8, capacity_str, "\n\r");
|
||||
|
||||
return try std.fmt.parseInt(u8, trimmed, 10);
|
||||
}
|
||||
|
||||
fn getAuthErrorMsg(err: anyerror, lang: Lang) []const u8 {
|
||||
return switch (err) {
|
||||
error.GetPasswordNameFailed => lang.err_pwnam,
|
||||
|
|
Loading…
Reference in New Issue