Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cylgom committed Jun 10, 2019
1 parent 2d93bc7 commit 61fd099
Show file tree
Hide file tree
Showing 25 changed files with 3,280 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitea
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[submodule "sub/argoat"]
path = sub/argoat
url = https://git.cylgom.net/cylgom/argoat.git
[submodule "sub/configator"]
path = sub/configator
url = https://git.cylgom.net/cylgom/configator.git
[submodule "sub/ctypes"]
path = sub/ctypes
url = https://git.cylgom.net/cylgom/ctypes.git
[submodule "sub/dragonfail"]
path = sub/dragonfail
url = https://git.cylgom.net/cylgom/dragonfail.git
[submodule "sub/termbox_next"]
path = sub/termbox_next
url = https://git.cylgom.net/cylgom/termbox_next.git
15 changes: 15 additions & 0 deletions .github
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[submodule "sub/argoat"]
path = sub/argoat
url = https://github.com/cylgom/argoat.git
[submodule "sub/configator"]
path = sub/configator
url = https://github.com/cylgom/configator.git
[submodule "sub/ctypes"]
path = sub/ctypes
url = https://github.com/cylgom/ctypes.git
[submodule "sub/dragonfail"]
path = sub/dragonfail
url = https://github.com/cylgom/dragonfail.git
[submodule "sub/termbox_next"]
path = sub/termbox_next
url = https://github.com/cylgom/termbox_next.git
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bin
obj
.gitmodules
valgrind.log
13 changes: 13 additions & 0 deletions license.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.
105 changes: 105 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
NAME = ly
CC = gcc
FLAGS = -std=c99 -pedantic -g
FLAGS+= -Wall -Wno-unused-parameter -Wextra -Werror=vla -Werror
#FLAGS+= -DDEBUG
FLAGS+= -DGIT_VERSION_STRING=\"$(shell git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')\"
LINK = -lpam -lxcb
VALGRIND = --show-leak-kinds=all --track-origins=yes --leak-check=full --suppressions=../res/valgrind.supp
CMD = ./$(NAME)

OS:= $(shell uname -s)
ifeq ($(OS), Linux)
FLAGS+= -D_DEFAULT_SOURCE
endif

BIND = bin
OBJD = obj
SRCD = src
SUBD = sub
RESD = res
TESTD = tests

INCL = -I$(SRCD)
INCL+= -I$(SUBD)/ctypes
INCL+= -I$(SUBD)/argoat/src
INCL+= -I$(SUBD)/configator/src
INCL+= -I$(SUBD)/dragonfail/src
INCL+= -I$(SUBD)/termbox_next/src

SRCS = $(SRCD)/main.c
SRCS += $(SRCD)/config.c
SRCS += $(SRCD)/draw.c
SRCS += $(SRCD)/inputs.c
SRCS += $(SRCD)/login.c
SRCS += $(SRCD)/utils.c
SRCS += $(SUBD)/argoat/src/argoat.c
SRCS += $(SUBD)/configator/src/configator.c
SRCS += $(SUBD)/dragonfail/src/dragonfail.c

SRCS_OBJS:= $(patsubst %.c,$(OBJD)/%.o,$(SRCS))
SRCS_OBJS+= $(SUBD)/termbox_next/bin/termbox.a

.PHONY: final
final: $(BIND)/$(NAME)

$(OBJD)/%.o: %.c
@echo "building object $@"
@mkdir -p $(@D)
@$(CC) $(INCL) $(FLAGS) -c -o $@ $<

$(SUBD)/termbox_next/bin/termbox.a:
@echo "building static object $@"
@(cd $(SUBD)/termbox_next && $(MAKE))

$(BIND)/$(NAME): $(SRCS_OBJS)
@echo "compiling executable $@"
@mkdir -p $(@D)
@$(CC) -o $@ $^ $(LINK)

run:
@cd $(BIND) && $(CMD)

leak: leakgrind
leakgrind: $(BIND)/$(NAME)
@rm -f valgrind.log
@cd $(BIND) && valgrind $(VALGRIND) 2> ../valgrind.log $(CMD)
@less valgrind.log

