diff --git a/Makefile b/Makefile index 0f7c6b7..eb4c58b 100644 --- a/Makefile +++ b/Makefile @@ -133,6 +133,7 @@ install-service-s6-etc: pre-commit: codespell + prettier --write "**/*.md" find . -type f -name '*.sh' -not -path './assets/pkg/aur/*/src/*' | xargs shellcheck clang-format -i $$(git ls-files "*.c" "*.h") clang-tidy -p . $$(git ls-files "*.c" "*.h") diff --git a/README.md b/README.md index 753f029..09c35c8 100644 --- a/README.md +++ b/README.md @@ -10,26 +10,23 @@ LiDM is like any [Display Manager](https://en.wikipedia.org/wiki/X_display_manag ![demo gif](assets/media/lidm.gif) -> *shown as in a featured terminal emulator, actual linux console doesn't support as much color and decorations* +> _shown as in a featured terminal emulator, actual linux console doesn't support as much color and decorations_ -> *however, all colors and strings are fully customizable* +> _however, all colors and strings are fully customizable_ ## Features -* Simple as C, you only need a C compiler and standard unix libraries to build this. -* Fully customizable, from strings, including action keys, to colors (I hope you know ansi escape codes) -* Automatically detects xorg and wayland sessions, plus allowing to launch the default user shell (if enabled in config) -* Starts with many init systems (systemd, dinit, runit, openrc and s6). +- Simple as C, you only need a C compiler and standard unix libraries to build this. +- Fully customizable, from strings, including action keys, to colors (I hope you know ansi escape codes) +- Automatically detects xorg and wayland sessions, plus allowing to launch the default user shell (if enabled in config) +- Starts with many init systems (systemd, dinit, runit, openrc and s6). -# Index +# Table of Contents -- [LiDM](#lidm) - - [Features](#features) -- [Index](#index) - [Ideology](#ideology) - [Usage](#usage) - - [Arguments](#arguments) - - [Program](#program) + - [Arguments](#arguments) + - [Program](#program) - [Requirements](#requirements) - [Installation](#installation) - [Configuring](#configuring) @@ -44,7 +41,7 @@ We all know that the most important thing in a project is the ideology of the au [ ![stopchatcontrol](https://stopchatcontrol.eu/wp-content/uploads/2023/09/1-1-1024x1024.png) ](https://stopchatcontrol.eu) -> *there's also a [change.org post](https://www.change.org/p/stoppt-die-chatkontrolle-grundrechte-gelten-auch-im-netz).* +> _there's also a [change.org post](https://www.change.org/p/stoppt-die-chatkontrolle-grundrechte-gelten-auch-im-netz)._ # Usage @@ -56,25 +53,33 @@ If a single argument is provided (don't even do `--` or standard unix parsing... Base (mostly intuitive): -* Use arrow keys to navigate the inputs and type over any of them to override the default value. -* Enter will just attempt to login. -* If you are focused on an edited input, horizontal arrow keys will attempt to move across the text just as expected. +- Use arrow keys to navigate the inputs and type over any of them to override the default value. +- Enter will just attempt to login. +- If you are focused on an edited input, horizontal arrow keys will attempt to move across the text just as expected. On top of that: -* Using the horizontal arrow keys if the focused input is not in text mode or the movement would overflow the input. It will try to change in such direction the option of session or the user. -* Pressing ESC and then horizontal arrows will force to change the option of the focused input even if it's in edit mode. -* Editing an option on a user or a shell session will put you in edit mode appending after the original value. +- Using the horizontal arrow keys if the focused input is not in text mode or the movement would overflow the input. It will try to change in such direction the option of session or the user. +- Pressing ESC and then horizontal arrows will force to change the option of the focused input even if it's in edit mode. +- Editing an option on a user or a shell session will put you in edit mode appending after the original value. # Requirements -* Make (Also optional, but does things automatically, make sure `gcc` and `mkdir -p` work as expected). -* A compiler like `cc`, `gcc` or `clang`. Make sure to use the desired `CC=` on the `make` command. -* PAM library, used for user authentication, just what `login` or `su` use internally. Don't worry, it's surely pre-installed. +- Make (Also optional, but does things automatically, make sure `gcc` and `mkdir -p` work as expected). +- A compiler like `cc`, `gcc` or `clang`. Make sure to use the desired `CC=` on the `make` command. +- PAM library, used for user authentication, just what `login` or `su` use internally. Don't worry, it's surely pre-installed. # Installation -Check the [installation guide](INSTALL.md) to use your preferred installation source. +Check the [installation guide](./docs/INSTALL.md) to use your preferred installation source. + +
+ +Packagers read here!! + +If you are a package maintainer or are willing to become one, please read [the packagers guide](./docs/PACKAGERS.md). + +
# Configuring @@ -92,7 +97,7 @@ Colors are gonna be put inside `\x1b[...m`, if you don't know what this is check # PAM -If your distribution does not use the standard PAM service name `login` (`/etc/pam.d/login`) for its PAM services or if you want to use another PAM file, simply set the `LIDM_PAM_SERVICE` env variable to your PAM service name. +If your distribution does not use the standard PAM service name `login` (`/etc/pam.d/login`) for its PAM services or if you want to use another PAM file, simply set the `LIDM_PAM_SERVICE` env variable to your PAM service name. When the env variable is empty it defaults to the `login` PAM service or whatever fallback your distribution packager has defined during compilation. @@ -108,21 +113,21 @@ For this reason the project's philosophy is to be simple and minimal, such that I forgot what exactly the name came from, but it surely was a mix of a few things so: -* Obviously it's inspired by `ly`. `ly-dm` leads to "lydm". -* Wow make "lydm" simple with a "y" → "i" transformation. -* Associate it with the "i" in s**i**mple and other display managers like **Li**ghtDM. -* And the **la**ptop this project started in has a **lid**. +- Obviously it's inspired by `ly`. `ly-dm` leads to "lydm". +- Wow make "lydm" simple with a "y" → "i" transformation. +- Associate it with the "i" in s**i**mple and other display managers like **Li**ghtDM. +- And the **la**ptop this project started in has a **lid**. # Contributors -[![GitHub Contributors](https://contrib.rocks/image?repo=javalsai/lidm\&max=20)](https://github.com/javalsai/lidm/graphs/contributors) +[![GitHub Contributors](https://contrib.rocks/image?repo=javalsai/lidm&max=20)](https://github.com/javalsai/lidm/graphs/contributors) [killertofus](https://github.com/killertofus), [deadvey](https://github.com/deadvey), [grialion](https://github.com/grialion/), cerealexperiments\_, [antiz96](https://github.com/Antiz96), [rmntgx](https://github.com/rmntgx) and [more...](https://github.com/javalsai/lidm/graphs/contributors) With their big or small contributions, every commit has helped in its own way and encouraged me to keep putting my soul into this. -*** +--- 🌟 Finally, consider starring this repo [or...](https://www.reddit.com/r/github/comments/1l2mchg/is_this_allowed) 🔪 -![star-history](https://api.star-history.com/svg?repos=javalsai/lidm\&type=Date) +![star-history](https://api.star-history.com/svg?repos=javalsai/lidm&type=Date) diff --git a/assets/pkg/aur/README.md b/assets/pkg/aur/README.md index e5df888..637a1fa 100644 --- a/assets/pkg/aur/README.md +++ b/assets/pkg/aur/README.md @@ -4,9 +4,9 @@ These files are just for reference, I'll manually edit and publish them, at leas There are three packages that follow standard conventions: -* [`lidm`](https://aur.archlinux.org/packages/lidm): Builds latest release (manually updated per release basis) -* [`lidm-bin`](https://aur.archlinux.org/packages/lidm-bin): Fetches latest release binary (compiled by GitHub Actions, also updated per release) -* [`lidm-git`](https://aur.archlinux.org/packages/lidm-git): Fetches latest commit and builds it (should be updated automatically) +- [`lidm`](https://aur.archlinux.org/packages/lidm): Builds latest release (manually updated per release basis) +- [`lidm-bin`](https://aur.archlinux.org/packages/lidm-bin): Fetches latest release binary (compiled by GitHub Actions, also updated per release) +- [`lidm-git`](https://aur.archlinux.org/packages/lidm-git): Fetches latest commit and builds it (should be updated automatically) > \[!IMPORTANT] > None of those packages include the service files. [You have to do this yourself](../../services/README.md). diff --git a/assets/services/README.md b/assets/services/README.md index 75dc409..bd98bbc 100644 --- a/assets/services/README.md +++ b/assets/services/README.md @@ -13,30 +13,30 @@ The manual steps for installation are: ## Systemd -* Copy `systemd.service` to `/etc/systemd/system/lidm.service` -* To enable it you can run `systemctl enable lidm` +- Copy `systemd.service` to `/etc/systemd/system/lidm.service` +- To enable it you can run `systemctl enable lidm` ## Dinit -* Copy `dinit` to `/etc/dinit.d/lidm` -* To enable it, run `dinitctl enable lidm` +- Copy `dinit` to `/etc/dinit.d/lidm` +- To enable it, run `dinitctl enable lidm` ## Runit -* Copy `runit/` to `/etc/runit/sv/lidm/` -* Add the service with `ln -s /etc/runit/sv/lidm /run/runit/service` -* And to enable it `sv enable lidm` +- Copy `runit/` to `/etc/runit/sv/lidm/` +- Add the service with `ln -s /etc/runit/sv/lidm /run/runit/service` +- And to enable it `sv enable lidm` ## OpenRC -* Copy `openrc` to `/etc/init.d/lidm` -* Enable the service with `rc-update add lidm` +- Copy `openrc` to `/etc/init.d/lidm` +- Enable the service with `rc-update add lidm` ## S6 -* Copy `s6/` to `/etc/s6/sv/lidm/` -* Add the service with `s6-service add default lidm` -* Reload the database with `s6-db-reload` (you might have to run this every time the service file changes) +- Copy `s6/` to `/etc/s6/sv/lidm/` +- Add the service with `s6-service add default lidm` +- Reload the database with `s6-db-reload` (you might have to run this every time the service file changes) > [!WARNING] > Make sure to disable any other service that might run on tty7, such us lightdm or most display managers out there. diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index be18795..5f7b5ed 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -13,33 +13,33 @@ For small fixes or incremental improvements simply fork the repo and follow the 1. [Fork](https://help.github.com/articles/fork-a-repo/) the repository and [clone](https://help.github.com/articles/cloning-a-repository/) your fork. -2. Start coding! (it might be helpful to read a [quide on the project structure and conventions](structure.md) before this) - * Configure clangd LSP by generating `compile_commands.json` (e.g. `bear -- make` or `compiledb make`) - * Implement your feature. - * Check your code works as expected. - * Run the code formatter: `clang-format -i $(git ls-files "*.c" "*.h")` - * Run the code linter: `clang-tidy -p . $(git ls-files "*.c" "*.h")`. Some checks are pretty pedantic, feel free to ignore or debate some of the rules. - * If you prefer, you can run `make pre-commit` to run several code style checks like the above along a few extra stuff. +2. Start coding! (it might be helpful to read a [quide on the project structure and conventions](./structure.md) before this) + - Configure clangd LSP by generating `compile_commands.json` (e.g. `bear -- make` or `compiledb make`) + - Implement your feature. + - Check your code works as expected. + - Run the code formatter: `clang-format -i $(git ls-files "*.c" "*.h")`. + - Run the code linter: `clang-tidy -p . $(git ls-files "*.c" "*.h")`. Some checks are pretty pedantic, feel free to ignore or debate some of the rules. + - If you prefer, you can run `make pre-commit` to run several code style checks like the above along a few extra stuff (shellcheck, spellcheck, prettier, etc). 3. Commit your changes to a new branch (not `master`, one change per branch) and push it: - * Commit messages should: - * Header line: explain the commit in one line (use the imperative) ("feat" for features, "fix", "style", "chore", "docs", etc) - * Be descriptive. - * Don't make the title too long and add commit descriptions if you think the changes need it. - * e.g. "feat: add support for X", "fix(config): config parser segfaulting", "docs(typo): fix a typo in README.md" + - Commit messages should: + - Header line: explain the commit in one line (use the imperative) ("feat" for features, "fix", "style", "chore", "docs", etc) + - Be descriptive. + - Don't make the title too long and add commit descriptions if you think the changes need it. + - e.g. "feat: add support for X", "fix(config): config parser segfaulting", "docs(typo): fix a typo in README.md" 4. Once you are happy with your changes, submit a pull request. - * Open the pull request. - * Add a short description explaining what you've done (or if it's a work-in-progress - what you need to do) + - Open the pull request. + - Add a short description explaining what you've done (or if it's a work-in-progress - what you need to do) ## Issues 1. Do a quick search on GitHub to check if the issue has already been reported. 2. [Open an issue](https://github.com//javalsai/lidm/issues/new) and describe the issue you are having - you could include: - * Screenshots. - * Ways to reproduce the issue. - * Your lidm version. - * Your platform (e.g. arch linux or Ubuntu 15.04 x64) and init system if you know. + - Screenshots. + - Ways to reproduce the issue. + - Your lidm version. + - Your platform (e.g. arch linux or Ubuntu 15.04 x64) and init system if you know. After reporting you should aim to answer questions or clarifications as this helps pinpoint the cause of the issue. diff --git a/INSTALL.md b/docs/INSTALL.md similarity index 89% rename from INSTALL.md rename to docs/INSTALL.md index dcc0de9..e345c0b 100644 --- a/INSTALL.md +++ b/docs/INSTALL.md @@ -1,6 +1,5 @@ -# Index +# Table of Contents -- [Index](#index) - [Installing from Source](#installing-from-source) - [AUR](#aur) - [Nix Flake](#nix-flake) @@ -53,7 +52,7 @@ make install-service-s6-etc # s6 (/etc/s6/sv) # AUR -[AUR packages](https://aur.archlinux.org/packages?K=lidm\&SeB=n) will automatically install most files. +[AUR packages](https://aur.archlinux.org/packages?K=lidm&SeB=n) will automatically install most files. > [!CAUTION] > [service files](./assets/pkg/aur#services) have to be manually installed by now. @@ -99,9 +98,9 @@ systemd.services.lidm.enable = true; Optionally, you can configure it setting `services.lidm.config`. You can either pass: -* A string to copy the config from a theme in `themes/` with said name +- A string to copy the config from a theme in `themes/` with said name (**name**, e.g `"cherry"`). -* An attribute tree with the same names as the config file, e.g: +- An attribute tree with the same names as the config file, e.g: ```nix with config.lidm.keysEnum; { @@ -123,8 +122,7 @@ with config.lidm.keysEnum; { }; ``` -> *it's not necessary to cover all keys and anything can be put there, even if -> its not valid config* +> _it's not necessary to cover all keys and anything can be put there, even if it's not valid config_ > [!NOTE] > [service files](./assets/pkg/aur#services) **are** included and enabled diff --git a/docs/PACKAGERS.md b/docs/PACKAGERS.md new file mode 100644 index 0000000..a94d835 --- /dev/null +++ b/docs/PACKAGERS.md @@ -0,0 +1,62 @@ +This is a guide listing all possible options packagers have to tweak behavior of lidm and the extra stuff to package. + +# Components + +If you want to package lidm for a distribution you have to package the binary and: + +- Man pages ([`../assets/man/`](../assets/man/)) +- Service files ([`../assets/services/`](../assets/services/)) +- PAM (see [#preprocessor-defines](#preprocessor-defines)) +- And optionally you can include some default themes in `/usr` ([`../themes/`](../themes/)) + +# Preprocessor Defines + +Most of the behavior that can be tweaked using preprocessor `#define`s, to include some simply add `CPPFLAGS+='-D{{name}}={{value}}'` to your `make` command. e.g: + +```sh +make \ + CPPFLAGS+='-DSESSIONS_XSESSIONS=\"/var/empty\"' \ + CPPFLAGS+='-DSESSIONS_WAYLAND=\"/var/empty\"' +``` + +The list of possible `#define`s is: + +| Name | Default | Description | Env Override? | +| ---------------------- | ------------------------------- | -------------------------------------------------------------------------- | ------------------------ | +| `PAM_SERVICE_FALLBACK` | `"login"` | Name of the default PAM module to use. Defaults to the distro's `"login"`. | Yes (`LIDM_PAM_SERVICE`) | +| `SESSIONS_XSESSIONS` | `"/usr/share/xsessions"` | | No | +| `SESSIONS_WAYLAND` | `"/usr/share/wayland-sessions"` | | No | +| `LIDM_CONF_PATH` | `"/etc/lidm.ini"` | Path of the default configuration. | Yes (`LIDM_CONF`) | + +# Other Build Settings + +## Compiler + +Lidm attempts to support being built by `gcc` and `clang` with preference over the first. However, if you wish to take advantage of LLVM's optimizations over GNU's you can change the compiler with `make CC=clang` or try any other compiler. + +## Compiler Flags + +Compiler flags should be passed with `CFLAGS`, its `-O3 -Wall` by default so adding anything will overwrite this. + +## Target Directory + +`DESTDIR` can be used to for installation recipes to install on alternative root directories. Along with `PREFIX` (defaults to `/usr`) for systems which don't use the common `/usr` structure. e.g. `make install DESTDIR=$out PREFIX=` + +```txt +$ fd -t f . --base-directory $out +bin/lidm +etc/lidm.ini +share/man/man1/lidm.1 +share/man/man5/lidm-config.5 +``` + +# Build Recipes for Packaging + +To ease most of the installation process there's several `make` recipes to install man pages and service files, I encpurage you to check their source yourself, but: + +- `make` / `make lidm`: Builds the app binary. +- `make install`: Attempts to install the binary, place a default config file in `/etc/lidm.ini` and install the man pages. +- `make install-service-(systemd|dinit|runit|openrc|s6)(|-etc)`: Just check the source, service files for different init systems and `-etc` variants for alternative paths. +- `make print-version`: Outputs the current version in the `Makefile` for scripts that might want to extract that info. + +You can choose to use these packages or create your own service files / etc. There's are merely suggestions on what to use.