diff --git a/_posts/2014-12-19-aw-v21-bells-and-whistles.md b/_posts/2014-12-19-aw-v21-bells-and-whistles.md index 27fa11b..5ab1fb9 100644 --- a/_posts/2014-12-19-aw-v21-bells-and-whistles.md +++ b/_posts/2014-12-19-aw-v21-bells-and-whistles.md @@ -25,7 +25,17 @@ simply editing the desktop file. Items are stored in the two directories: `/usr/share/awesomewidgets/%TYPE%/` and `$HOME/.local/share/awesomewidgets/%TYPE%/` (path may be differ in depend from your distro). Settings in the home directory have a higher priority that global -ones. +ones. Common settings for all extensions are: + +| Field | Required | Value | Default | +| -------------------|----------|----------------------------------|------------| +| Name | yes | name | none | +| Comment | no | comment | empty | +| X-AW-Active | no | whether or not the item is active, N/A for bars | true | +| X-AW-ApiVersion | yes | API compatibility index. Do not touch it if you don't know what does it mean | 0 | +| X-AW-Interval | no | update interval in standard widget intervals, N/A for bars | 1 | +| X-AW-Number | yes | unique number which will be associated with the item | random number which is less than 1000 | + ## Bars @@ -33,8 +43,6 @@ Directory is `desktops`, configuration files have the following fields: | Field | Required | Value | Default | | -------------------|----------|----------------------------------|------------| -| Name | yes | bar name | none | -| Comment | no | comment | empty | | X-AW-Custom | yes | does value have custom formula or not, boolean | false | | X-AW-Value | yes | bar value. The following tags are available `cpu*`, `gpu`, `mem`, `swap`, `hdd*`, `bat`. In case of `X-AW-Custom=true` it uses syntax similar to [lambda functions](/projects/awesome-widgets/#lambda) | cpu | | X-AW-Max | no | maximal possible value, float | 100.0 | @@ -46,7 +54,6 @@ Directory is `desktops`, configuration files have the following fields: | X-AW-Direction | yes | the fill direction. The following variants are supported `LeftToRight`, `RightToLeft` | LeftToRight | | X-AW-Height | yes | height, pixels | 100 | | X-AW-Width | yes | width, pixels | 100 | -| X-AW-Number | yes | unique number which will be associated with the script | random number which is less than 1000 | ## Quotes @@ -56,12 +63,7 @@ following fields: | Field | Required | Value | Default | |-------|----------|-------|---------| -| Name | yes | quotes name | none | -| Comment | no | comment | empty | | X-AW-Ticker | yes | ticker from Yahoo! Finance system | EURUSD=X | -| X-AW-Active | no | whether or not the quotes is active | true | -| X-AW-Interval | no | update interval in standard widget intervals | 1 | -| X-AW-Number | yes | unique number which will be associated with the script | random number which is less than 1000 | ## Scripts @@ -69,14 +71,9 @@ Directory is `scripts`, configuration files have the following fields: | Field | Required | Value | Default | |-------|----------|-------|---------| -| Name | yes | script name | none | -| Comment | no | comment | empty | | Exec | yes | path to executable file | /usr/bin/true | | X-AW-Prefix | no | prefix to executable file. Usually it's not required, but in other you may want to specify interpreter for example | -| X-AW-Active | no | whether or not the script is active | true | | X-AW-Redirect | no | stream redirection. The following variants are available `stderr2stdout`, `nothing`, `stdout2stderr`, `swap`. stderr will be available, if you run application in the debug mode | nothing | -| X-AW-Interval | no | update interval in standard widget intervals | 1 | -| X-AW-Number | yes | unique number which will be associated with the script | random number which is less than 1000 | | X-AW-Filters | no | comma separated filters from `awesomewidgets-extscripts-filters.json` | ## Upgrade @@ -85,14 +82,9 @@ Directory is `upgrade`, configuration files have the following fields: | Field | Required | Value | Default | |-------|----------|-------|---------| -| Name | yes | upgrade name | none | -| Comment | no | comment | empty | | Exec | yes | path to executable file | /usr/bin/true | | X-AW-Filter | no | the regexp which will be applied to command output. If set `X-AW-Null` will be ignored | -| X-AW-Active | no | whether or not the upgrade script is active | true | | X-AW-Null | no | the number of lines which should be skipped in output | 0 | -| X-AW-Interval | no | update interval in standard widget intervals | 1 | -| X-AW-Number | yes | unique number which will be associated with the bar | random number which is less than 1000 | ## Weather @@ -102,12 +94,8 @@ following fields: | Field | Required | Value | Default | |-------|----------|-------|---------| -| Name | yes | weather name | none | -| Comment | no | comment | empty | | X-AW-City | yes | city | London | | X-AW-Country | yes | two-letter country code | uk | | X-AW-Image | no | use images as weather icon or text. | false | +| X-AW-Provider | yes | weather provider. Supported ones are `Yahoo`, `OWM` | OWM | | X-AW-TS | yes | time to which weather should be. `0` is a current weather, `1` - weather 3 hours later, etc | 0 | -| X-AW-Active | no | whether or not the monitor is active | true | -| X-AW-Interval | no | update interval in standard widget intervals | 1 | -| X-AW-Number | yes | unique number which will be associated with the upgrade weather | random number which is less than 1000 | diff --git a/_posts/2016-06-05-aw-formatters-and-macros.md b/_posts/2016-06-05-aw-formatters-and-macros.md index 3e888ae..558f845 100644 --- a/_posts/2016-06-05-aw-formatters-and-macros.md +++ b/_posts/2016-06-05-aw-formatters-and-macros.md @@ -35,7 +35,11 @@ fields inside `[Desktop Entry]` section: | -------------------|----------|----------------------------------|------------| | Name | yes | formatter name | none | | Comment | no | comment | empty | -| X-AW-Type | no | formatter type. The following types are supported: `NoFormat`, `DateTime`, `Float`, `List`, `Script` | NoFormat | +| X-AW-ApiVersion | yes | API compatibility index. Do not touch it if you don't know what does it mean | 0 | +| X-AW-Type | no | formatter type. The following types are supported: `NoFormat`, `DateTime`, `Float`, `List`, `Script`, `String` | NoFormat | + +Additionaly the following fields will be added by common extesions: `X-AW-Active`, +`X-AW-Interval`, `X-AW-Number`, but they will be ignored. Each formatter type has own behaviour and own settings and they are described below. Also there are system-wide settings which are stored in `/usr/share/awesomewidgets/formatters/`, system formatters will be overwritten by @@ -66,7 +70,7 @@ Converts any number to string. | X-AW-Multiplier | no | float to which value will be multiplied | 1.0 | | X-AW-Precision | no | show this count of symbols after dot | -1 (as expected) | | X-AW-Summand | no | float to which value will be increased | 0.0 | -| X-AW-Width | no | width of the field | 0 (do not limit) | +| X-AW-Width | no | width of the field, negative means left-alignment | 0 (do not limit) | Please note that actual formula is `X-AW-Multiplier * value + X-AW-Summand`. @@ -80,6 +84,16 @@ Coverts list of string objects to string. | X-AW-Separator | no | use this separator to join strings | (empty | | X-AW-Sort | no | boolean, sort or not list | false | +## String formatter + +Improved version of `NoFormat`. + +| Field | Required | Value | Default | +| -------------------|----------|----------------------------------|------------| +| X-AW-FillChar | no | char to fill string to `X-AW-Width` | (space) | +| X-AW-ForceWidth | no | strip string after `X-AW-Width` | false | +| X-AW-Width | no | width of the field, negative means left-alignment | 0 (do not limit) | + ## Script formatter Uses javascript code to convert value to string. Value will be passed as argument diff --git a/ru/_posts/2014-12-19-aw-v21-bells-and-whistles.md b/ru/_posts/2014-12-19-aw-v21-bells-and-whistles.md index d6806a7..52eec54 100644 --- a/ru/_posts/2014-12-19-aw-v21-bells-and-whistles.md +++ b/ru/_posts/2014-12-19-aw-v21-bells-and-whistles.md @@ -25,7 +25,17 @@ short: aw-v21-bells-and-whistles Все элементы хранятся в двух директориях: `/usr/share/awesomewidgets/%TYPE%/` и `$HOME/.local/share/awesomewidgets/%TYPE%/` (пути могут немного отличаться в зависимости от используемого дистрибутива). Настройки в домашней директории -перезаписывают глобальные настройки. +перезаписывают глобальные настройки. Общие настройки для любого расширения +следующие: + +| Поле | Обязательное | Значение | По-умолчанию | +|------|--------------|----------|--------------| +| Name | да | имя | none | +| Comment | нет | комментарий | empty | +| X-AW-Active | нет | активно или нет данное расширение, игнорируется барами | true | +| X-AW-ApiVersion | да | совместимость API. Не меняйте, если не знаете, что делаете | 0 | +| X-AW-Interval | да | интервал запуска расширения в стандартных интервалах обновления виджета, игнорируется барами | 1 | +| X-AW-Number | да | уникальный номер, который будет ассоциирован с данным расширением | случайное число меньше 1000 | ## Бары @@ -33,8 +43,6 @@ short: aw-v21-bells-and-whistles | Поле | Обязательное | Значение | По-умолчанию | |------|--------------|----------|--------------| -| Name | да | имя бара | none | -| Comment | нет | комментарий | empty | | X-AW-Custom | да | содержит ли значение произвольную формулу или нет | false | | X-AW-Value | да | значение бара. Доступны теги `cpu*`, `gpu`, `mem`, `swap`, `hdd*`, `bat`. В случае `X-AW-Custom=true` использует синтаксис аналогичный []лямбда функциям](/ru/projects/awesome-widgets/#lambda) | cpu | | X-AW-Max | нет | максимально возможное значение | 100.0 | @@ -46,7 +54,6 @@ short: aw-v21-bells-and-whistles | X-AW-Direction | да | направление заполнения. Доступны варианты `LeftToRight`, `RightToLeft` | LeftToRight | | X-AW-Height | да | высота в пикселях | 100 | | X-AW-Width | да | ширина в пикселях | 100 | -| X-AW-Number | да | уникальный номер, который будет ассоциирован с данным баром | случайное число меньше 1000 | ## Котировки @@ -55,12 +62,7 @@ Yahoo! Finance"). Директория называется `quotes`, файлы | Поле | Обязательное | Значение | По-умолчанию | |------|--------------|----------|--------------| -| Name | да | имя котировок | none | -| Comment | нет | комментарий | empty | | X-AW-Ticker | да | тикер из системы Yahoo! Finance | EURUSD=X | -| X-AW-Active | нет | активны или нет данные котировки | true | -| X-AW-Interval | да | интервал запуска котировок в стандартных интервалах обновления виджета | 1 | -| X-AW-Number | да | уникальный номер, который будет ассоциирован с данными котировками | случайное число меньше 1000 | ## Скрипты @@ -68,14 +70,9 @@ Yahoo! Finance"). Директория называется `quotes`, файлы | Поле | Обязательное | Значение | По-умолчанию | |------|--------------|----------|--------------| -| Name | да | имя скрипта | none | -| Comment | нет | комментарий | empty | | Exec | да | путь к исполняемому файлу | /usr/bin/true | | X-AW-Prefix | нет | префикс к исполняемому файлу. Обычно не требуется, однако в отдельных случаях может потребоваться явно указать путь, например, к используемому интерпретатору | -| X-AW-Active | нет | активен или нет данный скрипт | true | | X-AW-Redirect | нет | перенаправление потоков сообщений. Доступны варианты `stderr2stdout`, `nothing`, `stdout2stderr`, `swap`. stderr доступен, если запустить в режиме отладки | nothing | -| X-AW-Interval | да | интервал запуска скрипта в стандартных интервалах обновления виджета | 1 | -| X-AW-Number | да | уникальный номер, который будет ассоциирован с данным скриптом | случайное число меньше 1000 | | X-AW-Filters | нет | фильтры из `awesomewidgets-extscripts-filters.json` разделенные запятой | ## Обновления @@ -84,14 +81,9 @@ Yahoo! Finance"). Директория называется `quotes`, файлы | Поле | Обязательное | Значение | По-умолчанию | |------|--------------|----------|--------------| -| Name | да | имя скрипта обновлений | none | -| Comment | нет | комментарий | empty | | Exec | да | путь к исполняемому файлу | /usr/bin/true | | X-AW-Filter | нет | регулярное выражение, которое будет применено к выдаче команды. Если не пустое, параметр `X-AW-Null` будет проигнорирован | -| X-AW-Active | нет | активен или нет данный скрипт обновления | true | | X-AW-Null | нет | число строк stdout, которые будут пропущены при подсчете | 0 | -| X-AW-Interval | да | интервал запуска скрипта в стандартных интервалах обновления виджета | 1 | -| X-AW-Number | да | уникальный номер, который будет ассоциирован с данным скриптом | случайное число меньше 1000 | ## Погода @@ -101,12 +93,8 @@ Yahoo! Finance"). Директория называется `quotes`, файлы | Поле | Обязательное | Значение | По-умолчанию | |------|--------------|----------|--------------| -| Name | да | имя погоды | none | -| Comment | нет | комментарий | empty | | X-AW-City | да | город | London | | X-AW-Country | да | двухбуквенное обозначения страны | uk | | X-AW-Image | нет | использовать изображения в качестве иконки погоды или текст | uk | +| X-AW-Provider | да | провайдер погоды. Доступны `Yahoo`, `OWM` | OWM | | X-AW-TS | да | на какое время прогноз (целое число). `0` - текущая погода, `1` - погода через 3 часа и т.д. | 0 | -| X-AW-Active | нет | активен или нет данный монитор погоды | true | -| X-AW-Interval | да | интервал запуска монитора в стандартных интервалах обновления виджета | 1 | -| X-AW-Number | да | уникальный номер, который будет ассоциирован с данным монитором | случайное число меньше 1000 | diff --git a/ru/_posts/2016-06-05-aw-formatters-and-macros.md b/ru/_posts/2016-06-05-aw-formatters-and-macros.md index 7ba1d52..1b61fdc 100644 --- a/ru/_posts/2016-06-05-aw-formatters-and-macros.md +++ b/ru/_posts/2016-06-05-aw-formatters-and-macros.md @@ -36,7 +36,11 @@ cpu=myformatter | -------------------|--------------|----------------------------------|--------------| | Name | да | имя форматера | none | | Comment | нет | комментарий | empty | -| X-AW-Type | нет | тип форматера. Поддерживаются следующие типы: `NoFormat`, `DateTime`, `Float`, `List`, `Script` | NoFormat | +| X-AW-ApiVersion | да | совместимость API. Не меняйте, если не знаете, что делаете | 0 | +| X-AW-Type | нет | тип форматера. Поддерживаются следующие типы: `NoFormat`, `DateTime`, `Float`, `List`, `Script`, `String` | NoFormat | + +Дополнительно следующте поля добавлены для совместимости:: `X-AW-Active`, +`X-AW-Interval`, `X-AW-Number`, но они будут проигнорированы. Каждый тип форматера имеет свое поведение и свои настройки, которые описаны ниже. Также существуют системные настройки, которые хранятся в `/usr/share/awesomewidgets/formatters/`, @@ -68,7 +72,7 @@ cpu=myformatter | X-AW-Multiplier | нет | число, на которое значение будет умножено | 1.0 | | X-AW-Precision | нет | число знаков после запятой | -1 (как получится) | | X-AW-Summand | нет | число, которое будет добавлено к значению | 0.0 | -| X-AW-Width | нет | ширина числового поля | 0 (не ограничивать) | +| X-AW-Width | нет | ширина числового поля, отрицательное - выравнивание по левому краю | 0 (не ограничивать) | Конечное значение будет получено по формуле `X-AW-Multiplier * value + X-AW-Summand`. @@ -111,6 +115,16 @@ X-AW-HasReturn=false }) ``` +## String форматер + +Улучшенная версия `NoFormat`. + +| Поле | Обязательное | Значение | По-умолчанию | +| -------------------|--------------|----------------------------------|--------------| +| X-AW-FillChar | нет | символ для заполнения до `X-AW-Width` | (space) | +| X-AW-ForceWidth | нет | обрезать строку после `X-AW-Width` | false | +| X-AW-Width | нет | ширина поля, отрицательное - выравнивание по левому краю | 0 (не ограничивать) | + # Макросы Другая особенность - макросы. Пользователь может определить свою функцию, используя