diff --git a/custom-shortcut/README.md b/custom-shortcut/README.md new file mode 100644 index 00000000..bad63059 --- /dev/null +++ b/custom-shortcut/README.md @@ -0,0 +1,26 @@ +# Custom Shortcut + +Add a custom centrol center tile. Choose the label, icon and command launched when clicked. + +## Plugin + +| Field | Value | +| --- | --- | +| ID | `yocraft/custom-shortcut` | +| Entries | Shortcut: `shortcut` | + +## Usage + +Add the shortcut to your control center and configure it in the plugin settings. + +## Settings + +| Setting | Type | Default | Description | +| --- | --- | --- | --- | +| `label` | `string` | `Custom` | Text of the control center shortcut. | +| `icon` | `glyph` | `question-mark` | Icon of the control center shortcut. | +| `onclick_cmd` | `string` | `notify-send "Custom Shortcut"` | Command executed when the shortcut is clicked. | + +## Notes + +The shortcut need a noctalia restart to appear. diff --git a/custom-shortcut/plugin.toml b/custom-shortcut/plugin.toml new file mode 100644 index 00000000..02f1ba97 --- /dev/null +++ b/custom-shortcut/plugin.toml @@ -0,0 +1,36 @@ +id = "yocraft/custom-shortcut" +name = "Custom Shortcut" +version = "1.0.0" +plugin_api = 3 +author = "yocraft" +license = "MIT" +deprecated = false +icon = "command" +description = "Add a custom control center tile." +tags = [ "shortcut", "utility" ] +dependencies = [] + +[[shortcut]] +id = "shortcut" +entry = "shortcut.luau" + +[[setting]] +key = "label" +type = "string" +label_key = "settings.label.label" +description_key = "settings.label.description" +default = "Custom" + +[[setting]] +key = "icon" +type = "glyph" +label_key = "settings.icon.label" +description_key = "settings.icon.description" +default = "question-mark" + +[[setting]] +key = "onclick_cmd" +type = "string" +label_key = "settings.onclick_cmd.label" +description_key = "settings.onclick_cmd.description" +default = "notify-send \"Custom Shortcut\"" diff --git a/custom-shortcut/shortcut.luau b/custom-shortcut/shortcut.luau new file mode 100644 index 00000000..1fe38f31 --- /dev/null +++ b/custom-shortcut/shortcut.luau @@ -0,0 +1,16 @@ +local config = { + label = noctalia.getConfig("label"), + icon = noctalia.getConfig("icon"), + cmd = noctalia.getConfig("onclick_cmd"), +} + +local function render() + shortcut.setLabel(config.label) + shortcut.setIcon(config.icon) +end + +render() + +function onClick() + noctalia.runAsync(config.cmd) +end diff --git a/custom-shortcut/thumbnail.webp b/custom-shortcut/thumbnail.webp new file mode 100644 index 00000000..76ccc75b Binary files /dev/null and b/custom-shortcut/thumbnail.webp differ diff --git a/custom-shortcut/translations/en.json b/custom-shortcut/translations/en.json new file mode 100644 index 00000000..92b55409 --- /dev/null +++ b/custom-shortcut/translations/en.json @@ -0,0 +1,16 @@ +{ + "settings": { + "label": { + "label": "Label", + "description": "Text of the control center shortcut." + }, + "icon": { + "label": "Icon", + "description": "Icon of the control center shortcut." + }, + "onclick_cmd": { + "label": "Command", + "description": "Command executed when the shortcut is clicked." + } + } +} diff --git a/custom-shortcut/translations/fr.json b/custom-shortcut/translations/fr.json new file mode 100644 index 00000000..52a1db10 --- /dev/null +++ b/custom-shortcut/translations/fr.json @@ -0,0 +1,16 @@ +{ + "settings": { + "label": { + "label": "Libellé", + "description": "Texte du raccourci du centre de contrôle." + }, + "icon": { + "label": "Icône", + "description": "Icêne du raccourci du centre de contrôle." + }, + "onclick_cmd": { + "label": "Commande", + "description": "Commande exécutée lorsque le raccourci est cliqué." + } + } +}