feat(wm): switch to asc v2 json format

This commit switches all relevant commands to treat the v2
applications.json asc format as the default format in all commands.

The v1 applications.yaml file will still be processed correctly if
passed.
This commit is contained in:
LGUG2Z
2024-11-01 19:21:57 -07:00
parent 0f385d6245
commit 374cd2c6d5
15 changed files with 26 additions and 42 deletions

1
.gitignore vendored
View File

@@ -4,4 +4,5 @@
CHANGELOG.md
dummy.go
komorebic/applications.yaml
komorebic/applications.json
/.vs

View File

@@ -10,9 +10,8 @@ Options:
Desired ease function for animation
[default: linear]
[possible values: linear, ease-in-sine, ease-out-sine, ease-in-out-sine, ease-in-quad, ease-out-quad, ease-in-out-quad, ease-in-cubic, ease-in-out-cubic, ease-in-quart,
ease-out-quart, ease-in-out-quart, ease-in-quint, ease-out-quint, ease-in-out-quint, ease-in-expo, ease-out-expo, ease-in-out-expo, ease-in-circ, ease-out-circ, ease-in-out-circ,
ease-in-back, ease-out-back, ease-in-out-back, ease-in-elastic, ease-out-elastic, ease-in-out-elastic, ease-in-bounce, ease-out-bounce, ease-in-out-bounce]
[possible values: linear, ease-in-sine, ease-out-sine, ease-in-out-sine, ease-in-quad, ease-out-quad, ease-in-out-quad, ease-in-cubic, ease-in-out-cubic, ease-in-quart, ease-out-quart, ease-in-out-quart, ease-in-quint, ease-out-quint, ease-in-out-quint, ease-in-expo, ease-out-expo,
ease-in-out-expo, ease-in-circ, ease-out-circ, ease-in-out-circ, ease-in-back, ease-out-back, ease-in-out-back, ease-in-elastic, ease-out-elastic, ease-in-out-elastic, ease-in-bounce, ease-out-bounce, ease-in-out-bounce]
-h, --help
Print help

View File

@@ -1,7 +1,7 @@
# application-specific-configuration-schema
```
Generate a JSON Schema for applications.yaml
Generate a JSON Schema for applications.json
Usage: komorebic.exe application-specific-configuration-schema

View File

@@ -1,7 +1,7 @@
# fetch-app-specific-configuration
```
Fetch the latest version of applications.yaml from komorebi-application-specific-configuration
Fetch the latest version of applications.json from komorebi-application-specific-configuration
Usage: komorebic.exe fetch-app-specific-configuration

View File

@@ -1,16 +0,0 @@
# format-app-specific-configuration
```
Format a YAML file for use with the 'app-specific-configuration' command
Usage: komorebic.exe format-app-specific-configuration <PATH>
Arguments:
<PATH>
YAML file from which the application-specific configurations should be loaded
Options:
-h, --help
Print help
```

View File

@@ -1,8 +1,7 @@
# toggle-workspace-float-override
```
Enable or disable float override, which makes it so every new window opens in floating mode, for the currently focused workspace. If there was no override value set for the workspace
previously it takes the opposite of the global value
Enable or disable float override, which makes it so every new window opens in floating mode, for the currently focused workspace. If there was no override value set for the workspace previously it takes the opposite of the global value
Usage: komorebic.exe toggle-workspace-float-override

View File

@@ -1,8 +1,7 @@
# toggle-workspace-window-container-behaviour
```
Toggle the behaviour for new windows (stacking or dynamic tiling) for currently focused workspace. If there was no behaviour set for the workspace previously it takes the opposite of the
global value
Toggle the behaviour for new windows (stacking or dynamic tiling) for currently focused workspace. If there was no behaviour set for the workspace previously it takes the opposite of the global value
Usage: komorebic.exe toggle-workspace-window-container-behaviour

View File

@@ -147,7 +147,7 @@ files created by the `quickstart` command and any other runtime files:
```powershell
rm $Env:USERPROFILE\komorebi.json
rm $Env:USERPROFILE\applications.yaml
rm $Env:USERPROFILE\applications.json
rm $Env:USERPROFILE\.config\whkdrc
rm -r -Force $Env:LOCALAPPDATA\komorebi
```

View File

@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/v0.1.29/schema.json",
"app_specific_configuration_path": "$Env:USERPROFILE/applications.yaml",
"app_specific_configuration_path": "$Env:USERPROFILE/applications.json",
"window_hiding_behaviour": "Cloak",
"cross_monitor_move_behaviour": "Insert",
"default_workspace_padding": 20,

View File

