26 Commits

Author SHA1 Message Date
Leon Grünewald
271b4f8898 Add more files for labels 2021-02-14 14:59:59 +01:00
Leon Grünewald
552d533435 Try to fix path 2021-02-14 14:39:48 +01:00
Leon Grünewald
9d774d93c5 Add name to install 2021-02-14 14:10:04 +01:00
Leon Grünewald
90f18e9b34 We can't relabel nonexistant files anyway 2021-02-14 13:51:04 +01:00
Leon Grünewald
ccb9dfabc5 Move package somewhere else for install 2021-02-14 13:48:51 +01:00
Leon Grünewald
4ba42400ce Use install instead of cp 1 2021-02-11 22:50:10 +01:00
Leon Grünewald
b336b70605 Remove versioning on git clone 2021-02-10 01:52:38 +01:00
Leon Grünewald
9c70ff5576 Add selinux policy tools to needed packages 2021-02-10 01:47:30 +01:00
Leon Grünewald
ec230541f3 Use make selinux macros 2021-02-10 01:46:15 +01:00
Leon Grünewald
d2fcb2e87d Rename target 2021-02-10 01:37:52 +01:00
Leon Grünewald
96a556a345 Move the pp file into the right folder 2021-02-10 01:32:09 +01:00
Leon Grünewald
f79330cda3 Add installselinux to spec.rpkg 2021-02-10 01:23:03 +01:00
Leon Grünewald
3deedba040 WIP SELinux 2021-02-10 01:21:16 +01:00
Leon Grünewald
dfe918358e Add gcc 2021-02-08 03:51:05 +01:00
Leon Grünewald
cd738eafa7 Actually push git before trying to build 2021-02-08 03:46:08 +01:00
Leon Grünewald
289624bc88 Test src stuff 2021-02-08 03:35:45 +01:00
Leon Grünewald
7d4b25fc70 Dont remove spec file 2021-02-08 03:25:55 +01:00
Leon Grünewald
b8b31386e1 move to rpkg again but this time remove setup 2021-02-08 03:06:01 +01:00
Leon Grünewald
a14e6b5224 Just copy everything from github at that point 2021-02-08 02:54:25 +01:00
Leon Grünewald
16922531e2 cd to spec first 2021-02-08 02:34:24 +01:00
Leon Grünewald
5c04c996d5 This makes some more sense now 2021-02-08 02:19:24 +01:00
Leon Grünewald
a7dedbab1b Just the rpmbuild 2021-02-08 01:52:05 +01:00
Leon Grünewald
1926901eda Fix it up 2021-02-08 01:47:01 +01:00
Leon Grünewald
43a40faf79 Build Requires make 2021-02-08 00:58:17 +01:00
Leon Grünewald
974aca51cb Turn into ly.spec.rpkg 2021-02-08 00:33:35 +01:00
Leon Grünewald
6ac03ab27e Add basic spec file and selinux module source 2021-02-08 00:13:19 +01:00
47 changed files with 510 additions and 1567 deletions

4
.copr/Makefile Normal file
View File

@@ -0,0 +1,4 @@
srpm:
cd $(spec)
make github
rpmbuild -vv -bs ly.spec --define "_srcrpmdir $(outdir)"

15
.gitea Normal file
View File

@@ -0,0 +1,15 @@
[submodule "sub/argoat"]
path = sub/argoat
url = https://git.nullgemm.fr/nullgemm/argoat.git
[submodule "sub/configator"]
path = sub/configator
url = https://git.nullgemm.fr/nullgemm/configator.git
[submodule "sub/ctypes"]
path = sub/ctypes
url = https://git.nullgemm.fr/nullgemm/ctypes.git
[submodule "sub/dragonfail"]
path = sub/dragonfail
url = https://git.nullgemm.fr/nullgemm/dragonfail.git
[submodule "sub/termbox_next"]
path = sub/termbox_next
url = https://git.nullgemm.fr/nullgemm/termbox_next.git

View File

@@ -4,6 +4,9 @@
[submodule "sub/configator"] [submodule "sub/configator"]
path = sub/configator path = sub/configator
url = https://github.com/nullgemm/configator.git url = https://github.com/nullgemm/configator.git
[submodule "sub/ctypes"]
path = sub/ctypes
url = https://github.com/nullgemm/ctypes.git
[submodule "sub/dragonfail"] [submodule "sub/dragonfail"]
path = sub/dragonfail path = sub/dragonfail
url = https://github.com/nullgemm/dragonfail.git url = https://github.com/nullgemm/dragonfail.git

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
bin bin
obj obj
.gitmodules
valgrind.log valgrind.log

78
ly.spec.rpkg Normal file
View File

