noobie/README.md

91 lines
2.9 KiB
Markdown
Raw Permalink Normal View History

2021-03-13 04:43:13 +01:00
# noobie
2021-05-02 04:47:33 +02:00
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:
2021-03-13 04:43:13 +01:00
```json
{
"widget": {
"icon": "smile",
2021-03-13 04:43:13 +01:00
"text": "noobie",
"mouse_actions": {
"on_right_click": "echo 'right click'"
}
}
}
```
2021-05-02 04:47:33 +02:00
noobie will convert it to the widget:
2021-03-13 04:43:13 +01:00
![screenshot](./screenshots/screenshot.png).
2021-05-02 04:47:33 +02:00
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:
2021-03-13 04:43:13 +01:00
2021-05-02 04:47:33 +02:00
![screenshot](./screenshots/screenshot3.png).
2021-03-13 04:43:13 +01:00
2021-05-02 04:47:33 +02:00
For more examples check out plugins repository: [noobie-plugins](https://github.com/streetturtle/noobie-plugins)
2021-03-13 04:43:13 +01:00
## Features:
2021-05-02 04:47:33 +02:00
- dropdown menu:
![menu](./screenshots/screenshot2.png)
- mouse actions (scroll up/down, right click);
2021-05-12 16:22:30 +02:00
- icon could be either a local file, a [feathericons](https://feathericons.com/) icon or an image from URL;
2021-05-01 04:17:47 +02:00
- a notification with details in case your script failed:
2021-05-02 04:47:33 +02:00
![error notification](./screenshots/screenshot-errors.png)
2021-05-01 04:17:47 +02:00
2021-03-13 04:43:13 +01:00
## Plugins
2021-05-01 04:17:47 +02:00
Check out existing plugins in this repo: https://github.com/streetturtle/noobie-plugins.
2021-03-13 04:43:13 +01:00
2021-05-02 04:47:33 +02:00
## 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"
}
```
2021-03-13 04:43:13 +01:00
## Installation
2021-04-09 17:55:42 +02:00
1. Clone the repo under ~/.config/awesome/ folder
2021-03-13 04:43:13 +01:00
1. At the top of rc.lua add an import:
2021-04-09 17:55:42 +02:00
2021-04-09 17:56:07 +02:00
```lua
local noobie_exmaple_1 = require("noobie")
local noobie_exmaple_2 = require("noobie")
```
2021-03-13 04:43:13 +01:00
1. Add a widget to wibox and provide a path to your script:
2021-04-09 17:55:42 +02:00
2021-04-09 17:56:07 +02:00
```lua
noobie_exmaple_1{ path = os.getenv("HOME") .. '/.config/awesome/noobie/test.sh' },
noobie_exmaple_2{ path = os.getenv("HOME") .. '/.config/awesome/noobie/othertest.py' },
2021-05-16 02:21:25 +02:00
```
2021-07-23 02:37:50 +02:00
If your widget is static you can define it in a JSON file and use like this:
```lua
noobie_exmaple_1{ path = 'cat ' .. os.getenv("HOME") .. '/.config/awesome/noobie/test.json' },
```
2021-05-16 02:21:25 +02:00
# Troubleshooting
In case of any problem / issue / question:
- create an [issue](https://github.com/streetturtle/noobie/issues/new/choose)
- raise a question on [Discussions](https://github.com/streetturtle/noobie/discussions)!
- ping me on AwesomeWM's discord, here's an [invite](https://discord.gg/XYvn8R5)