Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions custom-shortcut/README.md
Original file line number Diff line number Diff line change
@@ -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.
36 changes: 36 additions & 0 deletions custom-shortcut/plugin.toml
Original file line number Diff line number Diff line change
@@ -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\""
16 changes: 16 additions & 0 deletions custom-shortcut/shortcut.luau
Original file line number Diff line number Diff line change
@@ -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
Binary file added custom-shortcut/thumbnail.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions custom-shortcut/translations/en.json
Original file line number Diff line number Diff line change
@@ -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."
}
}
}
16 changes: 16 additions & 0 deletions custom-shortcut/translations/fr.json
Original file line number Diff line number Diff line change
@@ -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é."
}
}
}