From dff3baafd498953c90e92465e434d22655bfe075 Mon Sep 17 00:00:00 2001 From: Jovan Lanik Date: Mon, 12 Sep 2022 15:36:07 +0200 Subject: [PATCH] add linked-buttons option --- source.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source.c b/source.c index 55e6c19..1f6d256 100644 --- a/source.c +++ b/source.c @@ -22,11 +22,13 @@ const gchar module_version[] = "v1.3.6"; static int self_id; static gboolean show_labels = FALSE; +static gboolean linked_buttons = FALSE; static gchar *reboot_command = "systemctl reboot"; static gchar *poweroff_command = "systemctl -i poweroff"; static GOptionEntry powerbar_entries[] = { { "show-labels", 0, 0, G_OPTION_ARG_NONE, &show_labels, NULL, NULL }, + { "linked-buttons", 0, 0, G_OPTION_ARG_NONE, &linked_buttons, NULL, NULL }, { "reboot-command", 0, 0, G_OPTION_ARG_STRING, &reboot_command, NULL, NULL }, { "poweroff-command", 0, 0, G_OPTION_ARG_STRING, &poweroff_command, NULL, NULL }, { NULL }, @@ -53,7 +55,10 @@ static void setup_powerbar(struct Window *ctx) { gtk_revealer_set_transition_type(GTK_REVEALER(POWERBAR(ctx)->revealer), GTK_REVEALER_TRANSITION_TYPE_NONE); gtk_overlay_add_overlay(GTK_OVERLAY(ctx->overlay), POWERBAR(ctx)->revealer); - POWERBAR(ctx)->box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); + if(linked_buttons) { + POWERBAR(ctx)->box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); + gtk_button_box_set_layout(GTK_BUTTON_BOX(POWERBAR(ctx)->box), GTK_BUTTONBOX_EXPAND); + } else POWERBAR(ctx)->box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); gtk_widget_set_halign(POWERBAR(ctx)->box, GTK_ALIGN_CENTER); gtk_widget_set_name(POWERBAR(ctx)->box, "powerbar-box"); gtk_container_add(GTK_CONTAINER(POWERBAR(ctx)->revealer), POWERBAR(ctx)->box);