aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoruser <user@clank>2026-09-02 15:09:36 +0200
committeruser <user@clank>2026-09-02 15:09:36 +0200
commitcafa48e0a7e1eb48a783bfde6862c5fd82c7aede (patch)
tree8e7874fc9a26a0354154906fd9e6fd30e10fe197 /src
parentweb: chore (diff)
downloadslosh-cafa48e0a7e1eb48a783bfde6862c5fd82c7aede.tar.gz
slosh-cafa48e0a7e1eb48a783bfde6862c5fd82c7aede.tar.xz
slosh-cafa48e0a7e1eb48a783bfde6862c5fd82c7aede.zip
attach tag: just the count, in theme colours
The +x+y offset goes -- 'N clients' says the thing that matters. The inverse-video chip goes with it: the tag now draws in attach_fg / attach_bg from the theme, defaulting to gray ink on the terminal's own background. Standing information, not an announcement.
Diffstat (limited to 'src')
-rw-r--r--src/app.c6
-rw-r--r--src/config.c7
-rw-r--r--src/server.c15
3 files changed, 18 insertions, 10 deletions
diff --git a/src/app.c b/src/app.c
index b7af3d1..cc06924 100644
--- a/src/app.c
+++ b/src/app.c
@@ -98,6 +98,12 @@ bool app_cfg_attach_indicator(void) {
return CFG.attach_indicator;
}
+void app_cfg_attach_colors(color_t *fg, color_t *bg) {
+ ensure_config();
+ if (fg) *fg = CFG.attach_fg;
+ if (bg) *bg = CFG.attach_bg;
+}
+
int app_cfg_size_follows(void) {
ensure_config();
return CFG.size_follows;
diff --git a/src/config.c b/src/config.c
index 9c06983..2e3e662 100644
--- a/src/config.c
+++ b/src/config.c
@@ -662,6 +662,8 @@ static const struct {
{"rename_bg", offsetof(config_t, rename_bg)},
{"toast_fg", offsetof(config_t, toast_fg)},
{"toast_bg", offsetof(config_t, toast_bg)},
+ {"attach_fg", offsetof(config_t, attach_fg)},
+ {"attach_bg", offsetof(config_t, attach_bg)},
};
#define THEME_COLOR(c, i) ((color_t *)((char *)(c) + THEME_COLORS[i].off))
@@ -1054,6 +1056,11 @@ void config_defaults(config_t *c) {
c->toast_fg = ink;
c->toast_bg = accent;
+ /* Quiet on purpose: gray ink on the terminal's own background. The toast
+ * colours announce; this one merely mentions. */
+ c->attach_fg = dim;
+ c->attach_bg = (color_t){0};
+
c->prefix_key = GHOSTTY_KEY_A;
c->prefix_mods = MOD_CTRL;
diff --git a/src/server.c b/src/server.c
index 472fcdd..387fa7d 100644
--- a/src/server.c
+++ b/src/server.c
@@ -320,20 +320,15 @@ static void stamp_indicator(server_t *s, conn_t *c) {
if (!app_cfg_attach_indicator()) return;
size_t viewers = display_count(s);
if (viewers < 2) return;
- char tag[48];
- if (c->view_x || c->view_y)
- /* The crop's origin in the shared screen: "you are at +col+row of
- * something bigger", which is the disorienting case the tag exists for. */
- snprintf(tag, sizeof tag, " %zu clients +%u+%u ", viewers,
- (unsigned)c->view_x, (unsigned)c->view_y);
- else
- snprintf(tag, sizeof tag, " %zu clients ", viewers);
+ char tag[32];
+ snprintf(tag, sizeof tag, " %zu clients ", viewers);
size_t len = strlen(tag);
if (len >= c->view.cols) return; /* a view too narrow to say it in */
+ color_t fg, bg;
+ app_cfg_attach_colors(&fg, &bg);
uint16_t x0 = (uint16_t)(c->view.cols - len);
for (size_t i = 0; i < len; i++)
- screen_put_utf8(&c->view, (uint16_t)(x0 + i), 0, &tag[i], 1, (color_t){0},
- (color_t){0}, ATTR_DIM | ATTR_INVERSE);
+ screen_put_utf8(&c->view, (uint16_t)(x0 + i), 0, &tag[i], 1, fg, bg, 0);
}
static bool push_frame(server_t *s, conn_t *c) {