Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the option for switching square brackets around the names of minimized windows #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/default/panels/panel.in
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Plugin {
ShowIconified=1
ShowMapped=1
ShowAllDesks=0
ShowSquareBrackets=1
UseMouseWheel=1
UseUrgencyHint=1
FlatButton=0
Expand Down
1 change: 1 addition & 0 deletions data/two_panels/panels/bottom.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Plugin {
ShowIconified=1
ShowMapped=1
ShowAllDesks=0
ShowSquareBrackets=1
UseMouseWheel=1
UseUrgencyHint=1
FlatButton=0
Expand Down
30 changes: 22 additions & 8 deletions data/ui/launchtaskbar.glade
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,20 @@
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton_show_square_brackets">
<property name="label" translatable="yes">Show square brackets around the names of minimized windows</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton_same_monitor_only">
<property name="label" translatable="yes">Only show windows on the same monitor as the task bar</property>
Expand All @@ -334,7 +348,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">5</property>
</packing>
</child>
<child>
Expand All @@ -348,7 +362,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">5</property>
<property name="position">6</property>
</packing>
</child>
<child>
Expand All @@ -362,7 +376,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="position">7</property>
</packing>
</child>
<child>
Expand All @@ -376,7 +390,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">7</property>
<property name="position">8</property>
</packing>
</child>
<child>
Expand All @@ -390,7 +404,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">8</property>
<property name="position">9</property>
</packing>
</child>
<child>
Expand All @@ -404,7 +418,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">9</property>
<property name="position">10</property>
</packing>
</child>
<child>
Expand Down Expand Up @@ -446,7 +460,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">10</property>
<property name="position">11</property>
</packing>
</child>
<child>
Expand Down Expand Up @@ -488,7 +502,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">11</property>
<property name="position">12</property>
</packing>
</child>
</object>
Expand Down
13 changes: 13 additions & 0 deletions plugins/launchtaskbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,8 @@ static void launchtaskbar_constructor_task(LaunchTaskBarPlugin *ltbp)
ltbp->flags.icons_only = (tmp_int != 0);
if (config_setting_lookup_int(s, "ShowAllDesks", &tmp_int))
ltbp->flags.show_all_desks = (tmp_int != 0);
if (config_setting_lookup_int(s, "ShowSquareBrackets", &tmp_int))
ltbp->flags.show_square_brackets = (tmp_int != 0);
if (config_setting_lookup_int(s, "SameMonitorOnly", &tmp_int))
ltbp->flags.same_monitor_only = (tmp_int != 0);
if (config_setting_lookup_int(s, "DisableUpscale", &tmp_int))
Expand Down Expand Up @@ -1105,6 +1107,7 @@ static GtkWidget *_launchtaskbar_constructor(LXPanel *panel, config_setting_t *s
ltbp->flags.tooltips = TRUE;
ltbp->flags.icons_only = FALSE;
ltbp->flags.show_all_desks = TRUE;
ltbp->flags.show_square_brackets = TRUE;
ltbp->task_width_max = TASK_WIDTH_MAX;
ltbp->spacing = 1;
ltbp->flags.use_mouse_wheel = TRUE;
Expand Down Expand Up @@ -1525,6 +1528,15 @@ static void on_checkbutton_show_all_desks_toggled(GtkToggleButton *p_togglebutto
taskbar_apply_configuration(ltbp);
}

static void on_checkbutton_show_square_brackets_toggled(GtkToggleButton *p_togglebutton, gpointer p_data)
{
LaunchTaskBarPlugin *ltbp = (LaunchTaskBarPlugin *)p_data;
ltbp->flags.show_square_brackets = gtk_toggle_button_get_active(p_togglebutton);
//g_print("\ntb->flags.show_square_brackets upd\n");
config_group_set_int(ltbp->settings, "ShowSquareBrackets", ltbp->flags.show_square_brackets);
taskbar_apply_configuration(ltbp);
}

static void on_checkbutton_same_monitor_only_toggled(GtkToggleButton *p_togglebutton, gpointer p_data)
{
LaunchTaskBarPlugin *ltbp = (LaunchTaskBarPlugin *)p_data;
Expand Down Expand Up @@ -1784,6 +1796,7 @@ static GtkWidget *launchtaskbar_configure(LXPanel *panel, GtkWidget *p)
SETUP_TOGGLE_BUTTON(checkbutton_icons_only, icons_only);
SETUP_TOGGLE_BUTTON(checkbutton_flat_buttons, flat_button);
SETUP_TOGGLE_BUTTON(checkbutton_show_all_desks, show_all_desks);
SETUP_TOGGLE_BUTTON(checkbutton_show_square_brackets, show_square_brackets);
SETUP_TOGGLE_BUTTON(checkbutton_same_monitor_only, same_monitor_only);
SETUP_TOGGLE_BUTTON(checkbutton_mouse_wheel, use_mouse_wheel);
SETUP_TOGGLE_BUTTON(checkbutton_urgency_hint, use_urgency_hint);
Expand Down
30 changes: 21 additions & 9 deletions plugins/task-button.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,16 +1145,28 @@ static void task_draw_label(TaskButton *tb, gboolean bold_style, gboolean force)

tb->set_bold = bold_style;
str = g_string_sized_new(32);
if (!tb->visible)
g_string_append_c(str, '[');
if (tb->n_visible > 1)
g_string_append_printf(str, "(%d) ", tb->n_visible);
if (!tb->same_name || !tb->last_focused || !tb->last_focused->name)
g_string_append(str, tb->res_class);
if (tb->flags.show_square_brackets)
{
if (!tb->visible)
g_string_append_c(str, '[');
if (tb->n_visible > 1)
g_string_append_printf(str, "(%d) ", tb->n_visible);
if (!tb->same_name || !tb->last_focused || !tb->last_focused->name)
g_string_append(str, tb->res_class);
else
g_string_append(str, tb->last_focused->name);
if (!tb->visible)
g_string_append_c(str, ']');
}
else
g_string_append(str, tb->last_focused->name);
if (!tb->visible)
g_string_append_c(str, ']');
{
if (tb->n_visible > 1)
g_string_append_printf(str, "(%d) ", tb->n_visible);
if (!tb->same_name || !tb->last_focused || !tb->last_focused->name)
g_string_append(str, tb->res_class);
else
g_string_append(str, tb->last_focused->name);
}

if (force && tb->flags.tooltips)
gtk_widget_set_tooltip_text(GTK_WIDGET(tb), str->str);
Expand Down
1 change: 1 addition & 0 deletions plugins/task-button.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ G_BEGIN_DECLS
typedef struct /* bitwise rendering options for taskbar */
{
gboolean show_all_desks : 1; /* show windows from all desktops */
gboolean show_square_brackets : 1; /* show square brackets around the names of minimized windows */
gboolean tooltips : 1; /* show tooltips */
gboolean icons_only : 1; /* show icons only, omit name */
gboolean use_mouse_wheel : 1; /* scroll wheel does iconify and raise */
Expand Down