@@ -0,0 +1,78 @@
%define relabel_files() \
restorecon -R /usr/bin/ly; \
%define selinux_policyver 3.14.6-34
Name: {{{ git_dir_name }}}
Version: {{{ git_dir_version }}}
Release: 1%{?dist}
Summary: A TUI display manager
License: WTFPL
URL: https://github.com/nullgemm/ly
VCS: {{{ git_dir_vcs }}}
Source: {{{ git_dir_pack }}}
BuildRequires: libxcb-devel
BuildRequires: pam-devel
BuildRequires: make
BuildRequires: git
BuildRequires: gcc
BuildRequires: selinux-policy-devel
Requires: libxcb
Requires: pam
%description
Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD.
%prep
git clone https://github.com/dhalucario/ly.git ly
cd ly
# git checkout v0.5.2
make github
%build
cd ly
make
%install
cd ly
mkdir -p %{buildroot}/etc/
mkdir -p %{buildroot}/usr/bin/
mkdir -p %{buildroot}/usr/lib/systemd/system/
mkdir -p %{buildroot}/etc/pam.d/
DESTDIR="%{buildroot}" make install
DESTDIR="%{buildroot}" make installselinux
chmod -x %{buildroot}/etc/ly/config.ini
chmod -x %{buildroot}/etc/ly/lang/*
%post
semodule -n -i /usr/share/selinux/packages/ly.pp
if /usr/sbin/selinuxenabled ; then
/usr/sbin/load_policy
%relabel_files
fi;
exit 0
%postun
if [ $1 -eq 0 ]; then
semodule -n -r ly
fi;
exit 0
%files
/usr/bin/ly
/usr/lib/systemd/system/ly.service
/etc/ly/lang/es.ini
/etc/ly/lang/pt.ini
/etc/ly/lang/ru.ini
/etc/ly/lang/en.ini
/etc/ly/lang/fr.ini
/etc/ly/lang/ro.ini
/etc/ly/xsetup.sh
/etc/ly/wsetup.sh
/etc/ly/config.ini
/etc/pam.d/ly
/usr/share/selinux/packages/ly.pp
%changelog
{{{ git_dir_changelog }}}

View File

@@ -3,7 +3,7 @@ CC = gcc
FLAGS = -std=c99 -pedantic -g FLAGS = -std=c99 -pedantic -g
FLAGS+= -Wall -Wextra -Werror=vla -Wno-unused-parameter FLAGS+= -Wall -Wextra -Werror=vla -Wno-unused-parameter
#FLAGS+= -DDEBUG #FLAGS+= -DDEBUG
FLAGS+= -DLY_VERSION=\"$(shell git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')\" FLAGS+= -DGIT_VERSION_STRING=\"$(shell git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')\"
LINK = -lpam -lxcb LINK = -lpam -lxcb
VALGRIND = --show-leak-kinds=all --track-origins=yes --leak-check=full --suppressions=../res/valgrind.supp VALGRIND = --show-leak-kinds=all --track-origins=yes --leak-check=full --suppressions=../res/valgrind.supp
CMD = ./$(NAME) CMD = ./$(NAME)
@@ -70,7 +70,7 @@ leakgrind: $(BIND)/$(NAME)
@less valgrind.log @less valgrind.log
install: $(BIND)/$(NAME) install: $(BIND)/$(NAME)
@echo "installing ly" @echo "installing"
@install -dZ ${DESTDIR}/etc/ly @install -dZ ${DESTDIR}/etc/ly
@install -DZ $(BIND)/$(NAME) -t ${DESTDIR}/usr/bin @install -DZ $(BIND)/$(NAME) -t ${DESTDIR}/usr/bin
@install -DZ $(RESD)/config.ini -t ${DESTDIR}/etc/ly @install -DZ $(RESD)/config.ini -t ${DESTDIR}/etc/ly
@@ -78,29 +78,24 @@ install: $(BIND)/$(NAME)
@install -DZ $(RESD)/wsetup.sh -t $(DATADIR) @install -DZ $(RESD)/wsetup.sh -t $(DATADIR)
@install -dZ $(DATADIR)/lang @install -dZ $(DATADIR)/lang
@install -DZ $(RESD)/lang/* -t $(DATADIR)/lang @install -DZ $(RESD)/lang/* -t $(DATADIR)/lang
@install -DZ $(RESD)/ly.service -m 644 -t ${DESTDIR}/usr/lib/systemd/system
@install -DZ $(RESD)/pam.d/ly -m 644 -t ${DESTDIR}/etc/pam.d @install -DZ $(RESD)/pam.d/ly -m 644 -t ${DESTDIR}/etc/pam.d
installnoconf: $(BIND)/$(NAME) installnoconf: $(BIND)/$(NAME)
@echo "installing ly without the configuration file" @echo "installing without the configuration file"
@install -dZ ${DESTDIR}/etc/ly @install -dZ ${DESTDIR}/etc/ly
@install -DZ $(BIND)/$(NAME) -t ${DESTDIR}/usr/bin @install -DZ $(BIND)/$(NAME) -t ${DESTDIR}/usr/bin
@install -DZ $(RESD)/xsetup.sh -t $(DATADIR) @install -DZ $(RESD)/xsetup.sh -t $(DATADIR)
@install -DZ $(RESD)/wsetup.sh -t $(DATADIR) @install -DZ $(RESD)/wsetup.sh -t $(DATADIR)
@install -dZ $(DATADIR)/lang @install -dZ $(DATADIR)/lang
@install -DZ $(RESD)/lang/* -t $(DATADIR)/lang @install -DZ $(RESD)/lang/* -t $(DATADIR)/lang
@install -DZ $(RESD)/ly.service -m 644 -t ${DESTDIR}/usr/lib/systemd/system
@install -DZ $(RESD)/pam.d/ly -m 644 -t ${DESTDIR}/etc/pam.d @install -DZ $(RESD)/pam.d/ly -m 644 -t ${DESTDIR}/etc/pam.d
installsystemd: installselinux:
@echo "installing systemd service" @echo "installing selinux modules"
@install -DZ $(RESD)/ly.service -m 644 -t ${DESTDIR}/usr/lib/systemd/system @make -f /usr/share/selinux/devel/Makefile ly.pp
@install -DZ ly.pp ${DESTDIR}/usr/share/selinux/packages/ly.pp
installopenrc:
@echo "installing openrc service"
@install -DZ $(RESD)/ly-openrc -m 755 -T ${DESTDIR}/etc/init.d/${NAME}
installrunit:
@echo "installing runit service"
@install -DZ $(RESD)/ly-runit-service/* -t ${DESTDIR}/etc/sv/ly
uninstall: uninstall:
@echo "uninstalling" @echo "uninstalling"
@@ -109,10 +104,29 @@ uninstall:
@rm -f ${DESTDIR}/usr/bin/ly @rm -f ${DESTDIR}/usr/bin/ly
@rm -f ${DESTDIR}/usr/lib/systemd/system/ly.service @rm -f ${DESTDIR}/usr/lib/systemd/system/ly.service
@rm -f ${DESTDIR}/etc/pam.d/ly @rm -f ${DESTDIR}/etc/pam.d/ly
@rm -f ${DESTDIR}/etc/init.d/${NAME}
@rm -rf ${DESTDIR}/etc/sv/ly
clean: clean:
@echo "cleaning" @echo "cleaning"
@rm -rf $(BIND) $(OBJD) valgrind.log @rm -rf $(BIND) $(OBJD) valgrind.log
@(cd $(SUBD)/termbox_next && $(MAKE) clean) @(cd $(SUBD)/termbox_next && $(MAKE) clean)
remotes:
@echo "registering remotes"
@git remote add github git@github.com:nullgemm/$(NAME).git
@git remote add gitea ssh://git@git.nullgem.fr:2999/nullgemm/$(NAME).git
github:
@echo "sourcing submodules from https://github.com"
@cp .github .gitmodules
@git submodule sync
@git submodule update --init --remote
@cd $(SUBD)/argoat && make github
@git submodule update --init --recursive --remote
gitea:
@echo "sourcing submodules from personal server"
@cp .gitea .gitmodules
@git submodule sync
@git submodule update --init --remote
@cd $(SUBD)/argoat && make gitea
@git submodule update --init --recursive --remote

View File

@@ -1,4 +1,3 @@
# 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")
@@ -16,34 +15,25 @@ Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD.
- tput - tput
- shutdown - shutdown
On Debian-based distros running `apt install build-essential libpam0g-dev libxcb-xkb-dev` as root should install all the dependencies for you. On Debian-based distros running `apt install build-essential libpam0g-dev libxcb-xkb-dev` as root should install all the dependencies for you.
For Fedora try running `dnf install make automake gcc gcc-c++ kernel-devel pam-devel libxcb-devel`
## Support ## Support
The following desktop environments were tested with success The following desktop environments were tested with success
- awesome
- bspwm
- budgie - budgie
- cinnamon - cinnamon
- deepin - deepin
- dwm
- enlightenment - enlightenment
- gnome - gnome
- i3 - i3
- kde - kde
- labwc
- lxde - lxde
- lxqt - lxqt
- mate - mate
- maxx
- pantheon
- qtile
- spectrwm
- sway - sway
- windowmaker
- xfce - xfce
- xmonad - pantheon
- maxx
- windowmaker
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).
@@ -57,88 +47,39 @@ 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/fairyglade/ly git clone https://github.com/nullgemm/ly.git
``` ```
Change the directory to ly Fetch submodules
``` ```
$ cd ly make github
``` ```
Compile Compile
``` ```
$ make make
``` ```
Test in the configured tty (tty2 by default) Test in the configured tty (tty2 by default)
or a terminal emulator (but desktop environments won't start) or a terminal emulator (but desktop environments won't start)
``` ```
# make run sudo make run
``` ```
Install Ly and the provided systemd service file Install Ly and the provided systemd service file
``` ```
# make install installsystemd sudo make install
``` ```
Enable the service Enable the service
``` ```
# systemctl enable ly.service sudo systemctl enable ly.service
``` ```
If you need to switch between ttys after Ly's start you also have to If you need to switch between ttys after Ly's start you also have to
disable getty on Ly's tty to prevent "login" from spawning on top of it disable getty on Ly's tty to prevent "login" from spawning on top of it
``` ```
# systemctl disable getty@tty2.service sudo systemctl disable getty@tty2.service
```
### OpenRC
Clone, compile and test.
Install Ly and the provided OpenRC service
```
# make install installopenrc
```
Enable the service
```
# rc-update add ly
```
You can edit which tty Ly will start on by editing the `tty` option in the configuration file.
If you choose a tty that already has a login/getty running (has a basic login prompt), then you have to disable the getty so it doesn't respawn on top of ly
```
# rc-update del agetty.tty2
```
### runit
```
$ make
# make install installrunit
# ln -s /etc/sv/ly /var/service/
```
By default, ly will run on tty2. To change the tty it must be set in `/etc/ly/config.ini`
You should as well disable your existing display manager service if needed, e.g.:
```
# rm /var/service/lxdm
```
The agetty service for the tty console where you are running ly should be disabled. For instance, if you are running ly on tty2 (that's the default, check your `/etc/ly/config.ini`) you should disable the agetty-tty2 service like this:
```
# rm /var/service/agetty-tty2
```
## Arch Linux Installation
You can install ly from the [`[extra]` repos](https://archlinux.org/packages/extra/x86_64/ly/):
```
$ sudo pacman -S ly
``` ```
## Configuration ## Configuration
@@ -153,10 +94,12 @@ while on the desktop field (above the login field).
## .xinitrc ## .xinitrc
If your .xinitrc doesn't work make sure it is executable and includes a shebang. If your .xinitrc doesn't work make sure it is executable and includes a shebang.
This file is supposed to be a shell script! Quoting from xinit's man page: This file is supposed to be a shell script! Quoting from xinit's man page:
```
> If no specific client program is given on the command line, xinit will look for a file in the user's home directory called .xinitrc to run as a shell script to start up client programs. If no specific client program is given on the command line, xinit will look for
a file in the user's home directory called .xinitrc to run as a shell script to
On Arch Linux, the example .xinitrc (/etc/X11/xinit/xinitrc) starts like this: start up client programs.
```
On ArchLinux, the example .xinitrc (/etc/X11/xinit/xinitrc) starts like this:
``` ```
#!/bin/sh #!/bin/sh
``` ```

View File

@@ -1,140 +1,104 @@
# Animation enabled/disabled # animation enabled
#animate = false #animate = false
#animate = true
# The active animation # the active animation (only animation '0' available for now)
# 0 -> PSX DOOM fire (default)
# 1 -> CMatrix
#animation = 0 #animation = 0
# format string for clock in top right corner (see strftime specification) # the char used to mask the password
#clock = %c
# enable/disable big clock
#bigclock = true
# The character used to mask the password
#asterisk = * #asterisk = *
#asterisk = o
# Erase password input on failure # background color id
#blank_password = false
#The `fg` and `bg` color settings take a digit 0-8 corresponding to:
#define TB_DEFAULT 0x00
#define TB_BLACK 0x01
#define TB_RED 0x02
#define TB_GREEN 0x03
#define TB_YELLOW 0x04
#define TB_BLUE 0x05
#define TB_MAGENTA 0x06
#define TB_CYAN 0x07
#define TB_WHITE 0x08
#
# Setting both to zero makes `bg` black and `fg` white. To set the actual color palette you are encouraged to use another tool
# such as [mkinitcpio-colors](https://github.com/evanpurkhiser/mkinitcpio-colors). Note that the color palette defined with
# `mkinitcpio-colors` takes 16 colors (0-15), only values 0-8 are valid for `ly` config and these values do not correspond
# exactly. For instance, in defining palettes with `mkinitcpio-colors` the order is black, dark red, dark green, brown, dark
# blue, dark purple, dark cyan, light gray, dark gray, bright red, bright green, yellow, bright blue, bright purple, bright
# cyan, and white, indexed in that order 0 through 15. For example, the color defined for white (indexed at 15 in the mkinitcpio
# config) will be used by `ly` for `fg = 8`.
# Background color id
#bg = 0 #bg = 0
# Foreground color id # blank main box
#fg = 9
# Blank main box background
# Setting to false will make it transparent
#blank_box = true #blank_box = true
# Remove main box borders # erase password input on failure
#hide_borders = false #blank_password = false
#blank_password = true
# Main box margins # console path
#console_dev = /dev/console
# input active by default on startup
#default_input = 2
# foreground color id
#fg = 9
# remove main box borders
#hide_borders = false
#hide_borders = true
# number of visible chars on an input
#input_len = 34
# active language
#lang = en
#lang = fr
# load the saved desktop and login
#load = true
# main box margins
#margin_box_h = 2 #margin_box_h = 2
#margin_box_v = 1 #margin_box_v = 1
# Input boxes length # total input sizes
#input_len = 34
# Max input sizes
#max_desktop_len = 100 #max_desktop_len = 100
#max_login_len = 255 #max_login_len = 255
#max_password_len = 255 #max_password_len = 255
# cookie generator
#mcookie_cmd = /usr/bin/mcookie
# Input box active by default on startup # event timeout in milliseconds
#default_input = 2 #min_refresh_delta = 5
# Load the saved desktop and username # default path
#load = true #path = /sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin
# Save the current desktop and login as defaults # command executed when pressing F2
#save = true
# File in which to save and load the default desktop and login
#save_file = /etc/ly/save
# Remove F1/F2 command hints
#hide_f1_commands = false
# Command executed when pressing F1
#shutdown_cmd = /sbin/shutdown -a now
# Command executed when pressing F2
#restart_cmd = /sbin/shutdown -r now #restart_cmd = /sbin/shutdown -r now
# save the current desktop and login as defaults
#save = true
# Active language # file in which to save and load the default desktop and login
# Available languages are found in /etc/ly/lang/ #save_file = /etc/ly/save
#lang = en
# service name (set to ly to use the provided pam config file)
#service_name = ly
# command executed when pressing F1
#shutdown_cmd = /sbin/shutdown -a now
# terminal reset command (tput is faster)
#term_reset_cmd = /usr/bin/tput reset
# tty in use # tty in use
#tty = 2 #tty = 2
# Console path # wayland setup command
#console_dev = /dev/console
# Default path
#path = /sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin
# Event timeout in milliseconds
#min_refresh_delta = 5
# Service name (set to ly to use the provided pam config file)
#service_name = ly
# Terminal reset command (tput is faster)
#term_reset_cmd = /usr/bin/tput reset
# Cookie generator
#mcookie_cmd = /usr/bin/mcookie
# Wayland setup command
#wayland_cmd = /etc/ly/wsetup.sh #wayland_cmd = /etc/ly/wsetup.sh
# Add wayland specifier to session names # add wayland specifier to session names
#wayland_specifier = false #wayland_specifier = false
#wayland_specifier = true
# Wayland desktop environments # wayland desktop environments
#waylandsessions = /usr/share/wayland-sessions #waylandsessions = /usr/share/wayland-sessions
# xorg server command
# xinitrc
#xinitrc = ~/.xinitrc
# Xorg server command
#x_cmd = /usr/bin/X #x_cmd = /usr/bin/X
# Xorg setup command # xorg setup command
#x_cmd_setup = /etc/ly/xsetup.sh #x_cmd_setup = /etc/ly/xsetup.sh
# Xorg xauthority edition tool # xorg xauthority edition tool
#xauth_cmd = /usr/bin/xauth #xauth_cmd = /usr/bin/xauth
# Xorg desktop environments # xorg desktop environments
#xsessions = /usr/share/xsessions #xsessions = /usr/share/xsessions

View File

@@ -1,45 +0,0 @@
capslock = Bloq Majús
err_alloc = falla d'assignació de memòria
err_bounds = índex fora de límit
err_chdir = error al obrir carpeta home
err_console_dev = error al accedir a la consola
err_dgn_oob = missatge de registre
err_domain = domini invàlid
err_hostname = error al obtenir el nom del host
err_mlock = error al bloquejar la clau de memòria
err_null = punter nul
err_pam = error en la transacció pam
err_pam_abort = transacció pam avortada
err_pam_acct_expired = compte expirat
err_pam_auth = error d'autenticació
err_pam_authinfo_unavail = error al obtenir informació de l'usuari
err_pam_authok_reqd = token expirat
err_pam_buf = error de la memòria intermitja
err_pam_cred_err = error al establir les credencials
err_pam_cred_expired = credencials expirades
err_pam_cred_insufficient = credencials insuficients
err_pam_cred_unavail = error al obtenir credencials
err_pam_maxtries = s'ha assolit al màxim nombre d'intents
err_pam_perm_denied = permís denegat
err_pam_session = error de sessió
err_pam_sys = error de sistema
err_pam_user_unknown = usuari desconegut
err_path = error al establir la ruta
err_perm_dir = error al canviar de directori actual
err_perm_group = error al degradar els permisos de grup
err_perm_user = error al degradar els permisos de l'usuari
err_pwnam = error al obtenir la informació de l'usuari
err_user_gid = error al establir el GID de l'usuari
err_user_init = error al inicialitzar usuari
err_user_uid = error al establir el UID de l'usuari
err_xsessions_dir = error al cercar la carpeta de sessions
err_xsessions_open = error al obrir la carpeta de sessions
f1 = F1 aturar
f2 = F2 reiniciar
login = iniciar sessió
logout = tancar sessió
numlock = Bloq Num
password = Clau
shell = shell
wayland = wayland
xinitrc = xinitrc

View File

@@ -1,45 +0,0 @@
capslock = capslock
err_alloc = alokace paměti selhala
err_bounds = index je mimo hranice pole
err_chdir = nelze otevřít domovský adresář
err_console_dev = chyba při přístupi do konzole
err_dgn_oob = zpráva protokolu
err_domain = neplatná doména
err_hostname = nelze získat název hostitele
err_mlock = uzamčení paměti hesel selhalo
err_null = nulový ukazatel
err_pam = pam transakce selhala
err_pam_abort = pam transakce přerušena
err_pam_acct_expired = platnost účtu vypršela
err_pam_auth = chyba autentizace
err_pam_authinfo_unavail = nelze získat informace o uživateli
err_pam_authok_reqd = platnost tokenu vypršela
err_pam_buf = chyba vyrovnávací paměti
err_pam_cred_err = nelze nastavit pověření
err_pam_cred_expired = platnost pověření vypršela
err_pam_cred_insufficient = nedostatečné pověření
err_pam_cred_unavail = nepodařilo se získat pověření
err_pam_maxtries = byl dosažen maximální počet pokusů
err_pam_perm_denied = přístup odepřen
err_pam_session = chyba relace
err_pam_sys = systemová chyba
err_pam_user_unknown = neznámý uživatel
err_path = nepodařilo se nastavit cestu
err_perm_dir = nepodařilo se změnit adresář
err_perm_group = nepodařilo se snížit skupinová oprávnění
err_perm_user = nepodařilo se snížit uživatelská oprávnění
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
err_xsessions_dir = nepodařilo se najít složku relací
err_xsessions_open = nepodařilo se otevřít složku relací
f1 = F1 vypnout
f2 = F2 restartovat
login = uživatel
logout = odhlášen
numlock = numlock
password = heslo
shell = příkazový řádek
wayland = wayland
xinitrc = xinitrc

View File

@@ -1,45 +0,0 @@
capslock = Feststelltaste
err_alloc = Speicherzuweisung fehlgeschlagen
err_bounds = Listenindex ist außerhalb des Bereichs
err_chdir = Fehler beim oeffnen des home-ordners
err_console_dev = Zugriff auf die Konsole fehlgeschlagen
err_dgn_oob = Protokoll Nachricht
err_domain = Unzulaessige domain
err_hostname = Holen des Hostnames fehlgeschlagen
err_mlock = Abschließen des Passwortspeichers fehlgeschlagen
err_null = Null Zeiger
err_pam = pam Transaktion fehlgeschlagen
err_pam_abort = pam Transaktion abgebrochen
err_pam_acct_expired = Benutzerkonto abgelaufen
err_pam_auth = Authentifizierungs Fehler
err_pam_authinfo_unavail = holen der Benutzerinformationen fehlgeschlagen
err_pam_authok_reqd = Schluessel abgelaufen
err_pam_buf = Speicherpufferfehler
err_pam_cred_err = Fehler beim setzen der Anmeldedaten
err_pam_cred_expired = Anmeldedaten abgelaufen
err_pam_cred_insufficient = Anmeldedaten unzureichend
err_pam_cred_unavail = Fehler beim holen der Anmeldedaten
err_pam_maxtries = Maximale Versuche erreicht
err_pam_perm_denied = Zugriff Verweigert
err_pam_session = Sitzungsfehler
err_pam_sys = Systemfehler
err_pam_user_unknown = Unbekannter Nutzer
err_path = Fehler beim setzen des Pfades
err_perm_dir = Fehler beim wechseln des Ordners
err_perm_group = Fehler beim heruntersetzen der Gruppen Berechtigungen
err_perm_user = Fehler beim heruntersetzen der Nutzer Berechtigungen
err_pwnam = Holen der Benutzerinformationen fehlgeschlagen
err_user_gid = Fehler beim setzen der Gruppen Id des Nutzers
err_user_init = Initialisierung des Nutzers fehlgeschlagen
err_user_uid = Setzen der Benutzer Id fehlgeschlagen
err_xsessions_dir = Fehler beim finden des Sitzungsordners
err_xsessions_open = Fehler beim öffnen des Sitzungsordners
f1 = F1 Herunterfahren
f2 = F2 Neustarten
login = Anmelden
logout = Abgemeldet
numlock = Numtaste
password = Passwort
shell = shell
wayland = wayland
xinitrc = xinitrc

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

@@ -15,7 +15,7 @@ err_pam_auth = error de autenticación
err_pam_authinfo_unavail = error al obtener información del usuario err_pam_authinfo_unavail = error al obtener información del usuario
err_pam_authok_reqd = token expirado err_pam_authok_reqd = token expirado
err_pam_buf = error de la memoria intermedia err_pam_buf = error de la memoria intermedia
err_pam_cred_err = error al establecer las credenciales err_pam_cred_err = error al establecer la credenciales
err_pam_cred_expired = credenciales expiradas err_pam_cred_expired = credenciales expiradas
err_pam_cred_insufficient = credenciales insuficientes err_pam_cred_insufficient = credenciales insuficientes
err_pam_cred_unavail = error al obtener credenciales err_pam_cred_unavail = error al obtener credenciales
@@ -30,16 +30,16 @@ err_perm_group = error al degradar los permisos del grupo
err_perm_user = error al degradar los permisos del usuario err_perm_user = error al degradar los permisos del usuario
err_pwnam = error al obtener la información del usuario err_pwnam = error al obtener la información del usuario
err_user_gid = error al establecer el GID del usuario err_user_gid = error al establecer el GID del usuario
err_user_init = error al inicializar usuario err_user_init = errpr al inicializar usuario
err_user_uid = error al establecer el UID del usuario err_user_uid = error al establecer el UID del usuario
err_xsessions_dir = error al buscar la carpeta de sesiones 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 sesión login = iniciar sesion:
logout = cerrar sesión 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

@@ -5,7 +5,7 @@ err_chdir = échec de l'ouverture du répertoire home
err_console_dev = échec d'accès à la console err_console_dev = échec d'accès à la console
err_dgn_oob = message err_dgn_oob = message
err_domain = domaine invalide err_domain = domaine invalide
err_hostname = échec de lecture du nom d'hôte err_hostname = échec de captation du nom d'hôte
err_mlock = échec du verrouillage mémoire err_mlock = échec du verrouillage mémoire
err_null = pointeur null err_null = pointeur null
err_pam = échec de la transaction pam err_pam = échec de la transaction pam
@@ -28,7 +28,7 @@ err_path = échec de la modification du path
err_perm_dir = échec de changement de répertoire err_perm_dir = échec de changement de répertoire
err_perm_group = échec du déclassement des permissions de groupe err_perm_group = échec du déclassement des permissions de groupe
err_perm_user = échec du déclassement des permissions utilisateur err_perm_user = échec du déclassement des permissions utilisateur
err_pwnam = échec de lecture des infos utilisateur err_pwnam = échec de captation des infos utilisateur
err_user_gid = échec de modification du GID err_user_gid = échec de modification du GID
err_user_init = échec d'initialisation de l'utilisateur err_user_init = échec d'initialisation de l'utilisateur
err_user_uid = échec de modification du UID err_user_uid = échec de modification du UID
@@ -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

@@ -1,45 +0,0 @@
capslock = capslock
err_alloc = impossibile allocare memoria
err_bounds = indice fuori limite
err_chdir = impossibile aprire home directory
err_console_dev = impossibile aprire console
err_dgn_oob = messaggio log
err_domain = dominio non valido
err_hostname = impossibile ottenere hostname
err_mlock = impossibile ottenere lock per la password in memoria
err_null = puntatore nullo
err_pam = transazione PAM fallita
err_pam_abort = transazione PAM interrotta
err_pam_acct_expired = account scaduto
err_pam_auth = errore di autenticazione
err_pam_authinfo_unavail = impossibile ottenere informazioni utente
err_pam_authok_reqd = token scaduto
err_pam_buf = errore buffer memoria
err_pam_cred_err = impossibile impostare credenziali
err_pam_cred_expired = credenziali scadute
err_pam_cred_insufficient = credenziali insufficienti
err_pam_cred_unavail = impossibile ottenere credenziali
err_pam_maxtries = raggiunto limite tentativi
err_pam_perm_denied = permesso negato
err_pam_session = errore di sessione
err_pam_sys = errore di sistema
err_pam_user_unknown = utente sconosciuto
err_path = impossibile impostare percorso
err_perm_dir = impossibile cambiare directory corrente
err_perm_group = impossibile ridurre permessi gruppo
err_perm_user = impossibile ridurre permessi utente
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
err_xsessions_dir = impossibile localizzare cartella sessioni
err_xsessions_open = impossibile aprire cartella sessioni
f1 = F1 arresto
f2 = F2 riavvio
login = username
logout = scollegato
numlock = numlock
password = password
shell = shell
wayland = wayland
xinitrc = xinitrc

View File

@@ -1,45 +0,0 @@
capslock = capslock
err_alloc = nieudana alokacja pamięci
err_bounds = indeks poza granicami
err_chdir = nie udało się otworzyć folderu domowego
err_console_dev = nie udało się uzyskać dostępu do konsoli
err_dgn_oob = wiadomość loga
err_domain = niepoprawna domena
err_hostname = nie udało się uzyskać nazwy hosta
err_mlock = nie udało się zablokować pamięci haseł
err_null = wskaźnik zerowy
err_pam = transakcja pam nieudana
err_pam_abort = transakcja pam przerwana
err_pam_acct_expired = konto wygasło
err_pam_auth = błąd autentyfikacji
err_pam_authinfo_unavail = nie udało się zdobyć informacji o użytkowniku
err_pam_authok_reqd = token wygasł
err_pam_buf = błąd bufora pamięci
err_pam_cred_err = nie udało się ustawić uwierzytelnienia
err_pam_cred_expired = uwierzytelnienie wygasło
err_pam_cred_insufficient = niewystarczające uwierzytelnienie
err_pam_cred_unavail = nie udało się uzyskać uwierzytelnienia
err_pam_maxtries = osiągnięto limit prób
err_pam_perm_denied = brak uprawnień
err_pam_session = błąd sesji
err_pam_sys = błąd systemu
err_pam_user_unknown = nieznany użytkownik
err_path = nie udało się ustawić ścieżki
err_perm_dir = nie udało się zmienić obecnego katalogu
err_perm_group = nie udało się obniżyć uprawnień grupy
err_perm_user = nie udało się obniżyć uprawnień użytkownika
err_pwnam = nie udało się uzyskać informacji o użytkowniku
err_user_gid = nie udało się ustawić GID użytkownika
err_user_init = nie udało się zainicjalizować użytkownika
err_user_uid = nie udało się ustawić UID użytkownika
err_xsessions_dir = nie udało się znaleźć folderu sesji
err_xsessions_open = nie udało się otworzyć folderu sesji
f1 = F1 wyłącz
f2 = F2 uruchom ponownie
login = login
logout = wylogowano
numlock = numlock
password = hasło
shell = powłoka
wayland = wayland
xinitrc = xinitrc

View File

@@ -1,45 +1,45 @@
capslock = capslock capslock = caixa alta
err_alloc = erro na atribuição de memória err_alloc = alocação de memória malsucedida
err_bounds = índice fora de limites err_bounds = índice fora de limites
err_chdir = erro ao abrir a pasta home err_chdir = não foi possível abrir o diretório home
err_console_dev = erro ao aceder à consola err_console_dev = não foi possível acessar o console
err_dgn_oob = mensagem de registo err_dgn_oob = mensagem de log
err_domain = domínio inválido err_domain = domínio inválido
err_hostname = erro ao obter o nome do host err_hostname = não foi possível obter o nome do host
err_mlock = erro de bloqueio de memória err_mlock = bloqueio da memória de senha malsucedido
err_null = ponteiro nulo err_null = ponteiro nulo
err_pam = erro na transação pam err_pam = transação pam malsucedida
err_pam_abort = transação pam abortada err_pam_abort = transação pam abortada
err_pam_acct_expired = conta expirada err_pam_acct_expired = conta expirada
err_pam_auth = erro de autenticação err_pam_auth = erro de autenticação
err_pam_authinfo_unavail = erro ao obter informação do utilizador err_pam_authinfo_unavail = não foi possível obter informações do usuário
err_pam_authok_reqd = token expirado err_pam_authok_reqd = token expirada
err_pam_buf = erro de buffer de memória err_pam_buf = erro de buffer de memória
err_pam_cred_err = erro ao definir credenciais err_pam_cred_err = erro para definir credenciais
err_pam_cred_expired = credenciais expiradas err_pam_cred_expired = credenciais expiradas
err_pam_cred_insufficient = credenciais insuficientes err_pam_cred_insufficient = credenciais insuficientes
err_pam_cred_unavail = erro ao obter credenciais err_pam_cred_unavail = não foi possível obter credenciais
err_pam_maxtries = limite máximo de tentativas atingido err_pam_maxtries = limite máximo de tentativas atingido
err_pam_perm_denied = permissão negada err_pam_perm_denied = permissão negada
err_pam_session = erro de sessão err_pam_session = erro de sessão
err_pam_sys = erro de sistema err_pam_sys = erro de sistema
err_pam_user_unknown = utilizador desconhecido err_pam_user_unknown = usuário desconhecido
err_path = erro ao definir o caminho de acesso err_path = não foi possível definir o caminho
err_perm_dir = erro ao alterar o diretório atual err_perm_dir = não foi possível alterar o diretório atual
err_perm_group = erro ao reduzir as permissões do grupo err_perm_group = não foi possível reduzir as permissões de grupo
err_perm_user = erro ao reduzir as permissões do utilizador err_perm_user = não foi possível reduzir as permissões de usuário
err_pwnam = erro ao obter informação do utilizador err_pwnam = não foi possível obter informações do usuário
err_user_gid = erro ao definir o GID do utilizador err_user_gid = não foi possível definir o GID do usuário
err_user_init = erro ao iniciar o utilizador err_user_init = não foi possível iniciar o usuário
err_user_uid = erro ao definir o UID do utilizador err_user_uid = não foi possível definir o UID do usuário
err_xsessions_dir = erro ao localizar a pasta das sessões err_xsessions_dir = não foi possível encontrar a pasta das sessões
err_xsessions_open = erro ao abrir a pasta das sessões err_xsessions_open = não foi possível abrir a pasta das sessões
f1 = F1 encerrar f1 = F1 desligar
f2 = F2 reiniciar f2 = F2 reiniciar
login = iniciar sessão login = conectar:
logout = terminar sessão logout = desconectado
numlock = numlock numlock = numlock
password = palavra-passe password = senha:
shell = shell shell = shell
wayland = wayland wayland = wayland
xinitrc = xinitrc xinitrc = xinitrc

View File

@@ -1,45 +0,0 @@
capslock = caixa alta
err_alloc = alocação de memória malsucedida
err_bounds = índice fora de limites
err_chdir = não foi possível abrir o diretório home
err_console_dev = não foi possível acessar o console
err_dgn_oob = mensagem de log
err_domain = domínio inválido
err_hostname = não foi possível obter o nome do host
err_mlock = bloqueio da memória de senha malsucedido
err_null = ponteiro nulo
err_pam = transação pam malsucedida
err_pam_abort = transação pam abortada
err_pam_acct_expired = conta expirada
err_pam_auth = erro de autenticação
err_pam_authinfo_unavail = não foi possível obter informações do usuário
err_pam_authok_reqd = token expirada
err_pam_buf = erro de buffer de memória
err_pam_cred_err = erro para definir credenciais
err_pam_cred_expired = credenciais expiradas
err_pam_cred_insufficient = credenciais insuficientes
err_pam_cred_unavail = não foi possível obter credenciais
err_pam_maxtries = limite máximo de tentativas atingido
err_pam_perm_denied = permissão negada
err_pam_session = erro de sessão
err_pam_sys = erro de sistema
err_pam_user_unknown = usuário desconhecido
err_path = não foi possível definir o caminho
err_perm_dir = não foi possível alterar o diretório atual
err_perm_group = não foi possível reduzir as permissões de grupo
err_perm_user = não foi possível reduzir as permissões de usuário
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
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
f1 = F1 desligar
f2 = F2 reiniciar
login = conectar
logout = desconectado
numlock = numlock
password = senha
shell = shell
wayland = wayland
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

@@ -10,17 +10,17 @@ err_mlock = сбой блокировки памяти
err_null = нулевой указатель err_null = нулевой указатель
err_pam = pam транзакция не удалась err_pam = pam транзакция не удалась
err_pam_abort = pam транзакция прервана err_pam_abort = pam транзакция прервана
err_pam_acct_expired = срок действия аккаунта истёк err_pam_acct_expired = срок действия аккаунта истек
err_pam_auth = ошибка аутентификации err_pam_auth = ошибка аутентификации
err_pam_authinfo_unavail = не удалось получить информацию о пользователе err_pam_authinfo_unavail = не удалось получить информацию о пользователе
err_pam_authok_reqd = токен истёк err_pam_authok_reqd = токен истек
err_pam_buf = ошибка буфера памяти err_pam_buf = ошибка буфера памяти
err_pam_cred_err = не удалось установить полномочия err_pam_cred_err = не удалось установить полномочия
err_pam_cred_expired = полномочия истекли err_pam_cred_expired = полномочия истекли
err_pam_cred_insufficient = недостаточно полномочий err_pam_cred_insufficient = недостаточо полномочий
err_pam_cred_unavail = не удалось получить полномочия err_pam_cred_unavail = не удалось получить полномочия
err_pam_maxtries = лимит попыток исчерпан err_pam_maxtries = лимит попыток исчерпан
err_pam_perm_denied = доступ запрещён err_pam_perm_denied = доступ запрещен
err_pam_session = ошибка сессии err_pam_session = ошибка сессии
err_pam_sys = системная ошибка err_pam_sys = системная ошибка
err_pam_user_unknown = неизвестный пользователь err_pam_user_unknown = неизвестный пользователь
@@ -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

@@ -1,45 +0,0 @@
capslock = capslock
err_alloc = neuspijesna alokacija memorije
err_bounds = izvan granica indeksa
err_chdir = neuspijesno otvaranje home foldera
err_console_dev = neuspijesno pristupanje konzoli
err_dgn_oob = log poruka
err_domain = nevazeci domen
err_hostname = neuspijesno trazenje hostname-a
err_mlock = neuspijesno zakljucavanje memorije lozinke
err_null = null pokazivac
err_pam = pam transakcija neuspijesna
err_pam_abort = pam transakcija prekinuta
err_pam_acct_expired = nalog istekao
err_pam_auth = greska pri autentikaciji
err_pam_authinfo_unavail = neuspjelo uzimanje informacija o korisniku
err_pam_authok_reqd = token istekao
err_pam_buf = greska bafera memorije
err_pam_cred_err = neuspjelo postavljanje kredencijala
err_pam_cred_expired = kredencijali istekli
err_pam_cred_insufficient = nedovoljni kredencijali
err_pam_cred_unavail = neuspjelo uzimanje kredencijala
err_pam_maxtries = dostignut maksimalan broj pokusaja
err_pam_perm_denied = nedozovoljeno
err_pam_session = greska sesije
err_pam_sys = greska sistema
err_pam_user_unknown = nepoznat korisnik
err_path = neuspjelo postavljanje path-a
err_perm_dir = neuspjelo mijenjanje foldera
err_perm_group = neuspjesno snizavanje dozvola grupe
err_perm_user = neuspijesno snizavanje dozvola korisnika
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
err_xsessions_dir = neuspijesno pronalazenje foldera sesija
err_xsessions_open = neuspijesno otvaranje foldera sesija
f1 = F1 ugasi
f2 = F2 ponovo pokreni
login = korisnik
logout = izlogovan
numlock = numlock
password = lozinka
shell = shell
wayland = wayland
xinitrc = xinitrc

View File

@@ -1,45 +0,0 @@
capslock = capslock
err_alloc = misslyckad minnesallokering
err_bounds = utanför banan index
err_chdir = misslyckades att öppna hemkatalog
err_console_dev = misslyckades att komma åt konsol
err_dgn_oob = loggmeddelande
err_domain = okänd domän
err_hostname = misslyckades att hämta värdnamn
err_mlock = misslyckades att låsa lösenordsminne
err_null = nullpekare
err_pam = pam-transaktion misslyckades
err_pam_abort = pam-transaktion avbröts
err_pam_acct_expired = konto upphört
err_pam_auth = autentiseringsfel
err_pam_authinfo_unavail = misslyckades att hämta användarinfo
err_pam_authok_reqd = token utgången
err_pam_buf = minnesbuffer fel
err_pam_cred_err = misslyckades att ställa in inloggningsuppgifter
err_pam_cred_expired = inloggningsuppgifter upphörda
err_pam_cred_insufficient = otillräckliga inloggningsuppgifter
err_pam_cred_unavail = misslyckades att hämta inloggningsuppgifter
err_pam_maxtries = nådde maximal försöksgräns
err_pam_perm_denied = åtkomst nekad
err_pam_session = sessionsfel
err_pam_sys = systemfel
err_pam_user_unknown = okänd användare
err_path = misslyckades att ställa in sökväg
err_perm_dir = misslyckades att ändra aktuell katalog
err_perm_group = misslyckades att nergradera gruppbehörigheter
err_perm_user = misslyckades att nergradera användarbehörigheter
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
err_xsessions_dir = misslyckades att hitta sessionskatalog
err_xsessions_open = misslyckades att öppna sessionskatalog
f1 = F1 stäng av
f2 = F2 starta om
login = inloggad
logout = utloggad
numlock = numlock
password = lösenord
shell = skal
wayland = wayland
xinitrc = xinitrc

View File

@@ -1,45 +0,0 @@
capslock = capslock
err_alloc = basarisiz bellek ayirma
err_bounds = sinirlarin disinda dizin
err_chdir = ev klasoru acilamadi
err_console_dev = konsola erisilemedi
err_dgn_oob = log mesaji
err_domain = gecersiz etki alani
err_hostname = ana bilgisayar adi alinamadi
err_mlock = parola bellegi kilitlenemedi
err_null = bos isaretci hatasi
err_pam = pam islemi basarisiz oldu
err_pam_abort = pam islemi durduruldu
err_pam_acct_expired = hesabin suresi dolmus
err_pam_auth = kimlik dogrulama hatasi
err_pam_authinfo_unavail = kullanici bilgileri getirilirken hata olustu
err_pam_authok_reqd = suresi dolmus token
err_pam_buf = bellek arabellegi hatasi
err_pam_cred_err = kimlik bilgileri ayarlanamadi
err_pam_cred_expired = kimlik bilgilerinin suresi dolmus
err_pam_cred_insufficient = yetersiz kimlik bilgileri
err_pam_cred_unavail = kimlik bilgileri alinamadi
err_pam_maxtries = en fazla deneme sinirina ulasildi
err_pam_perm_denied = izin reddedildi
err_pam_session = oturum hatasi
err_pam_sys = sistem hatasi
err_pam_user_unknown = bilinmeyen kullanici
err_path = yol ayarlanamadi
err_perm_dir = gecerli dizin degistirilemedi
err_perm_group = grup izinleri dusurulemedi
err_perm_user = kullanici izinleri dusurulemedi
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
err_xsessions_dir = oturumlar klasoru bulunamadi
err_xsessions_open = oturumlar klasoru acilamadi
f1 = F1 makineyi kapat
f2 = F2 yeniden baslat
login = kullanici
logout = oturumdan cikis yapildi
numlock = numlock
password = sifre
shell = shell
wayland = wayland
xinitrc = xinitrc

View File

@@ -1,45 +0,0 @@
capslock = capslock
err_alloc = невдале виділення пам'яті
err_bounds = поза межами індексу
err_chdir = не вдалося відкрити домашній каталог
err_console_dev = невдалий доступ до консолі
err_dgn_oob = повідомлення журналу (log)
err_domain = недійсний домен
err_hostname = не вдалося отримати ім'я хосту
err_mlock = збій блокування пам'яті
err_null = нульовий вказівник
err_pam = невдала pam транзакція
err_pam_abort = pam транзакція перервана
err_pam_acct_expired = термін дії акаунту вичерпано
err_pam_auth = помилка автентифікації
err_pam_authinfo_unavail = не вдалося отримати дані користувача
err_pam_authok_reqd = термін дії токена вичерпано
err_pam_buf = помилка буферу пам'яті
err_pam_cred_err = не вдалося змінити облікові дані
err_pam_cred_expired = термін дії повноважень вичерпано
err_pam_cred_insufficient = недостатньо облікових даних
err_pam_cred_unavail = не вдалося отримати облікові дані
err_pam_maxtries = вичерпано ліміт спроб
err_pam_perm_denied = відмовлено у доступі
err_pam_session = помилка сесії
err_pam_sys = системна помилка
err_pam_user_unknown = невідомий користувач
err_path = не вдалося змінити шлях
err_perm_dir = не вдалося змінити поточний каталог
err_perm_group = не вдалося понизити права доступу групи
err_perm_user = не вдалося понизити права доступу користувача
err_pwnam = не вдалося отримати дані користувача
err_user_gid = не вдалося змінити GID користувача
err_user_init = не вдалося ініціалізувати користувача
err_user_uid = не вдалося змінити UID користувача
err_xsessions_dir = не вдалося знайти каталог сесій
err_xsessions_open = не вдалося відкрити каталог сесій
f1 = F1 вимкнути
f2 = F2 перезавантажити
login = логін
logout = вийти
numlock = numlock
password = пароль
shell = оболонка
wayland = wayland
xinitrc = xinitrc

View File

@@ -1,38 +0,0 @@
#!/sbin/openrc-run
name="ly"
description="TUI Display Manager"
## Supervisor daemon
supervisor=supervise-daemon
respawn_period=60
pidfile=/run/"${RC_SVCNAME}.pid"
## Check for getty or agetty
if [ -x /sbin/getty ] || [ -x /bin/getty ];
then
# busybox
commandB="/sbin/getty"
elif [ -x /sbin/agetty ] || [ -x /bin/agetty ];
then
# util-linux
commandUL="/sbin/agetty"
fi
## Get the tty from the conf file
CONFTTY=$(cat /etc/ly/config.ini | sed -n 's/^tty.*=[^1-9]*// p')
## The execution vars
# If CONFTTY is empty then default to 2
TTY="tty${CONFTTY:-2}"
TERM=linux
BAUD=38400
# If we don't have getty then we should have agetty
command=${commandB:-$commandUL}
command_args_foreground="-nl /usr/bin/ly $TTY $BAUD $TERM"
depend() {
after agetty
provide display-manager
want elogind
}

