From 2c74cb06de7e7605492dbb4d1981b95476587140 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Thu, 26 May 2016 02:14:56 +0200 Subject: [PATCH] task(dsl): Replace colons with dashes Colons break ini syntax highlighters and linters. --- README.md | 567 +++++++++++---------- config | 984 ++++++++++++++++++------------------ examples/config | 69 +-- examples/config.bspwm | 103 ++-- examples/config.i3 | 103 ++-- include/modules/base.hpp | 16 +- include/modules/battery.hpp | 18 +- include/modules/bspwm.hpp | 4 +- include/modules/cpu.hpp | 6 +- include/modules/i3.hpp | 2 +- include/modules/memory.hpp | 4 +- include/modules/menu.hpp | 4 +- include/modules/mpd.hpp | 28 +- include/modules/network.hpp | 16 +- include/modules/torrent.hpp | 2 +- include/modules/volume.hpp | 12 +- include/utils/config.hpp | 10 +- src/bar.cpp | 6 +- src/drawtypes/animation.cpp | 4 +- src/drawtypes/bar.cpp | 14 +- src/drawtypes/label.cpp | 14 +- src/drawtypes/ramp.cpp | 2 +- src/modules/bspwm.cpp | 26 +- src/modules/i3.cpp | 12 +- src/modules/menu.cpp | 12 +- src/modules/mpd.cpp | 4 +- src/modules/script.cpp | 10 +- src/modules/text.cpp | 10 +- 28 files changed, 1096 insertions(+), 966 deletions(-) diff --git a/README.md b/README.md index f6316d52..4dac9f47 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +###### Did the bar stop working after your last update? [Read this](https://github.com/jaagr/lemonbuddy/wiki/pre-1.0:-Patching-your-configuration-file) to find out how to patch your config! +--- + Lemonbuddy ========== @@ -102,16 +105,16 @@ The following code will get you started: # Launch the bar # (where "example" is the name of the bar as defined by [bar/NAME] in the config) - $ lemonbuddy_wrapper.sh example + $ lemonbuddy_wrapper example ~~~ > **NOTE:** If you are running i3 or bspwm and you don't see the workspace icons > it probably depends on the font. Install `font-awesome` and relaunch the bar. > ...or replace the icons in the config. -**It is recommended** to always use `lemonbuddy_wrapper.sh` when launching the bars. +**It is recommended** to always use `lemonbuddy_wrapper` when launching the bars. -`lemonbuddy_wrapper.sh` is just a simple shell script that takes care +`lemonbuddy_wrapper` is just a simple shell script that takes care of redirecting the in-/output streams between `lemonbuddy` and `lemonbar`. If you handle the in-/output stream redirection's manually, the internal command @@ -119,7 +122,7 @@ handlers (e.g. mpd or volume controls) might stop working. It won't change the output of the bar but you will miss out on the internal API calls, which is one of the main advantages of using the application. -The `lemonbuddy_wrapper.sh` will be deprecated once `lemonbar` is integrated +The `lemonbuddy_wrapper` will be deprecated once `lemonbar` is integrated into the project. @@ -132,11 +135,11 @@ processes gets terminated before before we launch the new ones. For example in ~~~ sh # Terminate already running bar instances - pgrep -f '(lemonbuddy_wrapper.sh|^lemonb(uddy|ar))' | xargs kill -9 >/dev/null 2>&1 + lemonbuddy_terminate noconfirm # Launch bar1 and bar2 - lemonbuddy_wrapper.sh bar1 & - lemonbuddy_wrapper.sh bar2 & + lemonbuddy_wrapper bar1 & + lemonbuddy_wrapper bar2 & echo "Bars launched..." ~~~ @@ -144,8 +147,8 @@ processes gets terminated before before we launch the new ones. For example in ## Configuration -The configuration syntax is very much **WIP**. An upcoming change will replace all occurences of colon's with dashes in the parameter names. -If you have any feedback or suggestions, please [create an issue ticket](https://github.com/jaagr/lemonbuddy/issues). +The configuration syntax is very much **WIP**. If you have any feedback or suggestions on how to improve it, +please [create an issue ticket](https://github.com/jaagr/lemonbuddy/issues), or a pull request. When working with unicode symbols, remember that fonts render them differently. Changing font can change the quality of your generated output drastically. One must-have font @@ -156,6 +159,52 @@ Also try different icon fonts, such as [Font Awesome](http://fontawesome.io/icon The values used in the examples below are to be considered placeholder values, and the resulting output might not be award-winning. +### Syntax and DSL + +The configuration syntax is based on the `ini` file format. + + ~~~ ini + [section/name] + str = My string + ; Hint: Quote the value to keep the spaces + str = " My string" + bool = true + bool = on + int = 10 + float = 10.0 + + ; Values for a defined bar can be referenced using: + key = ${bar/top.foreground} + + ; Values for the current bar can be referenced using: + key = ${BAR.foreground} + + ; Other values can be referenced using: + key = ${section.key} + + ;format[-NAME] = "" + ;format[-NAME]-spacing = N (unit: whitespaces) + ;format[-NAME]-padding = N (unit: whitespaces) + ;format[-NAME]-margin = N (unit: whitespaces) + ;format[-NAME]-offset = N (unit: pixels) + ;format[-NAME]-foreground = #aarrggbb + ;format[-NAME]-background = #aarrggbb + ;format[-NAME]-underline = #aarrggbb + ;format[-NAME]-overline = #aarrggbb + ; + ;label-NAME[-(foreground|background|(under|over)line|font|padding)] = ? + ;icon-NAME[-(foreground|background|(under|over)line|font|padding)] = ? + ;ramp-NAME-[0-9]+[-(foreground|background|(under|over)line|font|padding)] = ? + ;animation-NAME-[0-9]+[-(foreground|background|(under|over)line|font|padding)] = ? + ; + ;bar-NAME-width = N (unit: characters) + ;bar-NAME-format = (tokens: %fill% %indicator% %empty%) + ;bar-NAME-foreground-[0-9]+ = #aarrggbb + ;bar-NAME-indicator[-(foreground|background|(under|over)line|font|padding)] = + ;bar-NAME-fill[-(foreground|background|(under|over)line|font|padding)] = + ;bar-NAME-empty[-(foreground|background|(under|over)line|font|padding)] = + ~~~ + `🟊 = module is still flagged as work in progress` @@ -211,10 +260,10 @@ the resulting output might not be award-winning. module_margin_right = 3 ; Fonts are defined using: ; - font:0 = NotoSans-Regular:size=8;0 - font:1 = MaterialIcons:size=10;0 - font:2 = Termsynu:size=8;-1 - font:3 = FontAwesome:size=10;0 + font-0 = NotoSans-Regular:size=8;0 + font-1 = MaterialIcons:size=10;0 + font-2 = Termsynu:size=8;-1 + font-3 = FontAwesome:size=10;0 ; The separator will be inserted between the output of each module ;separator = | @@ -224,16 +273,16 @@ the resulting output might not be award-winning. clickareas = 30 ; Value to be used to set the WM_NAME atom - ; This defaults to "lemonbuddy-BARNAME_MONITOR" + ; This defaults to "lemonbuddy-[BAR]_[MONITOR]" ;wm_name = mybar ; Locale used to localize module output (for example date) ;locale = sv_SE.UTF-8 ; Define what modules to output - modules:left = cpu ram - modules:center = label - modules:right = clock + modules-left = cpu ram + modules-center = label + modules-right = clock ~~~ @@ -259,16 +308,16 @@ the resulting output might not be award-winning. ; %percentage% (default) label = %percentage% - ramp:0 = 🌕 - ramp:1 = 🌔 - ramp:2 = 🌓 - ramp:3 = 🌒 - ramp:4 = 🌑 + ramp-0 = 🌕 + ramp-1 = 🌔 + ramp-2 = 🌓 + ramp-3 = 🌒 + ramp-4 = 🌑 - bar:width = 10 - bar:indicator = | - bar:fill = ─ - bar:empty = ─ + bar-width = 10 + bar-indicator = | + bar-fill = ─ + bar-empty = ─ ~~~ @@ -294,50 +343,50 @@ the resulting output might not be award-winning. ##### Extra formatting (example) ~~~ ini ; Available tags: - ; (default) - ; - ; - ; - format:charging = + ; (default) + ; + ; + ; + format-charging = ; Available tags: - ; (default) - ; - ; - format:discharging = + ; (default) + ; + ; + format-discharging = ; Available tags: - ; (default) - ; - ; - ;format:full = + ; (default) + ; + ; + ;format-full = ; Available tokens: ; %percentage% (default) - label:charging = Charging %percentage% + label-charging = Charging %percentage% ; Available tokens: ; %percentage% (default) - label:discharging = Discharging %percentage% + label-discharging = Discharging %percentage% ; Available tokens: ; %percentage% (default) - label:full = Fully charged + label-full = Fully charged - ramp:capacity:0 =  - ramp:capacity:1 =  - ramp:capacity:2 =  - ramp:capacity:3 =  - ramp:capacity:4 =  + ramp-capacity-0 =  + ramp-capacity-1 =  + ramp-capacity-2 =  + ramp-capacity-3 =  + ramp-capacity-4 =  - bar:capacity:width = 10 + bar-capacity-width = 10 - animation:charging:0 =  - animation:charging:1 =  - animation:charging:2 =  - animation:charging:3 =  - animation:charging:4 =  - animation:charging:framerate_ms = 750 + animation-charging-0 =  + animation-charging-1 =  + animation-charging-2 =  + animation-charging-3 =  + animation-charging-4 =  + animation-charging-framerate_ms = 750 ~~~ @@ -349,72 +398,72 @@ the resulting output might not be award-winning. ##### Extra formatting (example) ~~~ ini - ; workspace_icon:[0-9]+ = label;icon - workspace_icon:0 = code;♚ - workspace_icon:1 = office;♛ - workspace_icon:2 = graphics;♜ - workspace_icon:3 = mail;♝ - workspace_icon:4 = web;♞ - workspace_icon:default = ♟ + ; workspace_icon-[0-9]+ = label;icon + workspace_icon-0 = code;♚ + workspace_icon-1 = office;♛ + workspace_icon-2 = graphics;♜ + workspace_icon-3 = mail;♝ + workspace_icon-4 = web;♞ + workspace_icon-default = ♟ ; Available tags: - ; (default) - gets replaced with - ; - gets replaced with - format = + ; (default) - gets replaced with + ; - gets replaced with + format = - ; If any values for label:dimmed:N area defined, the workspace/mode colors will get overridden + ; If any values for label-dimmed-N area defined, the workspace/mode colors will get overridden ; with those values if the monitor is out of focus - label:dimmed:foreground = #555 - label:dimmed:underline = ${BAR.background} + label-dimmed-foreground = #555 + label-dimmed-underline = ${BAR.background} ; Available tokens: ; %name% ; %icon% ; %index% ; Default: %icon% %name% - label:active = %icon% - label:active:foreground = #ffffff - label:active:background = #3f3f3f - label:active:underline = #fba922 + label-active = %icon% + label-active-foreground = #ffffff + label-active-background = #3f3f3f + label-active-underline = #fba922 ; Available tokens: ; %name% ; %icon% ; %index% ; Default: %icon% %name% - label:occupied = %icon% - label:occupied:underline = #555555 + label-occupied = %icon% + label-occupied-underline = #555555 ; Available tokens: ; %name% ; %icon% ; %index% ; Default: %icon% %name% - label:urgent = %icon% - label:urgent:foreground = #000000 - label:urgent:background = #bd2c40 - label:urgent:underline = #9b0a20 + label-urgent = %icon% + label-urgent-foreground = #000000 + label-urgent-background = #bd2c40 + label-urgent-underline = #9b0a20 ; Available tokens: ; %name% ; %icon% ; %index% ; Default: %icon% %name% - label:empty = %icon% - label:empty:foreground = #55ffffff + label-empty = %icon% + label-empty-foreground = #55ffffff ; Available tokens: ; None - label:monocle =  - ;label:tiled =  - ;label:fullscreen =  - ;label:floating =  - label:locked =  - label:locked:foreground = #bd2c40 - label:sticky =  - label:sticky:foreground = #fba922 - label:private =  - label:private:foreground = #bd2c40 + label-monocle =  + ;label-tiled =  + ;label-fullscreen =  + ;label-floating =  + label-locked =  + label-locked-foreground = #bd2c40 + label-sticky =  + label-sticky-foreground = #fba922 + label-private =  + label-private-foreground = #bd2c40 ~~~ @@ -431,23 +480,23 @@ the resulting output might not be award-winning. ~~~ ini ; Available tags: ;