Skip to content

Commit 3eadf78

Browse files
Add schemas for: LinUtil (#4080)
* feat(schema): support LinUtil configs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix(schema): use `id` instead of `$id` * feat(test): add positive tests * feat(test): add negative tests --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 3bce93d commit 3eadf78

File tree

7 files changed

+269
-0
lines changed

7 files changed

+269
-0
lines changed

src/api/json/catalog.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6884,6 +6884,18 @@
68846884
"description": "Preset list for a WinUtil",
68856885
"fileMatch": ["**/*winutil*/config/preset.json"],
68866886
"url": "https://raw.githubusercontent.com/winutil-preset.json"
6887+
},
6888+
{
6889+
"name": "Tab list for a LinUtil",
6890+
"description": "Tab list for a LinUtil",
6891+
"fileMatch": ["**/*linutil*/**/tabs.toml"],
6892+
"url": "https://raw.githubusercontent.com/linutil-tabs.json"
6893+
},
6894+
{
6895+
"name": "Tab data for a LinUtil",
6896+
"description": "Tab data for a LinUtil",
6897+
"fileMatch": ["**/*linutil*/**/tab_data.toml"],
6898+
"url": "https://raw.githubusercontent.com/linutil-tab-data.json"
68876899
}
68886900
]
68896901
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"data": [
3+
{
4+
"name": "",
5+
"script": ""
6+
},
7+
{
8+
"entries": [
9+
{
10+
"name": "",
11+
"script": ""
12+
}
13+
],
14+
"name": "",
15+
"preconditions": [
16+
{
17+
"data": {
18+
"environment": ""
19+
},
20+
"values": [""]
21+
}
22+
]
23+
}
24+
],
25+
"name": ""
26+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directories": [""]
3+
}
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"id": "https://raw.githubusercontent.com/linutil-tab-data.json",
4+
"definitions": {
5+
"string-property": {
6+
"type": "string",
7+
"minLength": 1,
8+
"pattern": "[^ ]"
9+
}
10+
},
11+
"title": "tab data",
12+
"description": "Tab data",
13+
"type": "object",
14+
"required": ["name", "data"],
15+
"properties": {
16+
"name": {
17+
"$ref": "#/definitions/string-property",
18+
"title": "name",
19+
"description": "The name of a tab"
20+
},
21+
"data": {
22+
"title": "data",
23+
"description": "The data of a tab",
24+
"type": "array",
25+
"minItems": 1,
26+
"uniqueItems": true,
27+
"items": {
28+
"title": "data entry",
29+
"description": "The data entry of a tab",
30+
"type": "object",
31+
"properties": {
32+
"name": {
33+
"$ref": "#/definitions/string-property",
34+
"title": "name",
35+
"description": "The name of a tab entry"
36+
},
37+
"script": {
38+
"$ref": "#/definitions/string-property",
39+
"title": "script",
40+
"description": "The script run of a tab entry"
41+
},
42+
"preconditions": {
43+
"title": "preconditions",
44+
"description": "Preconditions of a tab entry",
45+
"type": "array",
46+
"minItems": 1,
47+
"uniqueItems": true,
48+
"items": {
49+
"title": "precondition entry",
50+
"description": "The precondition entry of a tab entry",
51+
"type": "object",
52+
"properties": {
53+
"matches": {
54+
"title": "matches",
55+
"description": "Whether to require the condition to match or not for a precondition entry",
56+
"type": "boolean"
57+
},
58+
"data": {
59+
"title": "data",
60+
"description": "The data of a tab precondition entry",
61+
"type": "object",
62+
"properties": {
63+
"environment": {
64+
"$ref": "#/definitions/string-property",
65+
"title": "environment",
66+
"description": "The environment variable of a data"
67+
}
68+
},
69+
"additionalProperties": false
70+
},
71+
"values": {
72+
"title": "values",
73+
"description": "The values of a tab precondition entry",
74+
"type": "array",
75+
"minItems": 1,
76+
"uniqueItems": true,
77+
"items": {
78+
"title": "entry",
79+
"description": "The entry of values",
80+
"type": "string"
81+
}
82+
}
83+
},
84+
"additionalProperties": false
85+
}
86+
},
87+
"entries": {
88+
"title": "entries",
89+
"description": "The entries of a tab entry",
90+
"type": "array",
91+
"minItems": 1,
92+
"uniqueItems": true,
93+
"items": {
94+
"title": "entry",
95+
"description": "The entry",
96+
"type": "object",
97+
"properties": {
98+
"name": {
99+
"$ref": "#/definitions/string-property",
100+
"title": "name",
101+
"description": "The name of a tab entry"
102+
},
103+
"script": {
104+
"$ref": "#/definitions/string-property",
105+
"title": "script",
106+
"description": "The script run of a tab entry"
107+
},
108+
"matches": {
109+
"title": "matches",
110+
"description": "Whether to require the condition to match or not for an entry",
111+
"type": "boolean"
112+
}
113+
},
114+
"additionalProperties": false
115+
}
116+
}
117+
},
118+
"additionalProperties": false
119+
}
120+
}
121+
},
122+
"additionalProperties": false
123+
}

