aboutsummaryrefslogtreecommitdiff
path: root/src/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dwm.c')
-rw-r--r--src/dwm.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/dwm.c b/src/dwm.c
index 1ac0271..990f269 100644
--- a/src/dwm.c
+++ b/src/dwm.c
@@ -277,12 +277,27 @@ static void change_tag_action(Button *btn)
{
ButtonSimple *sbtn = CAST(btn, ButtonSimple);
- g_assert(sbtn->text[0] >= 1 && sbtn->text[0] <= 9);
int n = sbtn->text[0] - '0';
+ g_assert(n >= 1 && n <= 9);
log_debug("Toggled tag %d",n );
}
+void dwm_register_tags(DwmIpc *dwm, Color color, Color selected, Color text_color, Color line_color)
+{
+ dwm->color = color;
+ dwm->selected = selected;
+
+ // Tags button
+ for (int i = 0; i < 9; ++i) {
+ char text[] = { '1' + i, '\0' };
+ dwm->tags[i] = button_simple_create(PANGO_ALIGN_LEFT, color, line_color);
+ button_simple_set_text(dwm->tags[i], g_strdup(text), text_color);
+ button_simple_set_action(dwm->tags[i], change_tag_action, dwm->state);
+ state_add_button(dwm->state, dwm->tags[i]);
+ }
+}
+
void dwm_destroy(DwmIpc *dwm)
{
g_source_destroy((GSource *)dwm);