From 374cd2c6d5f38e38daaca0469002e4ca5c6c1f26 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 1 Nov 2024 19:21:57 -0700 Subject: [PATCH] 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. --- .gitignore | 1 + docs/cli/animation-style.md | 5 ++--- .../application-specific-configuration-schema.md | 2 +- docs/cli/fetch-app-specific-configuration.md | 2 +- docs/cli/format-app-specific-configuration.md | 16 ---------------- docs/cli/toggle-workspace-float-override.md | 3 +-- ...oggle-workspace-window-container-behaviour.md | 3 +-- docs/installation.md | 2 +- docs/komorebi.example.json | 2 +- komorebi/src/static_config.rs | 3 ++- komorebic/build.rs | 8 ++++---- komorebic/src/main.rs | 14 ++++++++------ mkdocs.yml | 3 +-- schema.bar.json | 2 +- schema.json | 2 +- 15 files changed, 26 insertions(+), 42 deletions(-) delete mode 100644 docs/cli/format-app-specific-configuration.md diff --git a/.gitignore b/.gitignore index a1b648d2e..31f65c57a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ CHANGELOG.md dummy.go komorebic/applications.yaml +komorebic/applications.json /.vs diff --git a/docs/cli/animation-style.md b/docs/cli/animation-style.md index d2f2ee03c..7af5072f8 100644 --- a/docs/cli/animation-style.md +++ b/docs/cli/animation-style.md @@ -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 diff --git a/docs/cli/application-specific-configuration-schema.md b/docs/cli/application-specific-configuration-schema.md index 776b5a4d1..aef62cade 100644 --- a/docs/cli/application-specific-configuration-schema.md +++ b/docs/cli/application-specific-configuration-schema.md @@ -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 diff --git a/docs/cli/fetch-app-specific-configuration.md b/docs/cli/fetch-app-specific-configuration.md index 9f607094c..7ed04c00d 100644 --- a/docs/cli/fetch-app-specific-configuration.md +++ b/docs/cli/fetch-app-specific-configuration.md @@ -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 diff --git a/docs/cli/format-app-specific-configuration.md b/docs/cli/format-app-specific-configuration.md deleted file mode 100644 index 3fbd613e0..000000000 --- a/docs/cli/format-app-specific-configuration.md +++ /dev/null @@ -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 - -Arguments: - - YAML file from which the application-specific configurations should be loaded - -Options: - -h, --help - Print help - -``` diff --git a/docs/cli/toggle-workspace-float-override.md b/docs/cli/toggle-workspace-float-override.md index ba0641bef..ea01e733b 100644 --- a/docs/cli/toggle-workspace-float-override.md +++ b/docs/cli/toggle-workspace-float-override.md @@ -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 diff --git a/docs/cli/toggle-workspace-window-container-behaviour.md b/docs/cli/toggle-workspace-window-container-behaviour.md index f97258409..6653584e3 100644 --- a/docs/cli/toggle-workspace-window-container-behaviour.md +++ b/docs/cli/toggle-workspace-window-container-behaviour.md @@ -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 diff --git a/docs/installation.md b/docs/installation.md index c97fa86b6..db741fb28 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -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 ``` diff --git a/docs/komorebi.example.json b/docs/komorebi.example.json index ba538a032..beb64eff1 100644 --- a/docs/komorebi.example.json +++ b/docs/komorebi.example.json @@ -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, diff --git a/komorebi/src/static_config.rs b/komorebi/src/static_config.rs index 59317b901..0f53bb7b4 100644 --- a/komorebi/src/static_config.rs +++ b/komorebi/src/static_config.rs @@ -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, - /// 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, /// 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; diff --git a/komorebic/build.rs b/komorebic/build.rs index 23cb68203..a3a21440b 100644 --- a/komorebic/build.rs +++ b/komorebic/build.rs @@ -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(); diff --git a/komorebic/src/main.rs b/komorebic/src/main.rs index c65515962..a95833b05 100644 --- a/komorebic/src/main.rs +++ b/komorebic/src/main.rs @@ -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("\\", "/") diff --git a/mkdocs.yml b/mkdocs.yml index 63027ad8d..ec37ae440 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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 \ No newline at end of file + - cli/disable-autostart.md diff --git a/schema.bar.json b/schema.bar.json index 8e3973276..8dd5b4281 100644 --- a/schema.bar.json +++ b/schema.bar.json @@ -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" diff --git a/schema.json b/schema.json index 4227f6858..f5ce51f38 100644 --- a/schema.json +++ b/schema.json @@ -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": {