summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorkonsolebox <konsolebox@gmail.com>2023-01-25 07:03:53 +0800
committerGitHub <noreply@github.com>2023-01-24 17:03:53 -0600
commit67b25fddf1429eb68e538ec0a7196599017f5d7e (patch)
tree1f27812638cb93bc363f718f6d2eb5ae5eaf8a07 /src
parentbb7a03e9f68a775ca93dd6ad8ea61e4f1d2ba81b (diff)
Add option to exclude nickname in window title (#2759)
Diffstat (limited to 'src')
-rw-r--r--src/common/cfgfiles.c2
-rw-r--r--src/common/hexchat.h1
-rw-r--r--src/fe-gtk/maingui.c32
-rw-r--r--src/fe-gtk/setup.c1
4 files changed, 18 insertions, 18 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index fdee9f2c..f0799de9 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -468,6 +468,7 @@ const struct prefs vars[] =
 	{"gui_win_fullscreen", P_OFFINT (hex_gui_win_fullscreen), TYPE_INT},
 	{"gui_win_left", P_OFFINT (hex_gui_win_left), TYPE_INT},
 	{"gui_win_modes", P_OFFINT (hex_gui_win_modes), TYPE_BOOL},
+	{"gui_win_nick", P_OFFINT (hex_gui_win_nick), TYPE_BOOL},
 	{"gui_win_save", P_OFFINT (hex_gui_win_save), TYPE_BOOL},
 	{"gui_win_state", P_OFFINT (hex_gui_win_state), TYPE_INT},
 	{"gui_win_swap", P_OFFINT (hex_gui_win_swap), TYPE_BOOL},
@@ -772,6 +773,7 @@ load_default_config(void)
 	prefs.hex_gui_ulist_count = 1;
 	prefs.hex_gui_ulist_icons = 1;
 	prefs.hex_gui_ulist_style = 1;
+	prefs.hex_gui_win_nick = 1;
 	prefs.hex_gui_win_save = 1;
 	prefs.hex_input_filter_beep = 1;
 	prefs.hex_input_flash_hilight = 1;
diff --git a/src/common/hexchat.h b/src/common/hexchat.h
index 470dd4ad..1b86f588 100644
--- a/src/common/hexchat.h
+++ b/src/common/hexchat.h
@@ -150,6 +150,7 @@ struct hexchatprefs
 	unsigned int hex_gui_ulist_style;
 	unsigned int hex_gui_usermenu;
 	unsigned int hex_gui_win_modes;
+	unsigned int hex_gui_win_nick;
 	unsigned int hex_gui_win_save;
 	unsigned int hex_gui_win_swap;
 	unsigned int hex_gui_win_ucount;
diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c
index 61f59856..0da60b3e 100644
--- a/src/fe-gtk/maingui.c
+++ b/src/fe-gtk/maingui.c
@@ -399,27 +399,22 @@ fe_set_title (session *sess)
 					 _(DISPLAY_NAME));
 		break;
 	case SESS_SERVER:
-		g_snprintf (tbuf, sizeof (tbuf), "%s @ %s - %s",
-					 sess->server->nick, server_get_network (sess->server, TRUE),
+		g_snprintf (tbuf, sizeof (tbuf), "%s%s%s - %s",
+					 prefs.hex_gui_win_nick ? sess->server->nick : "",
+					 prefs.hex_gui_win_nick ? " @ " : "", server_get_network (sess->server, TRUE),
 					 _(DISPLAY_NAME));
 		break;
 	case SESS_CHANNEL:
 		/* don't display keys in the titlebar */
-		if (prefs.hex_gui_win_modes)
-		{
 			g_snprintf (tbuf, sizeof (tbuf),
-						 "%s @ %s / %s (%s) - %s",
-						 sess->server->nick, server_get_network (sess->server, TRUE),
-						 sess->channel, sess->current_modes ? sess->current_modes : "",
-						 _(DISPLAY_NAME));
-		}
-		else
-		{
-			g_snprintf (tbuf, sizeof (tbuf),
-						 "%s @ %s / %s - %s",
-						 sess->server->nick, server_get_network (sess->server, TRUE),
-						 sess->channel, _(DISPLAY_NAME));
-		}
+					 "%s%s%s / %s%s%s%s - %s",
+					 prefs.hex_gui_win_nick ? sess->server->nick : "",
+					 prefs.hex_gui_win_nick ? " @ " : "",
+					 server_get_network (sess->server, TRUE), sess->channel,
+					 prefs.hex_gui_win_modes && sess->current_modes ? " (" : "",
+					 prefs.hex_gui_win_modes && sess->current_modes ? sess->current_modes : "",
+					 prefs.hex_gui_win_modes && sess->current_modes ? ")" : "",
+					 _(DISPLAY_NAME));
 		if (prefs.hex_gui_win_ucount)
 		{
 			g_snprintf (tbuf + strlen (tbuf), 9, " (%d)", sess->total);
@@ -427,8 +422,9 @@ fe_set_title (session *sess)
 		break;
 	case SESS_NOTICES:
 	case SESS_SNOTICES:
-		g_snprintf (tbuf, sizeof (tbuf), "%s @ %s (notices) - %s",
-					 sess->server->nick, server_get_network (sess->server, TRUE),
+		g_snprintf (tbuf, sizeof (tbuf), "%s%s%s (notices) - %s",
+					 prefs.hex_gui_win_nick ? sess->server->nick : "",
+					 prefs.hex_gui_win_nick ? " @ " : "", server_get_network (sess->server, TRUE),
 					 _(DISPLAY_NAME));
 		break;
 	default:
diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c
index 2f0589bd..0e1dfde3 100644
--- a/src/fe-gtk/setup.c
+++ b/src/fe-gtk/setup.c
@@ -176,6 +176,7 @@ static const setting appearance_settings[] =
 	{ST_HEADER,	N_("Title Bar"),0,0,0},
 	{ST_TOGGLE, N_("Show channel modes"), P_OFFINTNL(hex_gui_win_modes),0,0,0},
 	{ST_TOGGLR, N_("Show number of users"), P_OFFINTNL(hex_gui_win_ucount),0,0,0},
+	{ST_TOGGLE, N_("Show nickname"), P_OFFINTNL(hex_gui_win_nick),0,0,0},
 
 	{ST_END, 0, 0, 0, 0, 0}
 };