-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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>
- Loading branch information
1 parent
3bce93d
commit 3eadf78
Showing
7 changed files
with
269 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/negative_test/linutil-tab-data/invalid-properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"name": "", | ||
"script": "" | ||
}, | ||
{ | ||
"entries": [ | ||
{ | ||
"name": "", | ||
"script": "" | ||
} | ||
], | ||
"name": "", | ||
"preconditions": [ | ||
{ | ||
"data": { | ||
"environment": "" | ||
}, | ||
"values": [""] | ||
} | ||
] | ||
} | ||
], | ||
"name": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directories": [""] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"id": "https://raw.githubusercontent.com/linutil-tab-data.json", | ||
"definitions": { | ||
"string-property": { | ||
"type": "string", | ||
"minLength": 1, | ||
"pattern": "[^ ]" | ||
} | ||
}, | ||
"title": "tab data", | ||
"description": "Tab data", | ||
"type": "object", | ||
"required": ["name", "data"], | ||
"properties": { | ||
"name": { | ||
"$ref": "#/definitions/string-property", | ||
"title": "name", | ||
"description": "The name of a tab" | ||
}, | ||
"data": { | ||
"title": "data", | ||
"description": "The data of a tab", | ||
"type": "array", | ||
"minItems": 1, | ||
"uniqueItems": true, | ||
"items": { | ||
"title": "data entry", | ||
"description": "The data entry of a tab", | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"$ref": "#/definitions/string-property", | ||
"title": "name", | ||
"description": "The name of a tab entry" | ||
}, | ||
"script": { | ||
"$ref": "#/definitions/string-property", | ||
"title": "script", | ||
"description": "The script run of a tab entry" | ||
}, | ||
"preconditions": { | ||
"title": "preconditions", | ||
"description": "Preconditions of a tab entry", | ||
"type": "array", | ||
"minItems": 1, | ||
"uniqueItems": true, | ||
"items": { | ||
"title": "precondition entry", | ||
"description": "The precondition entry of a tab entry", | ||
"type": "object", | ||
"properties": { | ||
"matches": { | ||
"title": "matches", | ||
"description": "Whether to require the condition to match or not for a precondition entry", | ||
"type": "boolean" | ||
}, | ||
"data": { | ||
"title": "data", | ||
"description": "The data of a tab precondition entry", | ||
"type": "object", | ||
"properties": { | ||
"environment": { | ||
"$ref": "#/definitions/string-property", | ||
"title": "environment", | ||
"description": "The environment variable of a data" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"values": { | ||
"title": "values", | ||
"description": "The values of a tab precondition entry", | ||
"type": "array", | ||
"minItems": 1, | ||
"uniqueItems": true, | ||
"items": { | ||
"title": "entry", | ||
"description": "The entry of values", | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
}, | ||
"entries": { | ||
"title": "entries", | ||
"description": "The entries of a tab entry", | ||
"type": "array", | ||
"minItems": 1, | ||
"uniqueItems": true, | ||
"items": { | ||
"title": "entry", | ||
"description": "The entry", | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"$ref": "#/definitions/string-property", | ||
"title": "name", | ||
"description": "The name of a tab entry" | ||
}, | ||
"script": { | ||
"$ref": "#/definitions/string-property", | ||
"title": "script", | ||
"description": "The script run of a tab entry" | ||
}, | ||
"matches": { | ||
"title": "matches", | ||
"description": "Whether to require the condition to match or not for an entry", | ||
"type": "boolean" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"id": "https://raw.githubusercontent.com/linutil-tabs.json", | ||
"title": "tab data", | ||
"description": "Tab data", | ||
"type": "object", | ||
"required": ["directories"], | ||
"properties": { | ||
"directories": { | ||
"title": "directories", | ||
"description": "The directories of tabs", | ||
"type": "array", | ||
"minItems": 1, | ||
"uniqueItems": true, | ||
"items": { | ||
"title": "directory entry", | ||
"description": "The directory entry of a tab", | ||
"type": "string", | ||
"minLength": 1, | ||
"pattern": "[^ ]" | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"name": "WiFi Manager", | ||
"script": "wifi-control.sh" | ||
}, | ||
{ | ||
"entries": [ | ||
{ | ||
"name": "Duplicate Displays", | ||
"script": "monitor-control/duplicate_displays.sh" | ||
}, | ||
{ | ||
"name": "Extend Displays", | ||
"script": "monitor-control/extend_displays.sh" | ||
}, | ||
{ | ||
"name": "Auto Detect Displays", | ||
"script": "monitor-control/auto_detect_displays.sh" | ||
}, | ||
{ | ||
"name": "Enable Monitor", | ||
"script": "monitor-control/enable_monitor.sh" | ||
}, | ||
{ | ||
"name": "Disable Monitor", | ||
"script": "monitor-control/disable_monitor.sh" | ||
}, | ||
{ | ||
"name": "Set Primary Monitor", | ||
"script": "monitor-control/set_primary_monitor.sh" | ||
}, | ||
{ | ||
"name": "Change Orientation", | ||
"script": "monitor-control/change_orientation.sh" | ||
}, | ||
{ | ||
"name": "Manage Arrangement", | ||
"script": "monitor-control/manage_arrangement.sh" | ||
}, | ||
{ | ||
"name": "Scale Monitors", | ||
"script": "monitor-control/scale_monitor.sh" | ||
}, | ||
{ | ||
"matches": true, | ||
"name": "Reset Scaling", | ||
"script": "monitor-control/reset_scaling.sh" | ||
} | ||
], | ||
"name": "Monitor Control", | ||
"preconditions": [ | ||
{ | ||
"data": { | ||
"environment": "XDG_SESSION_TYPE" | ||
}, | ||
"matches": true, | ||
"values": ["x11", "X11", "xorg", "Xorg", "tty"] | ||
}, | ||
{ | ||
"data": { | ||
"environment": "DISPLAY" | ||
}, | ||
"matches": true, | ||
"values": [":0", ":1", ":2", ":3", ":4", ":5", ":6", ":7", ":8", ":9"] | ||
} | ||
] | ||
} | ||
], | ||
"name": "Utilities" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"directories": [ | ||
"applications-setup", | ||
"gaming", | ||
"security", | ||
"system-setup", | ||
"utils" | ||
] | ||
} |