mirror of
https://github.com/javalsai/lidm.git
synced 2025-08-30 18:08:00 +02:00
Compare commits
2 Commits
4a1b868b8e
...
7e1ec83c7f
Author | SHA1 | Date | |
---|---|---|---|
7e1ec83c7f
|
|||
8f0213db74 |
22
.github/workflows/check.yml
vendored
22
.github/workflows/check.yml
vendored
@@ -30,14 +30,22 @@ jobs:
|
||||
|
||||
clangcheck:
|
||||
name: Clang
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:25.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: "clang-format clang-tidy bear libpam0g-dev"
|
||||
version: 1.0
|
||||
- run: apt -y update && apt install -y clang-format clang-tidy make gcc git bear libpam0g-dev
|
||||
|
||||
- run: bear -- make
|
||||
- run: clang-format -ni src/*.c include/*.h
|
||||
- run: clang-tidy -p . src/*.c include/*.h
|
||||
- run: clang-format -version && clang-format -dump-config
|
||||
- run: |
|
||||
set -euo pipefail
|
||||
clang-format -ni src/*.c include/*.h -Werror 2>&1 | \
|
||||
sed -E 's/^([^ ]+\.[ch]):([0-9]+):([0-9]+): ([a-z]+): (.*)$/::\4 file=\1,line=\2,col=\3::\5/'
|
||||
- run: clang-tidy -version && clang-tidy -dump-config
|
||||
- run: |
|
||||
set -euo pipefail
|
||||
clang-tidy -p . src/*.c include/*.h -warnings-as-errors=\* 2>&1 1>/dev/null |
|
||||
sed -E 's/^([^ ]+\.[ch]):([0-9]+):([0-9]+): ([a-z]+): (.*)$/::\4 file=\1,line=\2,col=\3::\5/'
|
||||
|
13
README.md
13
README.md
@@ -10,7 +10,18 @@ LiDM is like any [Display Manager](https://en.wikipedia.org/wiki/X_display_manag
|
||||
|
||||

|
||||
|
||||
> _shown as in a featured terminal emulator, actual linux console doesn't support as much color and decorations_
|
||||
<blockquote><details>
|
||||
<summary><i>
|
||||
shown as in a featured terminal emulator, actual linux console doesn't support as much color and decorations
|
||||
</i></summary>
|
||||
|
||||
If you want to add fancy color and font support to your TTYs you can wrap lidm in [`kmscon`](https://wiki.archlinux.org/title/KMSCON). (edit appropriate service files). e.g:
|
||||
|
||||
```sh
|
||||
kmscon -l --vt /dev/tty7 --font-name "Cascadia Code" -- /usr/bin/lidm
|
||||
```
|
||||
|
||||
</details></blockquote>
|
||||
|
||||
> _however, all colors and strings are fully customizable_
|
||||
|
||||
|
@@ -13,8 +13,9 @@ make -j"$(nproc)" "$@" 2> /tmp/stderr || ERR=$?
|
||||
BSIZE=$(stat --printf="%s" lidm)
|
||||
HSIZE=$(numfmt --to=iec-i<<<"$BSIZE")B
|
||||
WARNS=$(
|
||||
{ grep -E '^[^ ]+\.[ch]:[0-9]+:[0-9]+: [a-z]+:' /tmp/stderr || :; } \
|
||||
| sed -E 's/^([^ ]+\.[ch]):([0-9]+):([0-9]+): ([a-z]+): (.*)$/::\4 file=\1,line=\2,col=\3::\5/'
|
||||
sed -nE \
|
||||
's/^([^ ]+\.[ch]):([0-9]+):([0-9]+): ([a-z]+): (.*)$/::\4 file=\1,line=\2,col=\3::\5/p' \
|
||||
/tmp/stderr
|
||||
)
|
||||
WARNS_NUM=$({ [[ "$WARNS" == "" ]] && echo 0; } || wc -l <<<"$WARNS")
|
||||
|
||||
|
@@ -3,10 +3,12 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void log_init(FILE* fd);
|
||||
void log_puts(const char* msg);
|
||||
void log_printf(const char* fmt, ...);
|
||||
#include "macros.h"
|
||||
|
||||
void log_init(FILE* NNULLABLE fd);
|
||||
void log_puts(const char* NNULLABLE msg);
|
||||
void log_printf(const char* NNULLABLE fmt, ...);
|
||||
// NOLINTNEXTLINE(readability-identifier-length)
|
||||
void log_perror(const char* s);
|
||||
void log_perror(const char* NNULLABLE s);
|
||||
|
||||
#endif
|
||||
|
@@ -36,7 +36,7 @@ int pam_conversation(int num_msg, const struct pam_message** msg,
|
||||
}
|
||||
|
||||
#ifndef PAM_SERVICE_FALLBACK
|
||||
#define PAM_SERVICE_FALLBACK "login"
|
||||
#define PAM_SERVICE_FALLBACK "login"
|
||||
#endif
|
||||
|
||||
#define CHECK_PAM_RET(call) \
|
||||
|
@@ -243,7 +243,7 @@ int parse_config(struct config* NNULLABLE config, char* NNULLABLE path) {
|
||||
if (fd == NULL) {
|
||||
log_perror("fopen");
|
||||
log_printf(" [I] No config, place one at " LIDM_CONF_PATH
|
||||
" or set the LIDM_CONF env variable");
|
||||
" or set the LIDM_CONF env variable\n");
|
||||
return 0; // Its fine now anyways
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ void log_perror(const char* s) {
|
||||
if (!logger_out) return;
|
||||
|
||||
if (s)
|
||||
(void)fprintf(logger_out, "%s: %s", s, strerror(errno));
|
||||
(void)fprintf(logger_out, "%s: %s\n", s, strerror(errno));
|
||||
else
|
||||
(void)fprintf(logger_out, "%s", strerror(errno));
|
||||
(void)fprintf(logger_out, "%s\n", strerror(errno));
|
||||
}
|
||||
|
4
src/ui.c
4
src/ui.c
@@ -115,13 +115,13 @@ char* trunc_gethostname(const size_t MAXLEN, const char* const ELLIPSIS) {
|
||||
char* buf = malloc(alloc_size);
|
||||
if (!buf) return NULL;
|
||||
|
||||
if(gethostname(buf, alloc_size) != 0) {
|
||||
if (gethostname(buf, alloc_size) != 0) {
|
||||
free(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (utf8len(buf) > MAXLEN) {
|
||||
int end = utf8trunc(buf, MAXLEN - utf8len(ELLIPSIS));
|
||||
size_t end = utf8trunc(buf, MAXLEN - utf8len(ELLIPSIS));
|
||||
strcpy(&buf[end], ELLIPSIS);
|
||||
}
|
||||
return buf;
|
||||
|
@@ -106,12 +106,12 @@ size_t utf8len_until(const char* str, const char* until) {
|
||||
size_t utf8trunc(char* str, size_t n) {
|
||||
size_t bytes = 0;
|
||||
while (true) {
|
||||
if(str[bytes] == '\0') break;
|
||||
if (str[bytes] == '\0') break;
|
||||
if (utf8_iscont(str[bytes])) {
|
||||
bytes++;
|
||||
continue;
|
||||
}
|
||||
if(n == 0) {
|
||||
if (n == 0) {
|
||||
str[bytes] = '\0';
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user