Merge branch 'master' into master

This commit is contained in:
Cavernosa 2022-06-07 23:58:13 +00:00 committed by GitHub
commit ccfb8438e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 75 additions and 41 deletions

View File

@ -1,3 +1,4 @@
# Ly - a TUI display manager # Ly - a TUI display manager
![Ly screenshot](https://user-images.githubusercontent.com/5473047/88958888-65efbf80-d2a1-11ea-8ae5-3f263bce9cce.png "Ly screenshot") ![Ly screenshot](https://user-images.githubusercontent.com/5473047/88958888-65efbf80-d2a1-11ea-8ae5-3f263bce9cce.png "Ly screenshot")
@ -34,9 +35,11 @@ The following desktop environments were tested with success
- qtile - qtile
- sway - sway
- xfce - xfce
- xmonad
- pantheon - pantheon
- maxx - maxx
- windowmaker - windowmaker
- spectrwm
Ly should work with any X desktop environment, and provides Ly should work with any X desktop environment, and provides
basic wayland support (sway works very well, for example). basic wayland support (sway works very well, for example).
@ -50,7 +53,12 @@ changing the source code won't be necessary :)
## Cloning and Compiling ## Cloning and Compiling
Clone the repository Clone the repository
``` ```
git clone --recurse-submodules https://github.com/nullgemm/ly.git git clone --recurse-submodules https://github.com/nullgemm/ly
```
Change the directory to ly
```
cd ly
``` ```
Compile Compile
@ -99,6 +107,12 @@ If you choose a tty that already has a login/getty running you have to disable t
sudo rc-update del agetty.tty1 sudo rc-update del agetty.tty1
``` ```
## Arch Linux Installation
From AUR:
```
yay -S ly
```
## Configuration ## Configuration
You can find all the configuration in `/etc/ly/config.ini`. You can find all the configuration in `/etc/ly/config.ini`.
The file is commented, and includes the default values. The file is commented, and includes the default values.

View File

@ -100,6 +100,9 @@
# xorg server command # xorg server command
#x_cmd = /usr/bin/X #x_cmd = /usr/bin/X
# xinitrc
#xinitrc = ~/.xinitrc
# xorg setup command # xorg setup command
#x_cmd_setup = /etc/ly/xsetup.sh #x_cmd_setup = /etc/ly/xsetup.sh

View File

@ -36,10 +36,10 @@ err_xsessions_dir = failed to find sessions folder
err_xsessions_open = failed to open sessions folder err_xsessions_open = failed to open sessions folder
f1 = F1 shutdown f1 = F1 shutdown
f2 = F2 reboot f2 = F2 reboot
login = login: login = login
logout = logged out logout = logged out
numlock = numlock numlock = numlock
password = password: password = password
shell = shell shell = shell
wayland = wayland wayland = wayland
xinitrc = xinitrc xinitrc = xinitrc

View File

@ -36,10 +36,10 @@ err_xsessions_dir = error al buscar la carpeta de sesiones
err_xsessions_open = error al abrir la carpeta de sesiones err_xsessions_open = error al abrir la carpeta de sesiones
f1 = F1 apagar f1 = F1 apagar
f2 = F2 reiniciar f2 = F2 reiniciar
login = iniciar sesion: login = iniciar sesion
logout = cerrar sesion logout = cerrar sesion
numlock = Bloq Num numlock = Bloq Num
password = contraseña: password = contraseña
shell = shell shell = shell
wayland = wayland wayland = wayland
xinitrc = xinitrc xinitrc = xinitrc

View File

@ -36,10 +36,10 @@ err_xsessions_dir = échec de la recherche du dossier de sessions
err_xsessions_open = échec de l'ouverture du dossier de sessions err_xsessions_open = échec de l'ouverture du dossier de sessions
f1 = F1 éteindre f1 = F1 éteindre
f2 = F2 redémarrer f2 = F2 redémarrer
login = identifiant : login = identifiant
logout = déconnection logout = déconnection
numlock = verr.num numlock = verr.num
password = mot de passe : password = mot de passe
shell = shell shell = shell
wayland = wayland wayland = wayland
xinitrc = xinitrc xinitrc = xinitrc

View File

@ -36,10 +36,10 @@ err_xsessions_dir = impossibile localizzare cartella sessioni
err_xsessions_open = impossibile aprire cartella sessioni err_xsessions_open = impossibile aprire cartella sessioni
f1 = F1 arresto f1 = F1 arresto
f2 = F2 riavvio f2 = F2 riavvio
login = username: login = username
logout = scollegato logout = scollegato
numlock = numlock numlock = numlock
password = password: password = password
shell = shell shell = shell
wayland = wayland wayland = wayland
xinitrc = xinitrc xinitrc = xinitrc

View File

@ -36,10 +36,10 @@ err_xsessions_dir = nie udało się znaleźć folderu sesji
err_xsessions_open = nie udało się otworzyć folderu sesji err_xsessions_open = nie udało się otworzyć folderu sesji
f1 = F1 wyłącz f1 = F1 wyłącz
f2 = F2 uruchom ponownie f2 = F2 uruchom ponownie
login = login: login = login
logout = wylogowano logout = wylogowano
numlock = numlock numlock = numlock
password = hasło: password = hasło
shell = powłoka shell = powłoka
wayland = wayland wayland = wayland
xinitrc = xinitrc xinitrc = xinitrc

View File

@ -36,10 +36,10 @@ err_xsessions_dir = não foi possível encontrar a pasta das sessões
err_xsessions_open = não foi possível abrir a pasta das sessões err_xsessions_open = não foi possível abrir a pasta das sessões
f1 = F1 desligar f1 = F1 desligar
f2 = F2 reiniciar f2 = F2 reiniciar
login = conectar: login = conectar
logout = desconectado logout = desconectado
numlock = numlock numlock = numlock
password = senha: password = senha
shell = shell shell = shell
wayland = wayland wayland = wayland
xinitrc = xinitrc xinitrc = xinitrc

View File

@ -36,10 +36,10 @@ err_perm_user = nu s-a putut face downgrade permisiunilor de utilizator
f1 = F1 opreşte sistemul f1 = F1 opreşte sistemul
f2 = F2 resetează f2 = F2 resetează
login = utilizator: login = utilizator
logout = opreşte sesiunea logout = opreşte sesiunea
numlock = numlock numlock = numlock
password = parolă: password = parolă
shell = shell shell = shell
wayland = wayland wayland = wayland
xinitrc = xinitrc xinitrc = xinitrc

View File

@ -36,10 +36,10 @@ err_xsessions_dir = не удалось найти сессионную папк
err_xsessions_open = не удалось открыть сессионную папку err_xsessions_open = не удалось открыть сессионную папку
f1 = F1 выключить f1 = F1 выключить
f2 = F2 перезагрузить f2 = F2 перезагрузить
login = логин: login = логин
logout = logged out logout = logged out
numlock = numlock numlock = numlock
password = пароль: password = пароль
shell = shell shell = shell
wayland = wayland wayland = wayland
xinitrc = xinitrc xinitrc = xinitrc

View File

@ -36,10 +36,10 @@ err_xsessions_dir = neuspijesno pronalazenje foldera sesija
err_xsessions_open = neuspijesno otvaranje foldera sesija err_xsessions_open = neuspijesno otvaranje foldera sesija
f1 = F1 ugasi f1 = F1 ugasi
f2 = F2 ponovo pokreni f2 = F2 ponovo pokreni
login = korisnik: login = korisnik
logout = izlogovan logout = izlogovan
numlock = numlock numlock = numlock
password = lozinka: password = lozinka
shell = shell shell = shell
wayland = wayland wayland = wayland
xinitrc = xinitrc xinitrc = xinitrc

View File

@ -190,6 +190,7 @@ void config_load(const char *cfg_path)
{"wayland_specifier", &config.wayland_specifier, config_handle_bool}, {"wayland_specifier", &config.wayland_specifier, config_handle_bool},
{"waylandsessions", &config.waylandsessions, config_handle_str}, {"waylandsessions", &config.waylandsessions, config_handle_str},
{"x_cmd", &config.x_cmd, config_handle_str}, {"x_cmd", &config.x_cmd, config_handle_str},
{"xinitrc", &config.xinitrc, config_handle_str},
{"x_cmd_setup", &config.x_cmd_setup, config_handle_str}, {"x_cmd_setup", &config.x_cmd_setup, config_handle_str},
{"xauth_cmd", &config.xauth_cmd, config_handle_str}, {"xauth_cmd", &config.xauth_cmd, config_handle_str},
{"xsessions", &config.xsessions, config_handle_str}, {"xsessions", &config.xsessions, config_handle_str},
@ -296,6 +297,7 @@ void config_defaults()
config.wayland_specifier = false; config.wayland_specifier = false;
config.waylandsessions = strdup("/usr/share/wayland-sessions"); config.waylandsessions = strdup("/usr/share/wayland-sessions");
config.x_cmd = strdup("/usr/bin/X"); config.x_cmd = strdup("/usr/bin/X");
config.xinitrc = strdup("~/.xinitrc");
config.x_cmd_setup = strdup(DATADIR "/xsetup.sh"); config.x_cmd_setup = strdup(DATADIR "/xsetup.sh");
config.xauth_cmd = strdup("/usr/bin/xauth"); config.xauth_cmd = strdup("/usr/bin/xauth");
config.xsessions = strdup("/usr/share/xsessions"); config.xsessions = strdup("/usr/share/xsessions");
@ -364,6 +366,7 @@ void config_free()
free(config.wayland_cmd); free(config.wayland_cmd);
free(config.waylandsessions); free(config.waylandsessions);
free(config.x_cmd); free(config.x_cmd);
free(config.xinitrc);
free(config.x_cmd_setup); free(config.x_cmd_setup);
free(config.xauth_cmd); free(config.xauth_cmd);
free(config.xsessions); free(config.xsessions);

View File

@ -94,6 +94,7 @@ struct config
bool wayland_specifier; bool wayland_specifier;
char* waylandsessions; char* waylandsessions;
char* x_cmd; char* x_cmd;
char* xinitrc;
char* x_cmd_setup; char* x_cmd_setup;
char* xauth_cmd; char* xauth_cmd;
char* xsessions; char* xsessions;

View File

@ -129,7 +129,7 @@ void draw_box(struct term_buf* buf)
struct tb_cell c1 = {buf->box_chars.top, config.fg, config.bg}; struct tb_cell c1 = {buf->box_chars.top, config.fg, config.bg};
struct tb_cell c2 = {buf->box_chars.bot, config.fg, config.bg}; struct tb_cell c2 = {buf->box_chars.bot, config.fg, config.bg};
for (uint8_t i = 0; i < buf->box_width; ++i) for (uint16_t i = 0; i < buf->box_width; ++i)
{ {
tb_put_cell( tb_put_cell(
box_x + i, box_x + i,
@ -145,7 +145,7 @@ void draw_box(struct term_buf* buf)
c1.ch = buf->box_chars.left; c1.ch = buf->box_chars.left;
c2.ch = buf->box_chars.right; c2.ch = buf->box_chars.right;
for (uint8_t i = 0; i < buf->box_height; ++i) for (uint16_t i = 0; i < buf->box_height; ++i)
{ {
tb_put_cell( tb_put_cell(
box_x - 1, box_x - 1,
@ -163,9 +163,9 @@ void draw_box(struct term_buf* buf)
{ {
struct tb_cell blank = {' ', config.fg, config.bg}; struct tb_cell blank = {' ', config.fg, config.bg};
for (uint8_t i = 0; i < buf->box_height; ++i) for (uint16_t i = 0; i < buf->box_height; ++i)
{ {
for (uint8_t k = 0; k < buf->box_width; ++k) for (uint16_t k = 0; k < buf->box_width; ++k)
{ {
tb_put_cell( tb_put_cell(
box_x + k, box_x + k,

View File

@ -82,7 +82,7 @@ void input_desktop(struct desktop* target)
target->len = 0; target->len = 0;
input_desktop_add(target, strdup(lang.shell), strdup(""), DS_SHELL); input_desktop_add(target, strdup(lang.shell), strdup(""), DS_SHELL);
input_desktop_add(target, strdup(lang.xinitrc), strdup("~/.xinitrc"), DS_XINITRC); input_desktop_add(target, strdup(lang.xinitrc), strdup(config.xinitrc), DS_XINITRC);
#if 0 #if 0
input_desktop_add(target, strdup(lang.wayland), strdup(""), DS_WAYLAND); input_desktop_add(target, strdup(lang.wayland), strdup(""), DS_WAYLAND);
#endif #endif

View File

@ -300,10 +300,31 @@ void remove_utmp_entry(struct utmp *entry) {
endutent(); endutent();
} }
void xauth(const char* display_name, const char* shell, const char* dir) void xauth(const char* display_name, const char* shell, char* pwd)
{ {
const char* xauth_file = ".lyxauth";
char* xauth_dir = getenv("XDG_RUNTIME_DIR");
if ((xauth_dir == NULL) || (*xauth_dir == '\0'))
{
xauth_dir = getenv("XDG_CONFIG_DIR");
if ((xauth_dir == NULL) || (*xauth_dir == '\0'))
{
xauth_dir = pwd;
xauth_file = "lyxauth";
}
}
else
{
xauth_file = "lyxauth";
}
// trim trailing slashes
int i = strlen(xauth_dir) - 1;
while (xauth_dir[i] == '/') i--;
xauth_dir[i + 1] = '\0';
char xauthority[256]; char xauthority[256];
snprintf(xauthority, 256, "%s/%s", dir, ".lyxauth"); snprintf(xauthority, 256, "%s/%s", xauth_dir, xauth_file);
setenv("XAUTHORITY", xauthority, 1); setenv("XAUTHORITY", xauthority, 1);
setenv("DISPLAY", display_name, 1); setenv("DISPLAY", display_name, 1);
@ -339,18 +360,10 @@ void xorg(
const char* vt, const char* vt,
const char* desktop_cmd) const char* desktop_cmd)
{ {
// generate xauthority file
const char* xauth_dir = getenv("XDG_CONFIG_HOME");
if ((xauth_dir == NULL) || (*xauth_dir == '\0'))
{
xauth_dir = pwd->pw_dir;
}
char display_name[4]; char display_name[4];
snprintf(display_name, 3, ":%d", get_free_display()); snprintf(display_name, 3, ":%d", get_free_display());
xauth(display_name, pwd->pw_shell, xauth_dir); xauth(display_name, pwd->pw_shell, pwd->pw_dir);
// start xorg // start xorg
pid_t pid = fork(); pid_t pid = fork();
@ -530,7 +543,7 @@ void auth(
if (pwd->pw_shell[0] == '\0') if (pwd->pw_shell[0] == '\0')
{ {
setusershell(); setusershell();
char* shell = getusershell(); char* shell = getusershell();
if (shell != NULL) if (shell != NULL)
@ -551,7 +564,7 @@ void auth(
if (pid == 0) if (pid == 0)
{ {
// set user info // set user info
ok = initgroups(pwd->pw_name, pwd->pw_gid); ok = initgroups(pwd->pw_name, pwd->pw_gid);
if (ok != 0) if (ok != 0)
@ -657,21 +670,21 @@ void auth(
// close pam session // close pam session
ok = pam_do(pam_close_session, handle, 0, buf); ok = pam_do(pam_close_session, handle, 0, buf);
if (ok != PAM_SUCCESS) if (ok != PAM_SUCCESS)
{ {
return; return;
} }
ok = pam_do(pam_setcred, handle, PAM_DELETE_CRED, buf); ok = pam_do(pam_setcred, handle, PAM_DELETE_CRED, buf);
if (ok != PAM_SUCCESS) if (ok != PAM_SUCCESS)
{ {
return; return;
} }
ok = pam_end(handle, 0); ok = pam_end(handle, 0);
if (ok != PAM_SUCCESS) if (ok != PAM_SUCCESS)
{ {
pam_diagnose(ok, buf); pam_diagnose(ok, buf);

View File

@ -28,7 +28,7 @@ struct config config;
// args handles // args handles
void arg_help(void* data, char** pars, const int pars_count) void arg_help(void* data, char** pars, const int pars_count)
{ {
printf("RTFM\n"); printf("If you want to configure Ly, please check the config file, usually located at /etc/ly/config.ini.\n");
} }
void arg_version(void* data, char** pars, const int pars_count) void arg_version(void* data, char** pars, const int pars_count)