View File

@@ -1,12 +0,0 @@
if [ -x /sbin/agetty -o -x /bin/agetty ]; then
# util-linux specific settings
if [ "${tty}" = "tty1" ]; then
GETTY_ARGS="--noclear"
fi
fi
BAUD_RATE=38400
TERM_NAME=linux
auxtty=$(/bin/cat /etc/ly/config.ini 2>/dev/null 1| /bin/sed -n 's/\(^[[:space:]]*tty[[:space:]]*=[[:space:]]*\)\([[:digit:]][[:digit:]]*\)\(.*\)/\2/p')
TTY=tty${auxtty:-2}

View File

@@ -1,4 +0,0 @@
#!/bin/sh
[ -r conf ] && . ./conf
exec utmpset -w ${TTY}

View File

@@ -1,13 +0,0 @@
#!/bin/sh
[ -r conf ] && . ./conf
if [ -x /sbin/getty -o -x /bin/getty ]; then
# busybox
GETTY=getty
elif [ -x /sbin/agetty -o -x /bin/agetty ]; then
# util-linux
GETTY=agetty
fi
exec setsid ${GETTY} ${GETTY_ARGS} -nl /usr/bin/ly "${TTY}" "${BAUD_RATE}" "${TERM_NAME}"

View File

@@ -51,4 +51,4 @@ case $SHELL in
;; ;;
esac esac
exec "$@" exec $@

