-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsettings-utils.js
More file actions
54 lines (50 loc) · 1.9 KB
/
settings-utils.js
File metadata and controls
54 lines (50 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* settings-utils.js
*
* This file is part of the Custom Command Toggle GNOME Shell extension
* https://github.com/StorageB/custom-command-toggle
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
// Shared utilities and constants for settings management
// This file can be imported by both extension.js and prefs.js
export const numberOfTogglesAllowed = 6;
// Enum for all setting types
export const SettingTypes = Object.freeze({
TITLE: 'title',
ICONS: 'icons',
COMMAND_ON: 'command-on',
COMMAND_OFF: 'command-off',
CHECK_COMMAND: 'checkcommand',
CHECK_REGEX: 'checkregex',
INITIAL_STATE: 'initialstate',
RUN_COMMAND_AT_BOOT: 'runcommandatboot',
DELAY_TIME: 'delaytime',
CHECK_COMMAND_DELAY_TIME: 'checkcommanddelaytime',
BUTTON_CLICK: 'buttonclick',
CHECK_EXIT_CODE: 'checkexitcode',
SHOW_INDICATOR: 'showindicator',
CLOSE_MENU: 'closemenu',
CHECK_COMMAND_SYNC: 'checkcommandsync',
CHECK_COMMAND_INTERVAL: 'checkcommandinterval',
KEYBINDING: 'keybinding',
STATE: 'state',
ENABLED: 'enabled',
});
// Get setting key by toggle number and setting type
// All toggles follow the same consistent pattern
export function getSettingKey(toggleNumber, settingType) {
return `toggle${toggleNumber}-${settingType}`;
}