remote control: /NOTIFY: if multiple arguments are provided, interpret the first one as the icon's name for the client notification

This commit is contained in:
bordun 2022-08-29 15:40:46 +02:00
parent 7789e5322d
commit 2ab69d29fb
4 changed files with 19 additions and 3 deletions

View file

@ -1,5 +1,11 @@
# Changelog
## 1.18.0
- remote control
- `/NOTIFY`: if multiple arguments are provided, interpret the first one as the icon's name for the client notification
## 1.17.0
- bug fixes

View file

@ -117,10 +117,14 @@ Same as `/GET` but uses the widget's address instead of `/GET` to reply.
----
#### `/NOTIFY message`
#### `/NOTIFY icon message`
Sends a notification message to the client.
- `icon`: icon for the notification, for example : `^play`, `^pause`, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free)
- `message`: message content
----
#### `/LOG message`

View file

@ -247,8 +247,14 @@ var callbacks = {
if (!Array.isArray(args)) args = [args]
var icon
if (args.length > 1 && typeof args[0] === 'string' && args[0].indexOf(' ') === -1) {
icon = args.shift()
}
notifications.add({
message: args.join('\n') || ' '
message: args.join('\n') || ' ',
icon: icon
})
},

View file

@ -20,7 +20,7 @@ class Button extends Widget {
colorTextOn: {type: 'string', value: 'auto', help: 'Defines the widget\'s text color when active.'},
label: {type: 'string|boolean', value: 'auto', help: [
'Set to `false` to hide completely',
'- Insert icons using the prefix ^ followed by the icon\'s name : `^play`, `^pause`, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free)',
'- Insert icons using the prefix ^ followed by the icon\'s name : `^play`, `^pause`, etc (see https://fontawesome.com/search?m=free&s=solid',
'- Icons can be transformed with the following suffixes: `.flip-[horizontal|vertical|both]`, `.rotate-[90|180|270]`, `.spin`, `.pulse`. Example: `^play.flip-horizontal`',
]},
vertical: {type: 'boolean', value: false, help: 'Set to `true` to display the text vertically'},