From b0b5ceb85d40ed937f9c5ecb50349d127149f9ea Mon Sep 17 00:00:00 2001 From: Till Date: Wed, 23 Feb 2022 01:55:55 +0100 Subject: [PATCH] Also allow '#menu:' as keyword instead of '#!' in input.conf Apparently lua patterns don't have syntax which does (#!|#menu:), so it is split with the if statement --- README.md | 2 +- uosc.lua | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d2b4edb..382fc85 100644 --- a/README.md +++ b/README.md @@ -379,7 +379,7 @@ Adding items to menu is facilitated by commenting your keybinds in `input.conf` Comment has to be at the end of the line with the binding. -Comment has to start with `#!`. +Comment has to start with `#!` (or `#menu:`). Text after `#!` is an item title. diff --git a/uosc.lua b/uosc.lua index f987e34..23d9f77 100644 --- a/uosc.lua +++ b/uosc.lua @@ -2825,6 +2825,9 @@ state.context_menu_items = (function() for line in io.lines(input_conf_path) do local key, command, title = string.match(line, '%s*([%S]+)%s+(.*)%s#!%s*(.*)') + if not key then + key, command, title = string.match(line, '%s*([%S]+)%s+(.*)%s#menu:%s*(.*)') + end if key then local is_dummy = key:sub(1, 1) == '#' local submenu_id = ''