@@ -269,7 +269,7 @@ pub struct StaticConfig {
/// Enable or disable mouse follows focus (default: true)
#[serde(skip_serializing_if = "Option::is_none")]
pub mouse_follows_focus: Option<bool>,
/// Path to applications.yaml from komorebi-application-specific-configurations (default: None)
/// Path to applications.json from komorebi-application-specific-configurations (default: None)
#[serde(skip_serializing_if = "Option::is_none")]
pub app_specific_configuration_path: Option<PathBuf>,
/// Width of the window border (default: 8)
@@ -465,6 +465,7 @@ impl StaticConfig {
map.insert("border_offset", ["active_window_border_offset"]);
map.insert("border_colours", ["active_window_border_colours"]);
map.insert("border_style", ["active_window_border_style"]);
map.insert("applications.json", ["applications.yaml"]);
let mut display = false;

View File

@@ -1,9 +1,9 @@
fn main() {
if std::fs::metadata("applications.yaml").is_err() {
let applications_yaml = reqwest::blocking::get(
"https://raw.githubusercontent.com/LGUG2Z/komorebi-application-specific-configuration/master/applications.yaml"
if std::fs::metadata("applications.json").is_err() {
let applications_json = reqwest::blocking::get(
"https://raw.githubusercontent.com/LGUG2Z/komorebi-application-specific-configuration/master/applications.json"
).unwrap().text().unwrap();
std::fs::write("applications.yaml", applications_yaml).unwrap();
std::fs::write("applications.json", applications_json).unwrap();
}
shadow_rs::new().unwrap();

View File

@@ -1349,11 +1349,12 @@ enum SubCommand {
/// Format a YAML file for use with the 'app-specific-configuration' command
#[clap(arg_required_else_help = true)]
#[clap(alias = "fmt-asc")]
#[clap(hide = true)]
FormatAppSpecificConfiguration(FormatAppSpecificConfiguration),
/// Fetch the latest version of applications.yaml from komorebi-application-specific-configuration
/// Fetch the latest version of applications.json from komorebi-application-specific-configuration
#[clap(alias = "fetch-asc")]
FetchAppSpecificConfiguration,
/// Generate a JSON Schema for applications.yaml
/// Generate a JSON Schema for applications.json
#[clap(alias = "asc-schema")]
ApplicationSpecificConfigurationSchema,
/// Generate a JSON Schema of subscription notifications
@@ -1418,6 +1419,7 @@ fn main() -> Result<()> {
"named-workspace-custom-layout-rule",
"focus-follows-mouse",
"toggle-focus-follows-mouse",
"format-app-specific-configuration",
];
for cmd in subcommands {
@@ -1450,13 +1452,13 @@ fn main() -> Result<()> {
std::fs::write(HOME_DIR.join("komorebi.json"), komorebi_json)?;
std::fs::write(HOME_DIR.join("komorebi.bar.json"), komorebi_bar_json)?;
let applications_yaml = include_str!("../applications.yaml");
std::fs::write(HOME_DIR.join("applications.yaml"), applications_yaml)?;
let applications_json = include_str!("../applications.json");
std::fs::write(HOME_DIR.join("applications.json"), applications_json)?;
let whkdrc = include_str!("../../docs/whkdrc.sample");
std::fs::write(WHKD_CONFIG_DIR.join("whkdrc"), whkdrc)?;
println!("Example komorebi.json, komorebi.bar.json, whkdrc and latest applications.yaml files created");
println!("Example komorebi.json, komorebi.bar.json, whkdrc and latest applications.json files created");
println!("You can now run komorebic start --whkd --bar");
}
SubCommand::EnableAutostart(args) => {
@@ -2661,7 +2663,7 @@ Stop-Process -Name:komorebi -ErrorAction SilentlyContinue
file.write_all(content.as_bytes())?;
println!("Latest version of applications.yaml from https://github.com/LGUG2Z/komorebi-application-specific-configuration downloaded\n");
println!("Latest version of applications.json from https://github.com/LGUG2Z/komorebi-application-specific-configuration downloaded\n");
println!(
"You can add this to your komorebi.json static configuration file like this: \n\n\"app_specific_configuration_path\": \"{}\"",
output_file.display().to_string().replace("\\", "/")

View File

@@ -219,7 +219,6 @@ nav:
- cli/ahk-app-specific-configuration.md
- cli/pwsh-app-specific-configuration.md
- cli/convert-app-specific-configuration.md
- cli/format-app-specific-configuration.md
- cli/fetch-app-specific-configuration.md
- cli/application-specific-configuration-schema.md
- cli/notification-schema.md
@@ -227,4 +226,4 @@ nav:
- cli/static-config-schema.md
- cli/generate-static-config.md
- cli/enable-autostart.md
- cli/disable-autostart.md
- cli/disable-autostart.md

View File

@@ -19,7 +19,7 @@
"format": "float"
},
"frame": {
"description": "Frame options (see: https://docs.rs/egui/latest/egui/containers/struct.Frame.html)",
"description": "Frame options (see: https://docs.rs/egui/latest/egui/containers/frame/struct.Frame.html)",
"type": "object",
"required": [
"inner_margin"

View File

@@ -66,7 +66,7 @@
}
},
"app_specific_configuration_path": {
"description": "Path to applications.yaml from komorebi-application-specific-configurations (default: None)",
"description": "Path to applications.json from komorebi-application-specific-configurations (default: None)",
"type": "string"
},
"bar_configurations": {