From 8877aae6c9be104d246e38beba788431f106c406 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 7 Jan 2008 11:20:24 +0100 Subject: [PATCH] add show_all option to tasklist --- awesomerc.1.txt | 2 ++ config.c | 1 + widgets/tasklist.c | 24 ++++++++++++++++++------ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/awesomerc.1.txt b/awesomerc.1.txt index 28f09981..f5247a70 100644 --- a/awesomerc.1.txt +++ b/awesomerc.1.txt @@ -174,6 +174,8 @@ This widget shows a list of running windows. Text alignement. *show_icons*:: Show applications icons. +*show_all*:: + Show all windows from all tags. *x*:: Horizontal offset (auto-alignment if not set). *y*:: diff --git a/config.c b/config.c index 28ac4499..6cc7a00c 100644 --- a/config.c +++ b/config.c @@ -571,6 +571,7 @@ config_parse(const char *confpatharg) CFG_STR((char *) "font", (char *) NULL, CFGF_NONE), CFG_STR((char *) "align", (char *) "left", CFGF_NONE), CFG_BOOL((char *) "show_icons", cfg_true, CFGF_NONE), + CFG_BOOL((char *) "show_all", cfg_false, CFGF_NONE), CFG_END() }; static cfg_opt_t widget_graph_opts[] = diff --git a/widgets/tasklist.c b/widgets/tasklist.c index 4306ba1d..f2e3280d 100644 --- a/widgets/tasklist.c +++ b/widgets/tasklist.c @@ -29,13 +29,16 @@ #include "event.h" #include "ewmh.h" #include "rules.h" +#include "tag.h" -#define ISVISIBLE_ON_TB(c, screen) (client_isvisible(c, screen) && !c->skiptb) +#define ISVISIBLE_ON_TB(c, nscreen, show_all) ((!show_all && client_isvisible(c, nscreen) && !c->skiptb) \ + || (show_all && c->screen == nscreen && !c->skiptb)) extern AwesomeConf globalconf; typedef struct { + Bool show_all; Bool show_icons; Alignment align; XColor fg_sel; @@ -56,7 +59,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used) NetWMIcon *icon; for(c = globalconf.clients; c; c = c->next) - if(ISVISIBLE_ON_TB(c, widget->statusbar->screen)) + if(ISVISIBLE_ON_TB(c, widget->statusbar->screen, d->show_all)) n++; if(!n) @@ -77,7 +80,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used) widget->area.y = widget->area.y = 0; for(c = globalconf.clients; c; c = c->next) - if(ISVISIBLE_ON_TB(c, widget->statusbar->screen)) + if(ISVISIBLE_ON_TB(c, widget->statusbar->screen, d->show_all)) { icon_width = 0; @@ -146,13 +149,15 @@ tasklist_button_press(Widget *widget, XButtonPressedEvent *ev) { Button *b; Client *c; + Data *d = widget->data; + Tag *tag; int n = 0, box_width = 0, i = 0, ci = 0; /* button1 give focus */ if(ev->button == Button1 && CLEANMASK(ev->state) == NoSymbol) { for(c = globalconf.clients; c; c = c->next) - if(ISVISIBLE_ON_TB(c, widget->statusbar->screen)) + if(ISVISIBLE_ON_TB(c, widget->statusbar->screen, d->show_all)) n++; if(!n) @@ -177,14 +182,20 @@ tasklist_button_press(Widget *widget, XButtonPressedEvent *ev) } /* found first visible client */ for(c = globalconf.clients; - c && !ISVISIBLE_ON_TB(c, widget->statusbar->screen); + c && !ISVISIBLE_ON_TB(c, widget->statusbar->screen, d->show_all); c = c->next); /* found ci-th visible client */ for(; c && i < ci; c = c->next) - if(ISVISIBLE_ON_TB(c, widget->statusbar->screen)) + if(ISVISIBLE_ON_TB(c, widget->statusbar->screen, d->show_all)) i++; + /* first switch tag if client not visible */ + if(!client_isvisible(c, widget->statusbar->screen)) + for(i = 0, tag = globalconf.screens[c->screen].tags; tag; tag = tag->next, i++) + if(is_client_tagged(c, tag)) + tag_view(c->screen, i); focus(c, True, widget->statusbar->screen); + return; } } @@ -234,6 +245,7 @@ tasklist_new(Statusbar *statusbar, cfg_t *config) d->align = draw_get_align(cfg_getstr(config, "align")); d->show_icons = cfg_getbool(config, "show_icons"); + d->show_all = cfg_getbool(config, "show_all"); if((buf = cfg_getstr(config, "font"))) w->font = XftFontOpenName(globalconf.display, get_phys_screen(statusbar->screen), buf);