feat(cfg): add ellipsis to config

This commit is contained in:
javalsai 2025-07-04 04:48:20 +02:00
parent a316afecb2
commit 9c022c5813
Signed by: javalsai
SSH Key Fingerprint: SHA256:3G83yKhBUWVABVX/vPWH88xnK4+ptMtHkZGCRXD4Mk8
13 changed files with 18 additions and 3 deletions

View File

@ -86,6 +86,9 @@ Text to display as the header for such sessions.
.TP .TP
\fBopts_pre, opts_post\fP \fBopts_pre, opts_post\fP
To be used for items with multiple options on the left and right sides \fB"< "\fP and \fB" >"\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 .SS behavior
Other miscellaneous behavior strings, of mixed types Other miscellaneous behavior strings, of mixed types

View File

@ -106,7 +106,8 @@ BUILD(functions, FUNCTIONS, TABLE_FUNCTIONS);
F(char* NNULLABLE, s_xorg, STRING, "xorg", name) \ F(char* NNULLABLE, s_xorg, STRING, "xorg", name) \
F(char* NNULLABLE, s_shell, STRING, "shell", name) \ F(char* NNULLABLE, s_shell, STRING, "shell", name) \
F(char* NNULLABLE, opts_pre, STRING, "< ", 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); BUILD(strings, STRINGS, TABLE_STRINGS);

View File

@ -352,7 +352,8 @@ u_char get_render_pos_offset(struct opts_field* self, u_char maxlen) {
void print_head() { void print_head() {
// hostname doesn't just change on runtime // hostname doesn't just change on runtime
static char* hostname = NULL; 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"; if (!hostname) hostname = "unknown";
clean_line(box_start, HEAD_ROW); clean_line(box_start, HEAD_ROW);

View File

@ -38,6 +38,7 @@ e_key = "1;23;38;5;197"
# s_shell = "shell" # s_shell = "shell"
# opts_pre = "< " # opts_pre = "< "
# opts_post = " >" # opts_post = " >"
# ellipsis = "…"
[behavior] [behavior]
# include_defshell = true # include_defshell = true

View File

@ -38,6 +38,7 @@
# s_shell = "shell" # s_shell = "shell"
# opts_pre = "< " # opts_pre = "< "
# opts_post = " >" # opts_post = " >"
# ellipsis = "…"
[behavior] [behavior]
# include_defshell = true # include_defshell = true

View File

@ -38,6 +38,7 @@ e_user = "38;2;148;89;84"
# s_shell = "shell" # s_shell = "shell"
# opts_pre = "< " # opts_pre = "< "
# opts_post = " >" # opts_post = " >"
# ellipsis = "…"
[behavior] [behavior]
# include_defshell = true # include_defshell = true

View File

@ -38,6 +38,7 @@ e_user = "38;2;211;137;88"
# s_shell = "shell" # s_shell = "shell"
# opts_pre = "< " # opts_pre = "< "
# opts_post = " >" # opts_post = " >"
# ellipsis = "…"
[behavior] [behavior]
# include_defshell = true # include_defshell = true

View File

@ -39,6 +39,7 @@ s_xorg = "X"
s_shell = "$" s_shell = "$"
# opts_pre = "< " # opts_pre = "< "
# opts_post = " >" # opts_post = " >"
# ellipsis = "…"
[behavior] [behavior]
# include_defshell = true # include_defshell = true

View File

@ -38,6 +38,7 @@ e_key = "32"
# s_shell = "shell" # s_shell = "shell"
# opts_pre = "< " # opts_pre = "< "
# opts_post = " >" # opts_post = " >"
# ellipsis = "…"
[behavior] [behavior]
# include_defshell = true # include_defshell = true

View File

@ -38,6 +38,7 @@ e_key = "34"
# s_shell = "shell" # s_shell = "shell"
# opts_pre = "< " # opts_pre = "< "
# opts_post = " >" # opts_post = " >"
# ellipsis = "…"
[behavior] [behavior]
# include_defshell = true # include_defshell = true

View File

@ -40,6 +40,7 @@ s_xorg = ""
s_shell = "" s_shell = ""
# opts_pre = "< " # opts_pre = "< "
# opts_post = " >" # opts_post = " >"
# ellipsis = "…"
[behavior] [behavior]
# include_defshell = true # include_defshell = true

View File

@ -38,6 +38,7 @@ s_xorg = "xworg"
s_shell = "swell" s_shell = "swell"
# opts_pre = "< " # opts_pre = "< "
# opts_post = " >" # opts_post = " >"
# ellipsis = "…"
[behavior] [behavior]
# include_defshell = true # include_defshell = true

View File

@ -39,6 +39,7 @@ s_xorg = "xorg"
s_shell = "sh" s_shell = "sh"
opts_pre = "· " opts_pre = "· "
opts_post = " " opts_post = " "
ellipsis = "…"
[behavior] [behavior]
# include_defshell = true # include_defshell = true