mirror of
https://github.com/javalsai/lidm.git
synced 2025-07-04 23:08:42 +02:00
feat(cfg): add ellipsis to config
This commit is contained in:
parent
a316afecb2
commit
9c022c5813
@ -86,6 +86,9 @@ Text to display as the header for such sessions.
|
||||
.TP
|
||||
\fBopts_pre, opts_post\fP
|
||||
To be used for items with multiple options on the left and right sides \fB"< "\fP and \fB" >"\fP.
|
||||
.TP
|
||||
\fBellipsis\fP
|
||||
Ellipsis to be used in multiple parts such as overflowing hostnames.
|
||||
|
||||
.SS behavior
|
||||
Other miscellaneous behavior strings, of mixed types
|
||||
|
@ -106,7 +106,8 @@ BUILD(functions, FUNCTIONS, TABLE_FUNCTIONS);
|
||||
F(char* NNULLABLE, s_xorg, STRING, "xorg", name) \
|
||||
F(char* NNULLABLE, s_shell, STRING, "shell", name) \
|
||||
F(char* NNULLABLE, opts_pre, STRING, "< ", name) \
|
||||
F(char* NNULLABLE, opts_post, STRING, " >", name)
|
||||
F(char* NNULLABLE, opts_post, STRING, " >", name) \
|
||||
F(char* NNULLABLE, ellipsis, STRING, "…", name)
|
||||
|
||||
BUILD(strings, STRINGS, TABLE_STRINGS);
|
||||
|
||||
|
5
src/ui.c
5
src/ui.c
@ -109,7 +109,7 @@ static char* fmt_time(const char* fmt) {
|
||||
}
|
||||
|
||||
char* trunc_gethostname(const size_t MAXSIZE, const char* const ELLIPSIS) {
|
||||
if(utf8len(ELLIPSIS) > MAXSIZE) return NULL;
|
||||
if (utf8len(ELLIPSIS) > MAXSIZE) return NULL;
|
||||
size_t alloc_size = MAXSIZE + 1;
|
||||
char* buf = malloc(alloc_size);
|
||||
if (!buf) return NULL;
|
||||
@ -352,7 +352,8 @@ u_char get_render_pos_offset(struct opts_field* self, u_char maxlen) {
|
||||
void print_head() {
|
||||
// hostname doesn't just change on runtime
|
||||
static char* hostname = NULL;
|
||||
if (!hostname) hostname = trunc_gethostname(HOSTNAME_SIZE, "...");
|
||||
if (!hostname)
|
||||
hostname = trunc_gethostname(HOSTNAME_SIZE, g_config->strings.ellipsis);
|
||||
if (!hostname) hostname = "unknown";
|
||||
|
||||
clean_line(box_start, HEAD_ROW);
|
||||
|
@ -38,6 +38,7 @@ e_key = "1;23;38;5;197"
|
||||
# s_shell = "shell"
|
||||
# opts_pre = "< "
|
||||
# opts_post = " >"
|
||||
# ellipsis = "…"
|
||||
|
||||
[behavior]
|
||||
# include_defshell = true
|
||||
|
@ -38,6 +38,7 @@
|
||||
# s_shell = "shell"
|
||||
# opts_pre = "< "
|
||||
# opts_post = " >"
|
||||
# ellipsis = "…"
|
||||
|
||||
[behavior]
|
||||
# include_defshell = true
|
||||
|
@ -38,6 +38,7 @@ e_user = "38;2;148;89;84"
|
||||
# s_shell = "shell"
|
||||
# opts_pre = "< "
|
||||
# opts_post = " >"
|
||||
# ellipsis = "…"
|
||||
|
||||
[behavior]
|
||||
# include_defshell = true
|
||||
|
@ -38,6 +38,7 @@ e_user = "38;2;211;137;88"
|
||||
# s_shell = "shell"
|
||||
# opts_pre = "< "
|
||||
# opts_post = " >"
|
||||
# ellipsis = "…"
|
||||
|
||||
[behavior]
|
||||
# include_defshell = true
|
||||
|
@ -39,6 +39,7 @@ s_xorg = "X"
|
||||
s_shell = "$"
|
||||
# opts_pre = "< "
|
||||
# opts_post = " >"
|
||||
# ellipsis = "…"
|
||||
|
||||
[behavior]
|
||||
# include_defshell = true
|
||||
|
@ -38,6 +38,7 @@ e_key = "32"
|
||||
# s_shell = "shell"
|
||||
# opts_pre = "< "
|
||||
# opts_post = " >"
|
||||
# ellipsis = "…"
|
||||
|
||||
[behavior]
|
||||
# include_defshell = true
|
||||
|
@ -38,6 +38,7 @@ e_key = "34"
|
||||
# s_shell = "shell"
|
||||
# opts_pre = "< "
|
||||
# opts_post = " >"
|
||||
# ellipsis = "…"
|
||||
|
||||
[behavior]
|
||||
# include_defshell = true
|
||||
|
@ -40,6 +40,7 @@ s_xorg = ""
|
||||
s_shell = ""
|
||||
# opts_pre = "< "
|
||||
# opts_post = " >"
|
||||
# ellipsis = "…"
|
||||
|
||||
[behavior]
|
||||
# include_defshell = true
|
||||
|
@ -38,6 +38,7 @@ s_xorg = "xworg"
|
||||
s_shell = "swell"
|
||||
# opts_pre = "< "
|
||||
# opts_post = " >"
|
||||
# ellipsis = "…"
|
||||
|
||||
[behavior]
|
||||
# include_defshell = true
|
||||
|
@ -39,6 +39,7 @@ s_xorg = "xorg"
|
||||
s_shell = "sh"
|
||||
opts_pre = "· "
|
||||
opts_post = " "
|
||||
ellipsis = "…"
|
||||
|
||||
[behavior]
|
||||
# include_defshell = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user