From 0f6215b16243c79bc2ec6b51920ccd6cae3f82ed Mon Sep 17 00:00:00 2001 From: joten Date: Thu, 6 Sep 2012 22:53:15 +0200 Subject: [PATCH] added feature: Associating names with views, which are shown in the status bar. --- src/Bar.ahk | 8 ++++---- src/Config.ahk | 15 ++++++++++----- src/docs/changes.t2t | 6 +++++- src/docs/configuration.t2t | 8 +++++--- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/Bar.ahk b/src/Bar.ahk index 0ffbd3c..1c27ea4 100644 --- a/src/Bar.ahk +++ b/src/Bar.ahk @@ -49,7 +49,7 @@ Bar_init(m) { ; tags Loop, % Config_viewCount { i := A_Index - text := " " i " " + text := " " Config_viewNames_#%i% " " w := Bar_getTextWidth(text) Gui, Add, Text, x%x1% y%y1% w%w% h%h1% BackgroundTrans vBar_#%m%_#%i%_view gBar_GuiClick, If (w <= h1) @@ -80,8 +80,8 @@ Bar_init(m) { w := Bar_getTextWidth(" ?? ") x2 -= w titleWidth -= w - Gui, Add, Text, x%x2% y%y1% w%w% h%h1% BackgroundTrans vBar_#%m%_#%i% gBar_toggleCommandGui, - Gui, Add, Progress, x%x2% y%y1% w%w% h%h1% Background%Config_normBgColor2% + Gui, Add, Text, x%x2% y%y1% w%w% h%h1% BackgroundTrans vBar_#%m%_#%i% gBar_toggleCommandGui, + Gui, Add, Progress, x%x2% y%y1% w%w% h%h1% Background%Config_normBgColor2% Gui, Add, Text, x%x2% y%y2% w%w% h%h2% Center BackgroundTrans, #! } Else If (i = Config_viewCount + 5) And Config_readinTime { ; time w := Bar_getTextWidth(" ??:?? ") @@ -752,6 +752,6 @@ Bar_updateView(m, v) { ; Update the percentage fill for the view. GuiControl, , Bar_#%m%_#%A_Index%_tagged, % ViewIdsLen / IdsLen * 100 ; Refresh the number on the bar. - GuiControl, , Bar_#%m%_#%A_Index%, %A_Index% + GuiControl, , Bar_#%m%_#%A_Index%, % Config_viewNames_#%A_Index% } } diff --git a/src/Config.ahk b/src/Config.ahk index 9f06201..9ba4435 100644 --- a/src/Config.ahk +++ b/src/Config.ahk @@ -19,7 +19,7 @@ */ Config_init() { - Local i, key, layout0, layout1, layout2 + Local i, key, layout0, layout1, layout2, vNames0, vNames1, vNames2, vNames3, vNames4, vNames5, vNames6, vNames7, vNames8, vNames9 ; status bar Config_showBar := True ; If false, the bar is hidden. It can be made visible or hidden by hotkey (see below). @@ -52,7 +52,7 @@ Config_init() { Config_selBorderColor := "" ; Border colour of the active window; format: 0x00BBGGRR (e. g. "0x006A240A", if = "", the system's window border colour is not changed). ; Config_borderWidth, Config_borderPadding and Config_selBorderColor are especially usefull, if you are not allowed to set the design in the system settings. ; window arrangement - Config_viewCount := 9 ; The total number of views. This has effects on the displayed groups in the bar, and should not be exceeded in the hotkeys below. + Config_viewNames := "1;2;3;4;5;6;7;8;9" ; The names of the views separated by a semicolon. This variable sets the names of the views shown in the status bar and determines the nummber of views (Config_viewCount); the total number of names given, i. e. views, should not be exceeded in the hotkeys section below. Config_layout_#1 := "[]=;tile" ; The layout symbol and arrange function (the first entry is set as the default layout, no layout function means floating behavior) Config_layout_#2 := "[M];monocle" Config_layout_#3 := "><>;" @@ -104,9 +104,14 @@ Config_init() { StringSplit, layout, Config_layout_#%A_Index%, `; Config_layoutFunction_#%A_Index% := layout2 Config_layoutSymbol_#%A_Index% := layout1 - } - If (Config_viewCount > 9) - Config_viewCount := 9 + } + StringSplit, vNames, Config_viewNames, `; + If vNames0 > 9 + Config_viewCount := 9 + Else + Config_viewCount := vNames0 + Loop, % Config_viewCount + Config_viewNames_#%A_Index% := vNames%A_Index% } Config_initColors() { diff --git a/src/docs/changes.t2t b/src/docs/changes.t2t index 457ab6e..1a50d6a 100644 --- a/src/docs/changes.t2t +++ b/src/docs/changes.t2t @@ -10,7 +10,7 @@ (~) changed (+) added -=8.2.2(?)= +=8.3.0= (+) Multi-dimensional tiling of the master area. The user may now specify X and Y dimensions independently up to 9 x 9. @@ -26,6 +26,10 @@ a non-active monitor could cause both monitors to change views. (~) Gap widths are now treated identically on both "tile" and "monocle" layouts. +(+) Added the configuration variable "Config_viewNames", with which views + can be named and the number of views can be set. The configuration + variable "Config_viewCount" therewith becomes obsolete. +(-) Removed the configuration variable "Config_viewCount". =8.2.1= diff --git a/src/docs/configuration.t2t b/src/docs/configuration.t2t index 99365b7..08381d9 100644 --- a/src/docs/configuration.t2t +++ b/src/docs/configuration.t2t @@ -156,9 +156,11 @@ settings. === View / Layout === -: **Config_viewCount**=9 - The total number of views. This has effects on the displayed groups in - the bar, and should not be exceeded in the hotkeys below. +: **Config_viewNames**=1;2;3;4;5;6;7;8;9 + The names of the views in use separated by a semicolon. With the number + of fields in this list the total number of views is given. This has + effects on the displayed groups in the bar, and should not be exceeded in + the hotkeys section of the configuration. : **Config_layout_#1**=[]=;tile The layout symbol and arrange function (the first entry is set as the