diff --git a/assets/man/lidm-config.5 b/assets/man/lidm-config.5 index db33986..f5d6e16 100644 --- a/assets/man/lidm-config.5 +++ b/assets/man/lidm-config.5 @@ -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 diff --git a/include/config.h b/include/config.h index 73a66c3..2b120a9 100644 --- a/include/config.h +++ b/include/config.h @@ -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); diff --git a/src/ui.c b/src/ui.c index 840154d..725a71f 100644 --- a/src/ui.c +++ b/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); diff --git a/themes/cherry.ini b/themes/cherry.ini index 1e736a6..4fce938 100644 --- a/themes/cherry.ini +++ b/themes/cherry.ini @@ -38,6 +38,7 @@ e_key = "1;23;38;5;197" # s_shell = "shell" # opts_pre = "< " # opts_post = " >" +# ellipsis = "…" [behavior] # include_defshell = true diff --git a/themes/default.ini b/themes/default.ini index 3b97d7c..a0859e6 100644 --- a/themes/default.ini +++ b/themes/default.ini @@ -38,6 +38,7 @@ # s_shell = "shell" # opts_pre = "< " # opts_post = " >" +# ellipsis = "…" [behavior] # include_defshell = true diff --git a/themes/kanagawa-dragon.ini b/themes/kanagawa-dragon.ini index ebc302f..3690f34 100644 --- a/themes/kanagawa-dragon.ini +++ b/themes/kanagawa-dragon.ini @@ -38,6 +38,7 @@ e_user = "38;2;148;89;84" # s_shell = "shell" # opts_pre = "< " # opts_post = " >" +# ellipsis = "…" [behavior] # include_defshell = true diff --git a/themes/kanagawa-wave.ini b/themes/kanagawa-wave.ini index 775375f..f69636f 100644 --- a/themes/kanagawa-wave.ini +++ b/themes/kanagawa-wave.ini @@ -38,6 +38,7 @@ e_user = "38;2;211;137;88" # s_shell = "shell" # opts_pre = "< " # opts_post = " >" +# ellipsis = "…" [behavior] # include_defshell = true diff --git a/themes/minimal.ini b/themes/minimal.ini index 5a10c99..4665c84 100644 --- a/themes/minimal.ini +++ b/themes/minimal.ini @@ -39,6 +39,7 @@ s_xorg = "X" s_shell = "$" # opts_pre = "< " # opts_post = " >" +# ellipsis = "…" [behavior] # include_defshell = true diff --git a/themes/nature.ini b/themes/nature.ini index 1436e3b..b44c7b3 100644 --- a/themes/nature.ini +++ b/themes/nature.ini @@ -38,6 +38,7 @@ e_key = "32" # s_shell = "shell" # opts_pre = "< " # opts_post = " >" +# ellipsis = "…" [behavior] # include_defshell = true diff --git a/themes/nord.ini b/themes/nord.ini index 4eea960..56916cd 100644 --- a/themes/nord.ini +++ b/themes/nord.ini @@ -38,6 +38,7 @@ e_key = "34" # s_shell = "shell" # opts_pre = "< " # opts_post = " >" +# ellipsis = "…" [behavior] # include_defshell = true diff --git a/themes/nothing.ini b/themes/nothing.ini index fc75736..5c43574 100644 --- a/themes/nothing.ini +++ b/themes/nothing.ini @@ -40,6 +40,7 @@ s_xorg = "" s_shell = "" # opts_pre = "< " # opts_post = " >" +# ellipsis = "…" [behavior] # include_defshell = true diff --git a/themes/old-blue.ini b/themes/old-blue.ini index 146b747..847029a 100644 --- a/themes/old-blue.ini +++ b/themes/old-blue.ini @@ -38,6 +38,7 @@ s_xorg = "xworg" s_shell = "swell" # opts_pre = "< " # opts_post = " >" +# ellipsis = "…" [behavior] # include_defshell = true diff --git a/themes/tasteless.ini b/themes/tasteless.ini index f3b99d1..e0e0b2c 100644 --- a/themes/tasteless.ini +++ b/themes/tasteless.ini @@ -39,6 +39,7 @@ s_xorg = "xorg" s_shell = "sh" opts_pre = "· " opts_post = " " +ellipsis = "…" [behavior] # include_defshell = true