feat: add toggle for notifications on device switch and toggle for keybinds in tooltip (#122)
* feat(audio-switcher): add toggle for notifications on device switch * feat(audio-switcher): add toggle for actions in tooltip and change appearance of tooltip * chore(audio-switcher): bump version to 0.2.0 * fix(audio-switcher): add missing translation keys
This commit is contained in:
@@ -49,6 +49,8 @@ Use the settings button in the panel header to open Noctalia's plugin settings.
|
||||
| Entry | Setting | Type | Default | Description |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Plugin | `show_percentage` | `bool` | `true` | Show the output volume beside the bar icon; disable it for an icon-only widget. |
|
||||
| Plugin | `show_notification_on_switch` | `bool` | `true` | Show a notification when switching device. |
|
||||
| Plugin | `show_actions_in_tooltip` | `bool` | `true` | Show actions in tooltip. |
|
||||
| Plugin | `scroll_step` | `int` | `5` | Volume points changed by each wheel step over the bar widget (1–25). |
|
||||
|
||||
## IPC and keybinds
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
id = "blackbartblues/audio-switcher"
|
||||
name = "Audio Switcher"
|
||||
version = "0.1.1"
|
||||
version = "0.2.0"
|
||||
plugin_api = 9
|
||||
author = "blackbartblues"
|
||||
license = "MIT"
|
||||
@@ -16,6 +16,20 @@ label_key = "settings.show_percentage.label"
|
||||
description_key = "settings.show_percentage.description"
|
||||
default = true
|
||||
|
||||
[[setting]]
|
||||
key = "show_notification_on_switch"
|
||||
type = "bool"
|
||||
label_key = "settings.show_notification_on_switch.label"
|
||||
description_key = "settings.show_notification_on_switch.description"
|
||||
default = true
|
||||
|
||||
[[setting]]
|
||||
key = "show_actions_in_tooltip"
|
||||
type = "bool"
|
||||
label_key = "settings.show_actions_in_tooltip.label"
|
||||
description_key = "settings.show_actions_in_tooltip.description"
|
||||
default = true
|
||||
|
||||
[[setting]]
|
||||
key = "scroll_step"
|
||||
type = "int"
|
||||
|
||||
@@ -751,7 +751,7 @@ local function setDefaultTarget(command, kind, device)
|
||||
end
|
||||
moveStreams(kind, device.targetName, function()
|
||||
local messageKey = kind == "output" and "notifications.output_selected" or "notifications.input_selected"
|
||||
finishAction(command, true, noctalia.tr(messageKey, { device = device.name }))
|
||||
finishAction(command, true, noctalia.tr(messageKey, { device = device.name }), noctalia.getConfig("show_notification_on_switch"))
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -88,6 +88,14 @@
|
||||
"show_percentage": {
|
||||
"description": "Show the current output volume percentage next to the bar icon. Disable it to show only the icon.",
|
||||
"label": "Show percentage"
|
||||
},
|
||||
"show_notification_on_switch": {
|
||||
"description": "Show a notification when switching device.",
|
||||
"label": "Show notification on switch"
|
||||
},
|
||||
"show_actions_in_tooltip": {
|
||||
"description": "Show actions in tooltip.",
|
||||
"label": "Show actions in tooltip"
|
||||
}
|
||||
},
|
||||
"tabs": {
|
||||
@@ -96,6 +104,25 @@
|
||||
},
|
||||
"title": "Audio Switcher",
|
||||
"widget": {
|
||||
"tooltip": "Output: {output} ({output_volume})\nInput: {input} ({input_volume})\nScroll: change output volume\nLeft click: open Audio Switcher\nRight click: cycle outputs\nMiddle click: cycle inputs"
|
||||
"input": "Input",
|
||||
"output": "Output",
|
||||
"action": {
|
||||
"scroll": {
|
||||
"key": "Scroll",
|
||||
"description": "Change output volume"
|
||||
},
|
||||
"left_click": {
|
||||
"key": "Left click",
|
||||
"description": "Open Audio Switcher"
|
||||
},
|
||||
"right_click": {
|
||||
"key": "Right click",
|
||||
"description": "Cycle visible outputs"
|
||||
},
|
||||
"middle_click": {
|
||||
"key": "Middle click",
|
||||
"description": "Cycle visible inputs"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,12 +52,15 @@ local function render()
|
||||
|
||||
local showPercentage = noctalia.getConfig("show_percentage") ~= false
|
||||
barWidget.setText(showPercentage and not barWidget.isVertical() and outputVolume or "")
|
||||
barWidget.setTooltip(noctalia.tr("widget.tooltip", {
|
||||
output = outputName,
|
||||
output_volume = outputVolume,
|
||||
input = inputName,
|
||||
input_volume = inputVolume,
|
||||
}))
|
||||
local tooltipItems = {{key = noctalia.tr("widget.output"), value = `{outputName} ({outputVolume})`},
|
||||
{key = noctalia.tr("widget.input"), value = `{inputName} ({inputVolume})`}}
|
||||
if noctalia.getConfig("show_actions_in_tooltip") == true then
|
||||
table.insert(tooltipItems, {key = noctalia.tr("widget.action.scroll.key"), value = noctalia.tr("widget.action.scroll.description")})
|
||||
table.insert(tooltipItems, {key = noctalia.tr("widget.action.left_click.key"), value = noctalia.tr("widget.action.left_click.description")})
|
||||
table.insert(tooltipItems, {key = noctalia.tr("widget.action.right_click.key"), value = noctalia.tr("widget.action.right_click.description")})
|
||||
table.insert(tooltipItems, {key = noctalia.tr("widget.action.middle_click.key"), value = noctalia.tr("widget.action.middle_click.description")})
|
||||
end
|
||||
barWidget.setTooltip(tooltipItems)
|
||||
end
|
||||
|
||||
local function dispatch(action)
|
||||
|
||||
Reference in New Issue
Block a user