From 5017c4ced569407009ad00f68033ea0e23ab5c12 Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Thu, 12 Aug 2010 21:58:28 +0200 Subject: [PATCH] Config: Apply PeVe/mseed patch: layout_button_width option in [layouts] section. Thanks to them. --- src/config.c | 1 + src/infobar.c | 6 +++--- src/launcher.c | 2 +- src/structs.h | 1 + wmfsrc.in | 5 ++++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/config.c b/src/config.c index 9843abd..0714721 100644 --- a/src/config.c +++ b/src/config.c @@ -393,6 +393,7 @@ conf_layout_section(void) layouts = fetch_section_first(NULL, "layouts"); + conf.layout_button_width = fetch_opt_first(layouts, "O", "layout_button_width").num; conf.border.layout = fetch_opt_first(layouts, "false", "border").bool; conf.colors.layout_fg = fetch_opt_first(layouts, "#ffffff", "fg").str; conf.colors.layout_bg = getcolor((fetch_opt_first(layouts, "#000000", "bg").str)); diff --git a/src/infobar.c b/src/infobar.c index 22f1f6f..eeda99d 100644 --- a/src/infobar.c +++ b/src/infobar.c @@ -95,7 +95,7 @@ infobar_init(void) /* Create layout switch barwindow */ infobar[sc].layout_button = barwin_create(infobar[sc].bar->win, ((conf.layout_placement) ? 0 : (j + PAD / 2)), 0, - textw(tags[sc][seltag[sc]].layout.symbol) + PAD, + ((conf.layout_button_width > 0) ? conf.layout_button_width : (textw(tags[sc][seltag[sc]].layout.symbol) + PAD)), infobar[sc].geo.height, conf.colors.layout_bg, conf.colors.layout_fg, False, False, conf.border.layout); @@ -159,7 +159,7 @@ infobar_draw_layout(int sc) if(!conf.layout_placement) barwin_move(infobar[sc].layout_button, infobar[sc].tags_board->geo.width + PAD / 2, 0); - barwin_resize(infobar[sc].layout_button, textw(tags[sc][seltag[sc]].layout.symbol) + PAD, infobar[sc].geo.height); + barwin_resize(infobar[sc].layout_button, ((conf.layout_button_width > 0) ? conf.layout_button_width : (textw(tags[sc][seltag[sc]].layout.symbol) + PAD)), infobar[sc].geo.height); barwin_refresh_color(infobar[sc].layout_button); if(tags[sc][seltag[sc]].layout.symbol) @@ -225,7 +225,7 @@ infobar_draw_taglist(int sc) Bool is_occupied[MAXTAG + 1]; if(conf.layout_placement) - barwin_move(infobar[sc].tags_board, textw(tags[sc][seltag[sc]].layout.symbol) + PAD * 1.5, 0); + barwin_move(infobar[sc].tags_board, ((conf.layout_button_width > 0) ? conf.layout_button_width : (textw(tags[sc][seltag[sc]].layout.symbol) + PAD)) + PAD / 2, 0); for(i = 0; i < MAXTAG; i++) is_occupied[i] = False; diff --git a/src/launcher.c b/src/launcher.c index 2f0d1fa..629b21f 100644 --- a/src/launcher.c +++ b/src/launcher.c @@ -61,7 +61,7 @@ launcher_execute(Launcher *launcher) x = (conf.layout_placement) ? (infobar[selscreen].tags_board->geo.x + infobar[selscreen].tags_board->geo.width) - : (infobar[selscreen].layout_button->geo.x + textw(tags[selscreen][seltag[selscreen]].layout.symbol) + PAD); + : (infobar[selscreen].layout_button->geo.x + infobar[selscreen].layout_button->geo.width); XGrabKeyboard(dpy, ROOT, True, GrabModeAsync, GrabModeAsync, CurrentTime); diff --git a/src/structs.h b/src/structs.h index 089f08b..2e78232 100644 --- a/src/structs.h +++ b/src/structs.h @@ -469,6 +469,7 @@ typedef struct } systray; Alias alias[256]; uint mouse_tag_action[TagActionLast]; + int layout_button_width; Layout layout[NUM_OF_LAYOUT]; Menu *menu; Launcher *launcher; diff --git a/wmfsrc.in b/wmfsrc.in index 12134b0..e83bbe7 100644 --- a/wmfsrc.in +++ b/wmfsrc.in @@ -36,7 +36,7 @@ bg = "#191919" fg = "#D4D4ff" - # Cut title lenght + # Cut title length # max_length = 25 [mouse] button = "3" func = "clientlist" [/mouse] @@ -65,6 +65,9 @@ # Symbol displayed for the selected layout in the list selected_layout_symbol = "*" + # Width of layout button + # layout_button_width = x + # Tiling layouts. [layout] type = "tile_right" symbol = "RIGHT" [/layout] [layout] type = "tile_left" symbol = "LEFT" [/layout]