install: $(BIND)/$(NAME)
@echo "installing"
@install -dZ ${DESTDIR}/etc/ly
@install -DZ $(BIND)/$(NAME) -t ${DESTDIR}/usr/bin
@install -DZ $(RESD)/xsetup.sh -t ${DESTDIR}/etc/ly
@install -DZ $(RESD)/wsetup.sh -t ${DESTDIR}/etc/ly
@install -DZ $(RESD)/config.ini -t ${DESTDIR}/etc/ly
@install -dZ ${DESTDIR}/etc/ly/lang
@install -DZ $(RESD)/lang/* -t ${DESTDIR}/etc/ly/lang
@install -DZ $(RESD)/ly.service -t ${DESTDIR}/usr/lib/systemd/system

uninstall:
@echo "uninstalling"
@rm -rf ${DESTDIR}/etc/ly
@rm -f ${DESTDIR}/usr/bin/ly
@rm -f ${DESTDIR}/usr/lib/systemd/system/ly.service

clean:
@echo "cleaning"
@rm -rf $(BIND) $(OBJD) valgrind.log
@(cd $(SUBD)/termbox_next && $(MAKE) clean)

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 https://git.cylgom.net"
@cp .gitea .gitmodules
@git submodule sync
@git submodule update --init --remote
@cd $(SUBD)/argoat && make gitea
@git submodule update --init --recursive --remote
104 changes: 104 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Ly - a TUI display manager
[![CodeFactor](https://www.codefactor.io/repository/github/cylgom/ly/badge/master)](https://www.codefactor.io/repository/github/cylgom/ly/overview/master)
![Ly screenshot](https://user-images.githubusercontent.com/5473047/42466218-8cb53d3c-83ae-11e8-8e53-bae3669f959c.png "Ly screenshot")

Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD.

## Dependencies
- a C99 compiler (tested with tcc and gcc)
- a C standard library
- make
- pam
- xcb
- xorg
- xorg-xauth
- mcookie
- tput
- shutdown

## Support
The following desktop environments were tested with success
- budgie
- cinnamon
- deepin
- enlightenment
- gnome
- i3
- kde
- lxde
- lxqt
- mate
- sway
- xfce
- pantheon

Ly should work with any X desktop environment, and provides
basic wayland support (sway works very well, for example).

## systemd?
Unlike what you may have heard, Ly does not require `systemd`,
and was even specifically designed not to depend on `logind`.
You should be able to make it work easily with a better init,
changing the source code won't be necessary :)

## Cloning and Compiling
Clone the repository
```
git clone https://github.com/cylgom/ly.git
```

Fetch submodules
```
make github
```

Compile
```
make
```

Test in the configured tty (tty2 by default)
or a terminal emulator (but desktop environments won't start)
```
sudo make run
```

Install Ly and the provided systemd service file
```
sudo make install
```

Enable the service
```
sudo systemctl enable ly.service
```

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
```
sudo systemctl disable getty@tty2.service
```

## Configuration
You can find all the configuration in `/etc/ly/config.ini`.
The file is commented, and includes the default values.

## Controls
Use the up and down arrow keys to change the current field, and the
left and right arrow keys to change the target desktop environment
while on the desktop field (above the login field).

## Tips
The numlock and capslock state is printed in the top-right corner.
Use the F1 and F2 keys to respectively shutdown and reboot.
Take a look at your .xsession if X doesn't start, as it can interfere
(this file is launched with X to configure the display properly).

## PSX DOOM fire animation
To enable the famous PSX DOOM fire described by [Fabien Sanglard](http://fabiensanglard.net/doom_fire_psx/index.html),
just uncomment `animate = true` in `/etc/ly/config.ini`. You may also
disable the main box borders with `hide_borders = true`.

## Additional Information
The name "Ly" is a tribute to the fairy from the game Rayman.
Ly was tested by oxodao, who is some seriously awesome dude.
99 changes: 99 additions & 0 deletions res/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# animation enabled
#animate = false
#animate = true

# the active animation (only animation '0' available for now)
#animation = 0

# the char used to mask the password
#asterisk = *
#asterisk = o

# background color id
#bg = 0

# blank main box
#blank_box = true

# erase password input on failure
#blank_password = true

# 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_v = 1

# total input sizes
#max_desktop_len = 100
#max_login_len = 255
#max_password_len = 255

# cookie generator
#mcookie_cmd = /usr/bin/mcookie

# event timeout in milliseconds
#min_refresh_delta = 5

# default path
#path = /sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/env

# command executed when pressing F2
#restart_cmd = /sbin/shutdown -r now

# save the current desktop and login as defaults
#save = true

# file in which to save and load the default desktop and login
#save_file = /etc/ly/save

# service name (pam needs this set to login)
#service_name = login

# 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 = 2

# wayland setup command
#wayland_cmd = /etc/ly/wsetup.sh

# wayland desktop environments
#waylandsessions = /usr/share/wayland-sessions

# xorg server command
#x_cmd = /usr/bin/X

# xorg setup command
#x_cmd_setup = /etc/ly/xsetup.sh

# xorg xauthority edition tool
#xauth_cmd = /usr/bin/xauth

# xorg desktop environments
#xsessions = /usr/share/xsessions
Loading

0 comments on commit 61fd099

Please sign in to comment.