From 872647fa3b907c1745ed6bc578a81c4841dae07a Mon Sep 17 00:00:00 2001 From: speedie Date: Mon, 23 Jan 2023 19:49:34 +0100 Subject: [PATCH] used_tags can now be grabbed --- queries.h | 1 + toggle/query.c | 13 +++++++++++++ toggle/query.h | 1 + xresources.h | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/queries.h b/queries.h index 947cdf3..e53088f 100644 --- a/queries.h +++ b/queries.h @@ -5,6 +5,7 @@ static Query queries[] = { /* queries functions */ { "get_tags", get_tags }, + { "get_used_tags", get_used_tags }, { "get_numtags", get_numtags }, { "get_layouts", get_layouts }, { "get_numlayouts", get_numlayouts }, diff --git a/toggle/query.c b/toggle/query.c index e220db5..7d901fe 100644 --- a/toggle/query.c +++ b/toggle/query.c @@ -150,3 +150,16 @@ get_tags() if (ps) return 0; else return 1; } + +int +get_used_tags() +{ + int i = 0; + int ps = 0; + + for (i = 0; i < LENGTH(usedtags); i++) { + ps = fprintf(stdout, "%s\n", usedtags[i]); + } + + if (ps) return 0; else return 1; +} diff --git a/toggle/query.h b/toggle/query.h index 8c9b945..d5d61b8 100644 --- a/toggle/query.h +++ b/toggle/query.h @@ -3,6 +3,7 @@ static int query(char *args); /* queries */ static int get_numtags(); static int get_tags(); +static int get_used_tags(); static int get_layouts(); static int get_numlayouts(); static int get_barpos(); diff --git a/xresources.h b/xresources.h index 0cbb007..5d8e9ec 100644 --- a/xresources.h +++ b/xresources.h @@ -5,7 +5,7 @@ * These are also used by the speedwmrc file in ~/.config/speedwm-de. * When you're done with your edits, run 'make clean install'. * -* Value in .Xresources Type Value internally */ +* Value in .Xresources Type Value internally */ ResourcePref resources[] = { { "fonts.font", STRING, &font }, { "col.background", STRING, &col_background },