src/schemas/json/linutil-tabs.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"id": "https://raw.githubusercontent.com/linutil-tabs.json",
4+
"title": "tab data",
5+
"description": "Tab data",
6+
"type": "object",
7+
"required": ["directories"],
8+
"properties": {
9+
"directories": {
10+
"title": "directories",
11+
"description": "The directories of tabs",
12+
"type": "array",
13+
"minItems": 1,
14+
"uniqueItems": true,
15+
"items": {
16+
"title": "directory entry",
17+
"description": "The directory entry of a tab",
18+
"type": "string",
19+
"minLength": 1,
20+
"pattern": "[^ ]"
21+
}
22+
}
23+
},
24+
"additionalProperties": false
25+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"data": [
3+
{
4+
"name": "WiFi Manager",
5+
"script": "wifi-control.sh"
6+
},
7+
{
8+
"entries": [
9+
{
10+
"name": "Duplicate Displays",
11+
"script": "monitor-control/duplicate_displays.sh"
12+
},
13+
{
14+
"name": "Extend Displays",
15+
"script": "monitor-control/extend_displays.sh"
16+
},
17+
{
18+
"name": "Auto Detect Displays",
19+
"script": "monitor-control/auto_detect_displays.sh"
20+
},
21+
{
22+
"name": "Enable Monitor",
23+
"script": "monitor-control/enable_monitor.sh"
24+
},
25+
{
26+
"name": "Disable Monitor",
27+
"script": "monitor-control/disable_monitor.sh"
28+
},
29+
{
30+
"name": "Set Primary Monitor",
31+
"script": "monitor-control/set_primary_monitor.sh"
32+
},
33+
{
34+
"name": "Change Orientation",
35+
"script": "monitor-control/change_orientation.sh"
36+
},
37+
{
38+
"name": "Manage Arrangement",
39+
"script": "monitor-control/manage_arrangement.sh"
40+
},
41+
{
42+
"name": "Scale Monitors",
43+
"script": "monitor-control/scale_monitor.sh"
44+
},
45+
{
46+
"matches": true,
47+
"name": "Reset Scaling",
48+
"script": "monitor-control/reset_scaling.sh"
49+
}
50+
],
51+
"name": "Monitor Control",
52+
"preconditions": [
53+
{
54+
"data": {
55+
"environment": "XDG_SESSION_TYPE"
56+
},
57+
"matches": true,
58+
"values": ["x11", "X11", "xorg", "Xorg", "tty"]
59+
},
60+
{
61+
"data": {
62+
"environment": "DISPLAY"
63+
},
64+
"matches": true,
65+
"values": [":0", ":1", ":2", ":3", ":4", ":5", ":6", ":7", ":8", ":9"]
66+
}
67+
]
68+
}
69+
],
70+
"name": "Utilities"
71+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"directories": [
3+
"applications-setup",
4+
"gaming",
5+
"security",
6+
"system-setup",
7+
"utils"
8+
]
9+
}

0 commit comments

Comments
 (0)