View File

@@ -90,7 +90,6 @@ elif [ -f /etc/X11/Xresources ]; then
xrdb -merge /etc/X11/Xresources xrdb -merge /etc/X11/Xresources
fi fi
[ -f $HOME/.Xresources ] && xrdb -merge $HOME/.Xresources [ -f $HOME/.Xresources ] && xrdb -merge $HOME/.Xresources
[ -f $XDG_CONFIG_HOME/X11/Xresources ] && xrdb -merge $XDG_CONFIG_HOME/X11/Xresources
if [ -f "$USERXSESSION" ]; then if [ -f "$USERXSESSION" ]; then
. "$USERXSESSION" . "$USERXSESSION"

1
selinux/ly.fc Normal file
View File

@@ -0,0 +1 @@
/usr/bin/ly -- gen_context(system_u:object_r:ly_exec_t,s0)

41
selinux/ly.if Normal file
View File

@@ -0,0 +1,41 @@
## <summary>policy for ly</summary>
########################################
## <summary>
## Execute ly_exec_t in the ly domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`ly_domtrans',`
gen_require(`
type ly_t, ly_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, ly_exec_t, ly_t)
')
######################################
## <summary>
## Execute ly in the caller domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`ly_exec',`
gen_require(`
type ly_exec_t;
')
corecmd_search_bin($1)
can_exec($1, ly_exec_t)
')

32
selinux/ly.te Executable file
View File

@@ -0,0 +1,32 @@
policy_module(ly, 1.0.0)
########################################
#
# Declarations
#
type ly_t;
type ly_exec_t;
init_daemon_domain(ly_t, ly_exec_t)
permissive ly_t;
########################################
#
# ly local policy
#
allow ly_t self:capability { setgid setuid };
allow ly_t self:process { fork signal_perms };
allow ly_t self:process transition;
allow ly_t self:fifo_file rw_fifo_file_perms;
allow ly_t self:unix_stream_socket create_stream_socket_perms;
domain_use_interactive_fds(ly_t)
files_read_etc_files(ly_t)
auth_use_nsswitch(ly_t)
logging_send_audit_msgs(ly_t)
miscfiles_read_localization(ly_t)

View File

@@ -1,146 +0,0 @@
#include <stdint.h>
#define CLOCK_W 5
#define CLOCK_H 5
#if defined(__linux__) || defined(__FreeBSD__)
#define X 0x2593
#define _ 0x0000
#else
#define X '#'
#define _ 0
#endif
#if CLOCK_W == 5 && CLOCK_H == 5
uint32_t CLOCK_0[] = {
X,X,X,X,X,
X,X,_,X,X,
X,X,_,X,X,
X,X,_,X,X,
X,X,X,X,X
};
uint32_t CLOCK_1[] = {
_,_,_,X,X,
_,_,_,X,X,
_,_,_,X,X,
_,_,_,X,X,
_,_,_,X,X
};
uint32_t CLOCK_2[] = {
X,X,X,X,X,
_,_,_,X,X,
X,X,X,X,X,
X,X,_,_,_,
X,X,X,X,X
};
uint32_t CLOCK_3[] = {
X,X,X,X,X,
_,_,_,X,X,
X,X,X,X,X,
_,_,_,X,X,
X,X,X,X,X
};
uint32_t CLOCK_4[] = {
X,X,_,X,X,
X,X,_,X,X,
X,X,X,X,X,
_,_,_,X,X,
_,_,_,X,X
};
uint32_t CLOCK_5[] = {
X,X,X,X,X,
X,X,_,_,_,
X,X,X,X,X,
_,_,_,X,X,
X,X,X,X,X
};
uint32_t CLOCK_6[] = {
X,X,X,X,X,
X,X,_,_,_,
X,X,X,X,X,
X,X,_,X,X,
X,X,X,X,X,
};
uint32_t CLOCK_7[] = {
X,X,X,X,X,
_,_,_,X,X,
_,_,_,X,X,
_,_,_,X,X,
_,_,_,X,X
};
uint32_t CLOCK_8[] = {
X,X,X,X,X,
X,X,_,X,X,
X,X,X,X,X,
X,X,_,X,X,
X,X,X,X,X
};
uint32_t CLOCK_9[] = {
X,X,X,X,X,
X,X,_,X,X,
X,X,X,X,X,
_,_,_,X,X,
X,X,X,X,X
};
uint32_t CLOCK_S[] = {
_,_,_,_,_,
_,_,X,_,_,
_,_,_,_,_,
_,_,X,_,_,
_,_,_,_,_
};
uint32_t CLOCK_E[] = {
_,_,_,_,_,
_,_,_,_,_,
_,_,_,_,_,
_,_,_,_,_,
_,_,_,_,_
};
#endif
#undef X
#undef _
static inline uint32_t* CLOCK_N(char c)
{
switch(c)
{
case '0':
return CLOCK_0;
case '1':
return CLOCK_1;
case '2':
return CLOCK_2;
case '3':
return CLOCK_3;
case '4':
return CLOCK_4;
case '5':
return CLOCK_5;
case '6':
return CLOCK_6;
case '7':
return CLOCK_7;
case '8':
return CLOCK_8;
case '9':
return CLOCK_9;
case ':':
return CLOCK_S;
default:
return CLOCK_E;
}
}

View File

@@ -2,9 +2,7 @@
#include "config.h" #include "config.h"
#include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@@ -32,11 +30,11 @@ static void config_handle_u8(void* data, char** pars, const int pars_count)
{ {
if (strcmp(*pars, "") == 0) if (strcmp(*pars, "") == 0)
{ {
*((uint8_t*)data) = 0; *((u8*)data) = 0;
} }
else else
{ {
*((uint8_t*)data) = atoi(*pars); *((u8*)data) = atoi(*pars);
} }
} }
@@ -44,11 +42,11 @@ static void config_handle_u16(void* data, char** pars, const int pars_count)
{ {
if (strcmp(*pars, "") == 0) if (strcmp(*pars, "") == 0)
{ {
*((uint16_t*)data) = 0; *((u16*)data) = 0;
} }
else else
{ {
*((uint16_t*)data) = atoi(*pars); *((u16*)data) = atoi(*pars);
} }
} }
@@ -161,15 +159,12 @@ void config_load(const char *cfg_path)
{"animation", &config.animation, config_handle_u8}, {"animation", &config.animation, config_handle_u8},
{"asterisk", &config.asterisk, config_handle_char}, {"asterisk", &config.asterisk, config_handle_char},
{"bg", &config.bg, config_handle_u8}, {"bg", &config.bg, config_handle_u8},
{"bigclock", &config.bigclock, config_handle_bool},
{"blank_box", &config.blank_box, config_handle_bool}, {"blank_box", &config.blank_box, config_handle_bool},
{"blank_password", &config.blank_password, config_handle_bool}, {"blank_password", &config.blank_password, config_handle_bool},
{"clock", &config.clock, config_handle_str},
{"console_dev", &config.console_dev, config_handle_str}, {"console_dev", &config.console_dev, config_handle_str},
{"default_input", &config.default_input, config_handle_u8}, {"default_input", &config.default_input, config_handle_u8},
{"fg", &config.fg, config_handle_u8}, {"fg", &config.fg, config_handle_u8},
{"hide_borders", &config.hide_borders, config_handle_bool}, {"hide_borders", &config.hide_borders, config_handle_bool},
{"hide_f1_commands", &config.hide_f1_commands, config_handle_bool},
{"input_len", &config.input_len, config_handle_u8}, {"input_len", &config.input_len, config_handle_u8},
{"lang", &config.lang, config_handle_str}, {"lang", &config.lang, config_handle_str},
{"load", &config.load, config_handle_bool}, {"load", &config.load, config_handle_bool},
@@ -192,7 +187,6 @@ 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},
@@ -271,12 +265,10 @@ void config_defaults()
config.animation = 0; config.animation = 0;
config.asterisk = '*'; config.asterisk = '*';
config.bg = 0; config.bg = 0;
config.bigclock = false;
config.blank_box = true; config.blank_box = true;
config.blank_password = false; config.blank_password = false;
config.clock = NULL;
config.console_dev = strdup("/dev/console"); config.console_dev = strdup("/dev/console");
config.default_input = LOGIN_INPUT; config.default_input = PASSWORD_INPUT;
config.fg = 9; config.fg = 9;
config.hide_borders = false; config.hide_borders = false;
config.input_len = 34; config.input_len = 34;
@@ -301,7 +293,6 @@ 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");
@@ -358,7 +349,6 @@ void lang_free()
void config_free() void config_free()
{ {
free(config.clock);
free(config.console_dev); free(config.console_dev);
free(config.lang); free(config.lang);
free(config.mcookie_cmd); free(config.mcookie_cmd);
@@ -371,7 +361,6 @@ 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

@@ -1,8 +1,7 @@
#ifndef H_LY_CONFIG #ifndef H_LY_CONFIG
#define H_LY_CONFIG #define H_LY_CONFIG
#include <stdbool.h> #include "ctypes.h"
#include <stdint.h>
enum INPUTS { enum INPUTS {
SESSION_SWITCH, SESSION_SWITCH,
@@ -62,28 +61,25 @@ struct lang
struct config struct config
{ {
bool animate; bool animate;
uint8_t animation; u8 animation;
char asterisk; char asterisk;
uint8_t bg; u8 bg;
bool bigclock;
bool blank_box; bool blank_box;
bool blank_password; bool blank_password;
char* clock;
char* console_dev; char* console_dev;
uint8_t default_input; u8 default_input;
uint8_t fg; u8 fg;
bool hide_borders; bool hide_borders;
bool hide_f1_commands; u8 input_len;
uint8_t input_len;
char* lang; char* lang;
bool load; bool load;
uint8_t margin_box_h; u8 margin_box_h;
uint8_t margin_box_v; u8 margin_box_v;
uint8_t max_desktop_len; u8 max_desktop_len;
uint8_t max_login_len; u8 max_login_len;
uint8_t max_password_len; u8 max_password_len;
char* mcookie_cmd; char* mcookie_cmd;
uint16_t min_refresh_delta; u16 min_refresh_delta;
char* path; char* path;
char* restart_cmd; char* restart_cmd;
bool save; bool save;
@@ -91,12 +87,11 @@ struct config
char* service_name; char* service_name;
char* shutdown_cmd; char* shutdown_cmd;
char* term_reset_cmd; char* term_reset_cmd;
uint8_t tty; u8 tty;
char* wayland_cmd; char* wayland_cmd;
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

@@ -1,23 +1,19 @@
#include "dragonfail.h" #include "dragonfail.h"
#include "termbox.h" #include "termbox.h"
#include "ctypes.h"
#include "inputs.h" #include "inputs.h"
#include "utils.h" #include "utils.h"
#include "config.h" #include "config.h"
#include "draw.h" #include "draw.h"
#include "bigclock.h"
#include <ctype.h> #include <ctype.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <time.h>
#if defined(__DragonFly__) || defined(__FreeBSD__) #if defined(__DragonFly__) || defined(__FreeBSD__)
#include <sys/kbio.h> #include <sys/kbio.h>
@@ -33,8 +29,8 @@ void draw_init(struct term_buf* buf)
buf->height = tb_height(); buf->height = tb_height();
hostname(&buf->info_line); hostname(&buf->info_line);
uint16_t len_login = strlen(lang.login); u16 len_login = strlen(lang.login);
uint16_t len_password = strlen(lang.password); u16 len_password = strlen(lang.password);
if (len_login > len_password) if (len_login > len_password)
{ {
@@ -51,7 +47,7 @@ void draw_init(struct term_buf* buf)
+ (config.input_len + 1) + (config.input_len + 1)
+ buf->labels_max_len; + buf->labels_max_len;
#if defined(__linux__) || defined(__FreeBSD__) #if defined(__linux__)
buf->box_chars.left_up = 0x250c; buf->box_chars.left_up = 0x250c;
buf->box_chars.left_down = 0x2514; buf->box_chars.left_down = 0x2514;
buf->box_chars.right_up = 0x2510; buf->box_chars.right_up = 0x2510;
@@ -72,31 +68,20 @@ void draw_init(struct term_buf* buf)
#endif #endif
} }
static void doom_free(struct term_buf* buf);
static void matrix_free(struct term_buf* buf);
void draw_free(struct term_buf* buf) void draw_free(struct term_buf* buf)
{ {
if (config.animate) if (config.animate)
{ {
switch (config.animation) free(buf->tmp_buf);
{
case 0:
doom_free(buf);
break;
case 1:
matrix_free(buf);
break;
}
} }
} }
void draw_box(struct term_buf* buf) void draw_box(struct term_buf* buf)
{ {
uint16_t box_x = (buf->width - buf->box_width) / 2; u16 box_x = (buf->width - buf->box_width) / 2;
uint16_t box_y = (buf->height - buf->box_height) / 2; u16 box_y = (buf->height - buf->box_height) / 2;
uint16_t box_x2 = (buf->width + buf->box_width) / 2; u16 box_x2 = (buf->width + buf->box_width) / 2;
uint16_t box_y2 = (buf->height + buf->box_height) / 2; u16 box_y2 = (buf->height + buf->box_height) / 2;
buf->box_x = box_x; buf->box_x = box_x;
buf->box_y = box_y; buf->box_y = box_y;
@@ -132,7 +117,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 (uint16_t i = 0; i < buf->box_width; ++i) for (u8 i = 0; i < buf->box_width; ++i)
{ {
tb_put_cell( tb_put_cell(
box_x + i, box_x + i,
@@ -148,7 +133,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 (uint16_t i = 0; i < buf->box_height; ++i) for (u8 i = 0; i < buf->box_height; ++i)
{ {
tb_put_cell( tb_put_cell(
box_x - 1, box_x - 1,
@@ -166,9 +151,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 (uint16_t i = 0; i < buf->box_height; ++i) for (u8 i = 0; i < buf->box_height; ++i)
{ {
for (uint16_t k = 0; k < buf->box_width; ++k) for (u8 k = 0; k < buf->box_width; ++k)
{ {
tb_put_cell( tb_put_cell(
box_x + k, box_x + k,
@@ -179,114 +164,15 @@ void draw_box(struct term_buf* buf)
} }
} }
char* time_str(char* fmt, int maxlen) struct tb_cell* strn_cell(char* s, u16 len) // throws
{
time_t timer;
char* buffer = malloc(maxlen);
struct tm* tm_info;
timer = time(NULL);
tm_info = localtime(&timer);
if (strftime(buffer, maxlen, fmt, tm_info) == 0)
{
buffer[0] = '\0';
}
return buffer;
}
extern inline uint32_t* CLOCK_N(char c);
struct tb_cell* clock_cell(char c)
{
struct tb_cell* cells = malloc(sizeof(struct tb_cell) * CLOCK_W * CLOCK_H);
struct timeval tv;
gettimeofday(&tv, NULL);
if (config.animate && c == ':' && tv.tv_usec / 500000)
{
c = ' ';
}
uint32_t* clockchars = CLOCK_N(c);
for (int i = 0; i < CLOCK_W * CLOCK_H; i++)
{
cells[i].ch = clockchars[i];
cells[i].fg = config.fg;
cells[i].bg = config.bg;
}
return cells;
}
void alpha_blit(struct tb_cell* buf, uint16_t x, uint16_t y, uint16_t w, uint16_t h, struct tb_cell* cells)
{
if (x + w >= tb_width() || y + h >= tb_height())
return;
for (int i = 0; i < h; i++)
{
for (int j = 0; j < w; j++)
{
struct tb_cell cell = cells[i * w + j];
if (cell.ch)
{
buf[(y + i) * tb_width() + (x + j)] = cell;
}
}
}
}
void draw_bigclock(struct term_buf* buf)
{
if (!config.bigclock)
{
return;
}
int xo = buf->width / 2 - (5 * (CLOCK_W + 1)) / 2;
int yo = (buf->height - buf->box_height) / 2 - CLOCK_H - 2;
char* clockstr = time_str("%H:%M", 6);
struct tb_cell* clockcell;
for (int i = 0; i < 5; i++)
{
clockcell = clock_cell(clockstr[i]);
alpha_blit(tb_cell_buffer(), xo + i * (CLOCK_W + 1), yo, CLOCK_W, CLOCK_H, clockcell);
free(clockcell);
}
free(clockstr);
}
void draw_clock(struct term_buf* buf)
{
if (config.clock == NULL || strlen(config.clock) == 0)
{
return;
}
char* clockstr = time_str(config.clock, 32);
int clockstrlen = strlen(clockstr);
struct tb_cell* cells = strn_cell(clockstr, clockstrlen);
tb_blit(buf->width - clockstrlen, 0, clockstrlen, 1, cells);
free(clockstr);
free(cells);
}
struct tb_cell* strn_cell(char* s, uint16_t len) // throws
{ {
struct tb_cell* cells = malloc((sizeof (struct tb_cell)) * len); struct tb_cell* cells = malloc((sizeof (struct tb_cell)) * len);
char* s2 = s; char* s2 = s;
uint32_t c; u32 c;
if (cells != NULL) if (cells != NULL)
{ {
for (uint16_t i = 0; i < len; ++i) for (u16 i = 0; i < len; ++i)
{ {
if ((s2 - s) >= len) if ((s2 - s) >= len)
{ {
@@ -353,7 +239,7 @@ void draw_labels(struct term_buf* buf) // throws
if (buf->info_line != NULL) if (buf->info_line != NULL)
{ {
uint16_t len = strlen(buf->info_line); u16 len = strlen(buf->info_line);
struct tb_cell* info_cell = str_cell(buf->info_line); struct tb_cell* info_cell = str_cell(buf->info_line);
if (dgn_catch()) if (dgn_catch())
@@ -429,7 +315,7 @@ void draw_lock_state(struct term_buf* buf)
close(fd); close(fd);
// print text // print text
uint16_t pos_x = buf->width - strlen(lang.numlock); u16 pos_x = buf->width - strlen(lang.numlock);
if (numlock_on) if (numlock_on)
{ {
@@ -466,7 +352,7 @@ void draw_lock_state(struct term_buf* buf)
void draw_desktop(struct desktop* target) void draw_desktop(struct desktop* target)
{ {
uint16_t len = strlen(target->list[target->cur]); u16 len = strlen(target->list[target->cur]);
if (len > (target->visible_len - 3)) if (len > (target->visible_len - 3))
{ {
@@ -487,7 +373,7 @@ void draw_desktop(struct desktop* target)
config.fg, config.fg,
config.bg); config.bg);
for (uint16_t i = 0; i < len; ++ i) for (u16 i = 0; i < len; ++ i)
{ {
tb_change_cell( tb_change_cell(
target->x + i + 2, target->x + i + 2,
@@ -500,8 +386,8 @@ void draw_desktop(struct desktop* target)
void draw_input(struct text* input) void draw_input(struct text* input)
{ {
uint16_t len = strlen(input->text); u16 len = strlen(input->text);
uint16_t visible_len = input->visible_len; u16 visible_len = input->visible_len;
if (len > visible_len) if (len > visible_len)
{ {
@@ -521,7 +407,7 @@ void draw_input(struct text* input)
struct tb_cell c1 = {' ', config.fg, config.bg}; struct tb_cell c1 = {' ', config.fg, config.bg};
for (uint16_t i = input->end - input->visible_start; i < visible_len; ++i) for (u16 i = input->end - input->visible_start; i < visible_len; ++i)
{ {
tb_put_cell( tb_put_cell(
input->x + i, input->x + i,
@@ -533,8 +419,8 @@ void draw_input(struct text* input)
void draw_input_mask(struct text* input) void draw_input_mask(struct text* input)
{ {
uint16_t len = strlen(input->text); u16 len = strlen(input->text);
uint16_t visible_len = input->visible_len; u16 visible_len = input->visible_len;
if (len > visible_len) if (len > visible_len)
{ {
@@ -544,7 +430,7 @@ void draw_input_mask(struct text* input)
struct tb_cell c1 = {config.asterisk, config.fg, config.bg}; struct tb_cell c1 = {config.asterisk, config.fg, config.bg};
struct tb_cell c2 = {' ', config.fg, config.bg}; struct tb_cell c2 = {' ', config.fg, config.bg};
for (uint16_t i = 0; i < visible_len; ++i) for (u16 i = 0; i < visible_len; ++i)
{ {
if (input->visible_start + i < input->end) if (input->visible_start + i < input->end)
{ {
@@ -569,8 +455,8 @@ void position_input(
struct text* login, struct text* login,
struct text* password) struct text* password)
{ {
uint16_t x = buf->box_x + config.margin_box_h + buf->labels_max_len + 1; u16 x = buf->box_x + config.margin_box_h + buf->labels_max_len + 1;
int32_t len = buf->box_x + buf->box_width - config.margin_box_h - x; i32 len = buf->box_x + buf->box_width - config.margin_box_h - x;
if (len < 0) if (len < 0)
{ {
@@ -594,118 +480,18 @@ static void doom_init(struct term_buf* buf)
{ {
buf->init_width = buf->width; buf->init_width = buf->width;
buf->init_height = buf->height; buf->init_height = buf->height;
buf->astate.doom = malloc(sizeof(struct doom_state));
if (buf->astate.doom == NULL) u16 tmp_len = buf->width * buf->height;
{ buf->tmp_buf = malloc(tmp_len);
dgn_throw(DGN_ALLOC);
}
uint16_t tmp_len = buf->width * buf->height;
buf->astate.doom->buf = malloc(tmp_len);
tmp_len -= buf->width; tmp_len -= buf->width;
if (buf->astate.doom->buf == NULL) if (buf->tmp_buf == NULL)
{ {
dgn_throw(DGN_ALLOC); dgn_throw(DGN_ALLOC);
} }
memset(buf->astate.doom->buf, 0, tmp_len); memset(buf->tmp_buf, 0, tmp_len);
memset(buf->astate.doom->buf + tmp_len, DOOM_STEPS - 1, buf->width); memset(buf->tmp_buf + tmp_len, DOOM_STEPS - 1, buf->width);
}
static void doom_free(struct term_buf* buf)
{
free(buf->astate.doom->buf);
free(buf->astate.doom);
}
// Adapted from cmatrix
static void matrix_init(struct term_buf* buf)
{
buf->init_width = buf->width;
buf->init_height = buf->height;
buf->astate.matrix = malloc(sizeof(struct matrix_state));
struct matrix_state* s = buf->astate.matrix;
if (s == NULL)
{
dgn_throw(DGN_ALLOC);
}
uint16_t len = buf->height + 1;
s->grid = malloc(sizeof(struct matrix_dot*) * len);
if (s->grid == NULL)
{
dgn_throw(DGN_ALLOC);
}
len = (buf->height + 1) * buf->width;
(s->grid)[0] = malloc(sizeof(struct matrix_dot) * len);
if ((s->grid)[0] == NULL)
{
dgn_throw(DGN_ALLOC);
}
for (int i = 1; i <= buf->height; ++i)
{
s->grid[i] = s->grid[i - 1] + buf->width;
if (s->grid[i] == NULL)
{
dgn_throw(DGN_ALLOC);
}
}
s->length = malloc(buf->width * sizeof(int));
if (s->length == NULL)
{
dgn_throw(DGN_ALLOC);
}
s->spaces = malloc(buf->width * sizeof(int));
if (s->spaces == NULL)
{
dgn_throw(DGN_ALLOC);
}
s->updates = malloc(buf->width * sizeof(int));
if (s->updates == NULL)
{
dgn_throw(DGN_ALLOC);
}
// Initialize grid
for (int i = 0; i <= buf->height; ++i)
{
for (int j = 0; j <= buf->width - 1; j += 2)
{
s->grid[i][j].val = -1;
}
}
for (int j = 0; j < buf->width; j += 2)
{
s->spaces[j] = (int) rand() % buf->height + 1;
s->length[j] = (int) rand() % (buf->height - 3) + 3;
s->grid[1][j].val = ' ';
s->updates[j] = (int) rand() % 3 + 1;
}
}
static void matrix_free(struct term_buf* buf)
{
free(buf->astate.matrix->grid[0]);
free(buf->astate.matrix->grid);
free(buf->astate.matrix->length);
free(buf->astate.matrix->spaces);
free(buf->astate.matrix->updates);
free(buf->astate.matrix);
} }
void animate_init(struct term_buf* buf) void animate_init(struct term_buf* buf)
@@ -714,16 +500,11 @@ void animate_init(struct term_buf* buf)
{ {
switch(config.animation) switch(config.animation)
{ {
case 0: default:
{ {
doom_init(buf); doom_init(buf);
break; break;
} }
case 1:
{
matrix_init(buf);
break;
}
} }
} }
} }
@@ -747,12 +528,12 @@ static void doom(struct term_buf* term_buf)
{0x2588, 8, 4}, // white {0x2588, 8, 4}, // white
}; };
uint16_t src; u16 src;
uint16_t random; u16 random;
uint16_t dst; u16 dst;
uint16_t w = term_buf->init_width; u16 w = term_buf->init_width;
uint8_t* tmp = term_buf->astate.doom->buf; u8* tmp = term_buf->tmp_buf;
if ((term_buf->width != term_buf->init_width) || (term_buf->height != term_buf->init_height)) if ((term_buf->width != term_buf->init_width) || (term_buf->height != term_buf->init_height))
{ {
@@ -761,9 +542,9 @@ static void doom(struct term_buf* term_buf)
struct tb_cell* buf = tb_cell_buffer(); struct tb_cell* buf = tb_cell_buffer();
for (uint16_t x = 0; x < w; ++x) for (u16 x = 0; x < w; ++x)
{ {
for (uint16_t y = 1; y < term_buf->init_height; ++y) for (u16 y = 1; y < term_buf->init_height; ++y)
{ {
src = y * w + x; src = y * w + x;
random = ((rand() % 7) & 3); random = ((rand() % 7) & 3);
@@ -791,132 +572,6 @@ static void doom(struct term_buf* term_buf)
} }
} }
// Adapted from cmatrix
static void matrix(struct term_buf* buf)
{
static int frame = 3;
const int frame_delay = 8;
static int count = 0;
bool first_col;
struct matrix_state* s = buf->astate.matrix;
// Allowed codepoints
const int randmin = 33;
const int randnum = 123 - randmin;
// Chars change mid-scroll
const bool changes = true;
if ((buf->width != buf->init_width) || (buf->height != buf->init_height))
{
return;
}
count += 1;
if (count > frame_delay)
{
frame += 1;
if (frame > 4) frame = 1;
count = 0;
for (int j = 0; j < buf->width; j += 2)
{
int tail;
if (frame > s->updates[j])
{
if (s->grid[0][j].val == -1 && s->grid[1][j].val == ' ')
{
if (s->spaces[j] > 0)
{
s->spaces[j]--;
} else {
s->length[j] = (int) rand() % (buf->height - 3) + 3;
s->grid[0][j].val = (int) rand() % randnum + randmin;
s->spaces[j] = (int) rand() % buf->height + 1;
}
}
int i = 0, seg_len = 0;
first_col = 1;
while (i <= buf->height)
{
// Skip over spaces
while (i <= buf->height
&& (s->grid[i][j].val == ' ' || s->grid[i][j].val == -1))
{
i++;
}
if (i > buf->height) break;
// Find the head of this col
tail = i;
seg_len = 0;
while (i <= buf->height
&& (s->grid[i][j].val != ' ' && s->grid[i][j].val != -1))
{
s->grid[i][j].is_head = false;
if (changes)
{
if (rand() % 8 == 0)
s->grid[i][j].val = (int) rand() % randnum + randmin;
}
i++;
seg_len++;
}
// Head's down offscreen
if (i > buf->height)
{
s->grid[tail][j].val = ' ';
continue;
}
s->grid[i][j].val = (int) rand() % randnum + randmin;
s->grid[i][j].is_head = true;
if (seg_len > s->length[j] || !first_col) {
s->grid[tail][j].val = ' ';
s->grid[0][j].val = -1;
}
first_col = 0;
i++;
}
}
}
}
uint32_t blank;
utf8_char_to_unicode(&blank, " ");
for (int j = 0; j < buf->width; j += 2)
{
for (int i = 1; i <= buf->height; ++i)
{
uint32_t c;
int fg = TB_GREEN;
int bg = TB_DEFAULT;
if (s->grid[i][j].val == -1 || s->grid[i][j].val == ' ')
{
tb_change_cell(j, i - 1, blank, fg, bg);
continue;
}
char tmp[2];
tmp[0] = s->grid[i][j].val;
tmp[1] = '\0';
if(utf8_char_to_unicode(&c, tmp))
{
if (s->grid[i][j].is_head)
{
fg = TB_WHITE | TB_BOLD;
}
tb_change_cell(j, i - 1, c, fg, bg);
}
}
}
}
void animate(struct term_buf* buf) void animate(struct term_buf* buf)
{ {
buf->width = tb_width(); buf->width = tb_width();
@@ -926,24 +581,19 @@ void animate(struct term_buf* buf)
{ {
switch(config.animation) switch(config.animation)
{ {
case 0: default:
{ {
doom(buf); doom(buf);
break; break;
} }
case 1:
{
matrix(buf);
break;
}
} }
} }
} }
bool cascade(struct term_buf* term_buf, uint8_t* fails) bool cascade(struct term_buf* term_buf, u8* fails)
{ {
uint16_t width = term_buf->width; u16 width = term_buf->width;
uint16_t height = term_buf->height; u16 height = term_buf->height;
struct tb_cell* buf = tb_cell_buffer(); struct tb_cell* buf = tb_cell_buffer();
bool changes = false; bool changes = false;

View File

@@ -2,71 +2,45 @@
#define H_LY_DRAW #define H_LY_DRAW
#include "termbox.h" #include "termbox.h"
#include "inputs.h" #include "ctypes.h"
#include <stdbool.h> #include "inputs.h"
#include <stdint.h>
struct box struct box
{ {
uint32_t left_up; u32 left_up;
uint32_t left_down; u32 left_down;
uint32_t right_up; u32 right_up;
uint32_t right_down; u32 right_down;
uint32_t top; u32 top;
uint32_t bot; u32 bot;
uint32_t left; u32 left;
uint32_t right; u32 right;
};
struct matrix_dot
{
int val;
bool is_head;
};
struct matrix_state
{
struct matrix_dot** grid;
int* length;
int* spaces;
int* updates;
};
struct doom_state
{
uint8_t* buf;
};
union anim_state
{
struct doom_state* doom;
struct matrix_state* matrix;
}; };
struct term_buf struct term_buf
{ {
uint16_t width; u16 width;
uint16_t height; u16 height;
uint16_t init_width; u16 init_width;
uint16_t init_height; u16 init_height;
struct box box_chars; struct box box_chars;
char* info_line; char* info_line;
uint16_t labels_max_len; u16 labels_max_len;
uint16_t box_x; u16 box_x;
uint16_t box_y; u16 box_y;
uint16_t box_width; u16 box_width;
uint16_t box_height; u16 box_height;
union anim_state astate; u8* tmp_buf;
}; };
void draw_init(struct term_buf* buf); void draw_init(struct term_buf* buf);
void draw_free(struct term_buf* buf); void draw_free(struct term_buf* buf);
void draw_box(struct term_buf* buf); void draw_box(struct term_buf* buf);
struct tb_cell* strn_cell(char* s, uint16_t len); struct tb_cell* strn_cell(char* s, u16 len);
struct tb_cell* str_cell(char* s); struct tb_cell* str_cell(char* s);
void draw_labels(struct term_buf* buf); void draw_labels(struct term_buf* buf);
@@ -84,9 +58,6 @@ void position_input(
void animate_init(struct term_buf* buf); void animate_init(struct term_buf* buf);
void animate(struct term_buf* buf); void animate(struct term_buf* buf);
bool cascade(struct term_buf* buf, uint8_t* fails); bool cascade(struct term_buf* buf, u8* fails);
void draw_bigclock(struct term_buf *buf);
void draw_clock(struct term_buf *buf);
#endif #endif

View File

@@ -1,13 +1,13 @@
#include "dragonfail.h" #include "dragonfail.h"
#include "termbox.h" #include "termbox.h"
#include "ctypes.h"
#include "inputs.h" #include "inputs.h"
#include "config.h" #include "config.h"
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <ctype.h>
void handle_desktop(void* input_struct, struct tb_event* event) void handle_desktop(void* input_struct, struct tb_event* event)
{ {
@@ -15,11 +15,11 @@ void handle_desktop(void* input_struct, struct tb_event* event)
if ((event != NULL) && (event->type == TB_EVENT_KEY)) if ((event != NULL) && (event->type == TB_EVENT_KEY))
{ {
if (event->key == TB_KEY_ARROW_LEFT || (event->key == TB_KEY_CTRL_H)) if (event->key == TB_KEY_ARROW_LEFT)
{ {
input_desktop_right(target); input_desktop_right(target);
} }
else if (event->key == TB_KEY_ARROW_RIGHT || (event->key == TB_KEY_CTRL_L)) else if (event->key == TB_KEY_ARROW_RIGHT)
{ {
input_desktop_left(target); input_desktop_left(target);
} }
@@ -77,20 +77,19 @@ void handle_text(void* input_struct, struct tb_event* event)
void input_desktop(struct desktop* target) void input_desktop(struct desktop* target)
{ {
target->list = NULL; target->list = NULL;
target->list_simple = NULL;
target->cmd = NULL; target->cmd = NULL;
target->display_server = NULL; target->display_server = NULL;
target->cur = 0; target->cur = 0;
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(config.xinitrc), DS_XINITRC); input_desktop_add(target, strdup(lang.xinitrc), strdup("~/.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
} }
void input_text(struct text* target, uint64_t len) void input_text(struct text* target, u64 len)
{ {
target->text = malloc(len + 1); target->text = malloc(len + 1);
@@ -124,7 +123,7 @@ void input_desktop_free(struct desktop* target)
{ {
if (target != NULL) if (target != NULL)
{ {
for (uint16_t i = 0; i < target->len; ++i) for (u16 i = 0; i < target->len; ++i)
{ {
if (target->list[i] != NULL) if (target->list[i] != NULL)
{ {
@@ -178,8 +177,7 @@ void input_desktop_add(
{ {
++(target->len); ++(target->len);
target->list = realloc(target->list, target->len * (sizeof (char*))); target->list = realloc(target->list, target->len * (sizeof (char*)));
target->list_simple = realloc(target->list_simple, target->len * (sizeof (char*))); target->cmd = realloc(target->cmd, target->len * (sizeof (char*)));
target->cmd = realloc(target->cmd, target->len * (sizeof (char*)));
target->display_server = realloc( target->display_server = realloc(
target->display_server, target->display_server,
target->len * (sizeof (enum display_server))); target->len * (sizeof (enum display_server)));
@@ -193,23 +191,8 @@ void input_desktop_add(
return; return;
} }
target->list[target->cur] = name; target->list[target->cur] = name;
target->cmd[target->cur] = cmd;
int name_len = strlen(name);
char* name_simple = strdup(name);
if (strstr(name_simple, " ") != NULL)
{
name_simple = strtok(name_simple, " ");
}
for (int i = 0; i < name_len; i++)
{
name_simple[i] = tolower(name_simple[i]);
}
target->list_simple[target->cur] = name_simple;
target->cmd[target->cur] = cmd;
target->display_server[target->cur] = display_server; target->display_server[target->cur] = display_server;
} }

View File

@@ -2,8 +2,7 @@
#define H_LY_INPUTS #define H_LY_INPUTS
#include "termbox.h" #include "termbox.h"
#include "ctypes.h"
#include <stdint.h>
enum display_server {DS_WAYLAND, DS_SHELL, DS_XINITRC, DS_XORG}; enum display_server {DS_WAYLAND, DS_SHELL, DS_XINITRC, DS_XORG};
@@ -11,33 +10,32 @@ struct text
{ {
char* text; char* text;
char* end; char* end;
int64_t len; i64 len;
char* cur; char* cur;
char* visible_start; char* visible_start;
uint16_t visible_len; u16 visible_len;
uint16_t x; u16 x;
uint16_t y; u16 y;
}; };
struct desktop struct desktop
{ {
char** list; char** list;
char** list_simple;
char** cmd; char** cmd;
enum display_server* display_server; enum display_server* display_server;
uint16_t cur; u16 cur;
uint16_t len; u16 len;
uint16_t visible_len; u16 visible_len;
uint16_t x; u16 x;
uint16_t y; u16 y;
}; };
void handle_desktop(void* input_struct, struct tb_event* event); void handle_desktop(void* input_struct, struct tb_event* event);
void handle_text(void* input_struct, struct tb_event* event); void handle_text(void* input_struct, struct tb_event* event);
void input_desktop(struct desktop* target); void input_desktop(struct desktop* target);
void input_text(struct text* target, uint64_t len); void input_text(struct text* target, u64 len);
void input_desktop_free(struct desktop* target); void input_desktop_free(struct desktop* target);
void input_text_free(struct text* target); void input_text_free(struct text* target);
void input_desktop_right(struct desktop* target); void input_desktop_right(struct desktop* target);

View File

@@ -12,7 +12,6 @@
#include <pwd.h> #include <pwd.h>
#include <security/pam_appl.h> #include <security/pam_appl.h>
#include <signal.h> #include <signal.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -25,7 +24,7 @@
int get_free_display() int get_free_display()
{ {
char xlock[1024]; char xlock[1024];
uint8_t i; u8 i;
for (i = 0; i < 200; ++i) for (i = 0; i < 200; ++i)
{ {
@@ -213,14 +212,22 @@ void env_init(struct passwd* pwd)
char* lang = getenv("LANG"); char* lang = getenv("LANG");
// clean env // clean env
environ[0] = NULL; environ[0] = NULL;
setenv("TERM", term ? term : "linux", 1); if (term != NULL)
{
setenv("TERM", term, 1);
}
else
{
setenv("TERM", "linux", 1);
}
setenv("HOME", pwd->pw_dir, 1); setenv("HOME", pwd->pw_dir, 1);
setenv("PWD", pwd->pw_dir, 1); setenv("PWD", pwd->pw_dir, 1);
setenv("SHELL", pwd->pw_shell, 1); setenv("SHELL", pwd->pw_shell, 1);
setenv("USER", pwd->pw_name, 1); setenv("USER", pwd->pw_name, 1);
setenv("LOGNAME", pwd->pw_name, 1); setenv("LOGNAME", pwd->pw_name, 1);
setenv("LANG", lang ? lang : "C", 1); setenv("LANG", lang, 1);
// Set PATH if specified in the configuration // Set PATH if specified in the configuration
if (strlen(config.path)) if (strlen(config.path))
@@ -234,8 +241,15 @@ void env_init(struct passwd* pwd)
} }
} }
void env_xdg_session(const enum display_server display_server) void env_xdg(const char* tty_id, const enum display_server display_server)
{ {
char user[15];
snprintf(user, 15, "/run/user/%d", getuid());
setenv("XDG_RUNTIME_DIR", user, 0);
setenv("XDG_SESSION_CLASS", "user", 0);
setenv("XDG_SEAT", "seat0", 0);
setenv("XDG_VTNR", tty_id, 0);
switch (display_server) switch (display_server)
{ {
case DS_WAYLAND: case DS_WAYLAND:
@@ -257,18 +271,6 @@ void env_xdg_session(const enum display_server display_server)
} }
} }
void env_xdg(const char* tty_id, const char* desktop_name)
{
char user[20];
snprintf(user, 20, "/run/user/%d", getuid());
setenv("XDG_RUNTIME_DIR", user, 0);
setenv("XDG_SESSION_CLASS", "user", 0);
setenv("XDG_SESSION_ID", "1", 0);
setenv("XDG_SESSION_DESKTOP", desktop_name, 0);
setenv("XDG_SEAT", "seat0", 0);
setenv("XDG_VTNR", tty_id, 0);
}
void add_utmp_entry( void add_utmp_entry(
struct utmp *entry, struct utmp *entry,
char *username, char *username,
@@ -301,51 +303,10 @@ void remove_utmp_entry(struct utmp *entry) {
endutent(); endutent();
} }
void xauth(const char* display_name, const char* shell, char* pwd) void xauth(const char* display_name, const char* shell, const char* dir)
{ {
const char* xauth_file = "lyxauth";
char* xauth_dir = getenv("XDG_RUNTIME_DIR");
if ((xauth_dir == NULL) || (*xauth_dir == '\0'))
{
xauth_dir = getenv("XDG_CONFIG_HOME");
struct stat sb;
if ((xauth_dir == NULL) || (*xauth_dir == '\0'))
{
xauth_dir = strdup(pwd);
strcat(xauth_dir, "/.config");
stat(xauth_dir, &sb);
if (S_ISDIR(sb.st_mode))
{
strcat(xauth_dir, "/ly");
}
else
{
xauth_dir = pwd;
xauth_file = ".lyxauth";
}
}
else
{
strcat(xauth_dir, "/ly");
}
// If .config/ly/ or XDG_CONFIG_HOME/ly/ doesn't exist and can't create the directory, use pwd
// Passing pwd beforehand is safe since stat will always evaluate false
stat(xauth_dir, &sb);
if (!S_ISDIR(sb.st_mode) && mkdir(xauth_dir, 0777) == -1)
{
xauth_dir = pwd;
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", xauth_dir, xauth_file); snprintf(xauthority, 256, "%s/%s", dir, ".lyxauth");
setenv("XAUTHORITY", xauthority, 1); setenv("XAUTHORITY", xauthority, 1);
setenv("DISPLAY", display_name, 1); setenv("DISPLAY", display_name, 1);
@@ -381,10 +342,18 @@ 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, pwd->pw_dir); xauth(display_name, pwd->pw_shell, xauth_dir);
// start xorg // start xorg
pid_t pid = fork(); pid_t pid = fork();
@@ -501,13 +470,6 @@ void auth(
{ {
int ok; int ok;
char tty_id [3];
snprintf(tty_id, 3, "%d", config.tty);
// Add XDG environment variables
env_xdg_session(desktop->display_server[desktop->cur]);
env_xdg(tty_id, desktop->list_simple[desktop->cur]);
// open pam session // open pam session
const char* creds[2] = {login->text, password->text}; const char* creds[2] = {login->text, password->text};
struct pam_conv conv = {login_conv, creds}; struct pam_conv conv = {login_conv, creds};
@@ -568,7 +530,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)
@@ -589,7 +551,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)
@@ -615,14 +577,14 @@ void auth(
} }
// get a display // get a display
char tty_id [3];
char vt[5]; char vt[5];
snprintf(tty_id, 3, "%d", config.tty);
snprintf(vt, 5, "vt%d", config.tty); snprintf(vt, 5, "vt%d", config.tty);
// set env (this clears the environment) // set env
env_init(pwd); env_init(pwd);
// Re-add XDG environment variables from lines 508,509
env_xdg_session(desktop->display_server[desktop->cur]);
env_xdg(tty_id, desktop->list_simple[desktop->cur]);
if (dgn_catch()) if (dgn_catch())
{ {
@@ -632,11 +594,14 @@ void auth(
// add pam variables // add pam variables
char** env = pam_getenvlist(handle); char** env = pam_getenvlist(handle);
for (uint16_t i = 0; env && env[i]; ++i) for (u16 i = 0; env && env[i]; ++i)
{ {
putenv(env[i]); putenv(env[i]);
} }
// add xdg variables
env_xdg(tty_id, desktop->display_server[desktop->cur]);
// execute // execute
int ok = chdir(pwd->pw_dir); int ok = chdir(pwd->pw_dir);
@@ -692,21 +657,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

@@ -2,6 +2,7 @@
#include "configator.h" #include "configator.h"
#include "dragonfail.h" #include "dragonfail.h"
#include "termbox.h" #include "termbox.h"
#include "ctypes.h"
#include "draw.h" #include "draw.h"
#include "inputs.h" #include "inputs.h"
@@ -9,20 +10,15 @@
#include "utils.h" #include "utils.h"
#include "config.h" #include "config.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#define ARG_COUNT 7 #define ARG_COUNT 7
// things you can define:
#ifndef LY_VERSION // GIT_VERSION_STRING
#define LY_VERSION "0.6.0"
#endif
// global // global
struct lang lang; struct lang lang;
@@ -31,14 +27,16 @@ 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("If you want to configure Ly, please check the config file, usually located at /etc/ly/config.ini.\n"); printf("RTFM\n");
exit(0);
} }
void arg_version(void* data, char** pars, const int pars_count) void arg_version(void* data, char** pars, const int pars_count)
{ {
printf("Ly version %s\n", LY_VERSION); #ifdef GIT_VERSION_STRING
exit(0); printf("Ly version %s\n", GIT_VERSION_STRING);
#else
printf("Ly version unknown\n");
#endif
} }
// low-level error messages // low-level error messages
@@ -109,7 +107,11 @@ int main(int argc, char** argv)
} }
config_load(config_path); config_load(config_path);
lang_load();
if (strcmp(config.lang, "en") != 0)
{
lang_load();
}
void* input_structs[3] = void* input_structs[3] =
{ {
@@ -136,27 +138,13 @@ int main(int argc, char** argv)
// init visible elements // init visible elements
struct tb_event event; struct tb_event event;
struct term_buf buf; struct term_buf buf;
u8 active_input = config.default_input;
//Place the curser on the login field if there is no saved username, if there is, place the curser on the password field
uint8_t active_input;
if (config.default_input == LOGIN_INPUT && login.text != login.end){
active_input = PASSWORD_INPUT;
}
else{
active_input = config.default_input;
}
(*input_handles[active_input])(input_structs[active_input], NULL);
// init drawing stuff // init drawing stuff
draw_init(&buf); draw_init(&buf);
// draw_box and position_input are called because they need to be
// called before *input_handles[active_input] for the cursor to be
// positioned correctly
draw_box(&buf);
position_input(&buf, &desktop, &login, &password);
(*input_handles[active_input])(input_structs[active_input], NULL);
if (config.animate) if (config.animate)
{ {
animate_init(&buf); animate_init(&buf);
@@ -174,7 +162,7 @@ int main(int argc, char** argv)
bool update = true; bool update = true;
bool reboot = false; bool reboot = false;
bool shutdown = false; bool shutdown = false;
uint8_t auth_fails = 0; u8 auth_fails = 0;
switch_tty(&buf); switch_tty(&buf);
@@ -185,15 +173,11 @@ int main(int argc, char** argv)
{ {
if (auth_fails < 10) if (auth_fails < 10)
{ {
(*input_handles[active_input])(input_structs[active_input], NULL);
tb_clear(); tb_clear();
animate(&buf); animate(&buf);
draw_bigclock(&buf);
draw_box(&buf); draw_box(&buf);
draw_clock(&buf);
draw_labels(&buf); draw_labels(&buf);
if(!config.hide_f1_commands) draw_f_commands();
draw_f_commands();
draw_lock_state(&buf); draw_lock_state(&buf);
position_input(&buf, &desktop, &login, &password); position_input(&buf, &desktop, &login, &password);
draw_desktop(&desktop); draw_desktop(&desktop);
@@ -210,30 +194,7 @@ int main(int argc, char** argv)
tb_present(); tb_present();
} }
int timeout = -1; error = tb_peek_event(&event, config.min_refresh_delta);
if (config.animate)
{
timeout = config.min_refresh_delta;
}
else
{
struct timeval tv;
gettimeofday(&tv, NULL);
if (config.bigclock)
timeout = (60 - tv.tv_sec % 60) * 1000 - tv.tv_usec / 1000 + 1;
if (config.clock)
timeout = 1000 - tv.tv_usec / 1000 + 1;
}
if (timeout == -1)
{
error = tb_poll_event(&event);
}
else
{
error = tb_peek_event(&event, timeout);
}
if (error < 0) if (error < 0)
{ {
@@ -259,10 +220,8 @@ int main(int argc, char** argv)
if (active_input > 0) if (active_input > 0)
{ {
input_text_clear(input_structs[active_input]); input_text_clear(input_structs[active_input]);
update = true;
} }
break; break;
case TB_KEY_CTRL_K:
case TB_KEY_ARROW_UP: case TB_KEY_ARROW_UP:
if (active_input > 0) if (active_input > 0)
{ {
@@ -270,7 +229,6 @@ int main(int argc, char** argv)
update = true; update = true;
} }
break; break;
case TB_KEY_CTRL_J:
case TB_KEY_ARROW_DOWN: case TB_KEY_ARROW_DOWN:
if (active_input < 2) if (active_input < 2)
{ {
@@ -283,7 +241,7 @@ int main(int argc, char** argv)
if (active_input > 2) if (active_input > 2)
{ {
active_input = SESSION_SWITCH; active_input = PASSWORD_INPUT;
} }
update = true; update = true;
break; break;
@@ -345,7 +303,8 @@ int main(int argc, char** argv)
{ {
execl("/bin/sh", "sh", "-c", config.shutdown_cmd, NULL); execl("/bin/sh", "sh", "-c", config.shutdown_cmd, NULL);
} }
else if (reboot)
if (reboot)
{ {
execl("/bin/sh", "sh", "-c", config.restart_cmd, NULL); execl("/bin/sh", "sh", "-c", config.restart_cmd, NULL);
} }

View File

@@ -1,12 +1,12 @@
#include "configator.h" #include "configator.h"
#include "dragonfail.h" #include "dragonfail.h"
#include "inputs.h" #include "inputs.h"
#include "config.h" #include "config.h"
#include "utils.h" #include "utils.h"
#include <dirent.h> #include <dirent.h>
#include <limits.h> #include <limits.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

Submodule sub/argoat updated: e1844c4c94...76d1e23b5e

1
sub/ctypes Submodule

Submodule sub/ctypes added at eb4b36559d

Submodule sub/dragonfail updated: 15bd3299bf...0a2492c6aa

Submodule sub/termbox_next updated: d961a81222...23fff64470