update readme

This commit is contained in:
streetturtle 2021-05-01 22:47:33 -04:00
parent 517906060e
commit 806489899e
5 changed files with 104 additions and 52 deletions

View File

@ -2,11 +2,8 @@
Still under development! Still under development!
Create a wibar widget for Awesome WM with no lua code! This is a widget-maker tool - it creates a widget based on a JSON definition returned by a script.
For example, if your script returns following JSON:
This is a widget-maker tool - it creates a widget based on a definition described in JSON format and returned by a script.
For example, if your script returns a following JSON:
```json ```json
{ {
@ -14,71 +11,58 @@ For example, if your script returns a following JSON:
"icon": "smile", "icon": "smile",
"text": "noobie", "text": "noobie",
"mouse_actions": { "mouse_actions": {
"on_scroll_up": "echo 'scroll up'",
"on_scroll_down": "echo 'scroll down'",
"on_right_click": "echo 'right click'" "on_right_click": "echo 'right click'"
} }
} }
} }
``` ```
noobie will convert it to following widget: noobie will convert it to the widget:
![screenshot](./screenshots/screenshot.png). ![screenshot](./screenshots/screenshot.png).
You can also create widgets with a menu: More complex example (from a [people-in-space](https://github.com/streetturtle/noobie-plugins/tree/master/people-in-space) plugin) with a menu, each menu item has an icon, title and subtitle:
```json ![screenshot](./screenshots/screenshot3.png).
{
"widget": {
"icon": "smile",
"text": "noobie",
"mouse_actions": {
"on_scroll_up": "echo 'scroll up'",
"on_scroll_down": "echo 'scroll down'",
"on_right_click": "echo 'right click'"
}
},
"menu": {
"items": [
{
"icon": "bell",
"title": "Say hi!",
"onclick": "notify-send 'hi!'"
},
{
"icon": "terminal",
"title": "Execute some script",
"onclick": "/tmp/somescript.sh"
},
{
"icon": "slack",
"title": "OpenSlack",
"onclick": "xdg-open https://slack.com"
}
]
}
}
```
gives: For more examples check out plugins repository: [noobie-plugins](https://github.com/streetturtle/noobie-plugins)
![screenshot2](./screenshots/screenshot2.png)
## Features: ## Features:
- icon (either of a widget or of a menu item) can be one of: - dropdown menu:
- a name of an icon from [feather icons](https://feathericons.com/): `arrow-down-circle`;
- a path to a file: `/tmp/someicon.png; ![menu](./screenshots/screenshot2.png)
- a URL pointing to the icon: `http://some-icon.online/image.png` (with a fallback icon);
- mouse actions (scroll up/down, right click);
- icon could be either a local file, a feathericons icon or an image from URL;
- a notification with details in case your script failed: - a notification with details in case your script failed:
![error notification](./screenshots/screenshot-errors.png) ![error notification](./screenshots/screenshot-errors.png)
## Plugins ## Plugins
Check out existing plugins in this repo: https://github.com/streetturtle/noobie-plugins. Check out existing plugins in this repo: https://github.com/streetturtle/noobie-plugins.
## Creating a plugin
Please consult a **noobie.schema.json** for details. Below are few important excerpts:
- `icon` of the widget or menu item can be one of
- a name of feathericons icon, you can get it here: [feathericons.com](https://feathericons.com/);
- an absolute path to the image file;
- URL to the image file. If you are not sure image exists, you can add a `icon_fallback` field with an absolute path to the fallback image;
- for a horizontal line in the menu add an item with title equals to '-', like
```json
{ "title": "-" }
```
- for a header menu item set `header` field to true, note that the `icon` field will be ignored:
```json
{
"header": "true",
"title": "Header Title"
}
```
## Installation ## Installation
1. Clone the repo under ~/.config/awesome/ folder 1. Clone the repo under ~/.config/awesome/ folder
@ -93,4 +77,4 @@ Check out existing plugins in this repo: https://github.com/streetturtle/noobie-
```lua ```lua
noobie_exmaple_1{ path = os.getenv("HOME") .. '/.config/awesome/noobie/test.sh' }, noobie_exmaple_1{ path = os.getenv("HOME") .. '/.config/awesome/noobie/test.sh' },
noobie_exmaple_2{ path = os.getenv("HOME") .. '/.config/awesome/noobie/othertest.py' }, noobie_exmaple_2{ path = os.getenv("HOME") .. '/.config/awesome/noobie/othertest.py' },
``` ```

View File

@ -1,6 +1,6 @@
{ {
"widget": { "widget": {
"icon": "https://avatars.githubusercontent.com/u/9363150?s=60&v=4/2x/circled-down--v2.png", "icon": "smile",
"text": "noobie", "text": "noobie",
"mouse_actions": { "mouse_actions": {
"on_scroll_up": "echo 'scroll up'", "on_scroll_up": "echo 'scroll up'",
@ -11,7 +11,7 @@
"menu": { "menu": {
"items": [ "items": [
{ {
"icon": "https://avatars.githubusercontent.com/u/9363150?s=60&v=4/2x/circled-down--v2.png", "icon": "https://avatars.githubusercontent.com/u/9363150?v=4",
"icon_height": 40, "icon_height": 40,
"title": "Say hi!", "title": "Say hi!",
"onclick": "notify-send 'hi!'" "onclick": "notify-send 'hi!'"

68
noobie.schema.json Normal file
View File

@ -0,0 +1,68 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"widget": {
"type": "object",
"properties": {
"icon": {
"type": "string"
},
"text": {
"type": "string"
},
"mouse_actions": {
"type": "object",
"properties": {
"on_scroll_up": {
"type": "string"
},
"on_scroll_down": {
"type": "string"
},
"on_right_click": {
"type": "string"
}
}
}
}
},
"menu": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"icon": {
"type": "string"
},
"icon_height": {
"type": "integer"
},
"title": {
"type": "string"
},
"onclick": {
"type": "string"
}
},
"required": [
"title",
"onclick"
]
}
]
}
},
"required": [
"items"
]
}
},
"required": [
"widget"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 14 KiB

BIN
screenshots/screenshot3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB