Skip to content

Commit

Permalink
feat(wm): switch to asc v2 json format
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
LGUG2Z committed Nov 2, 2024
1 parent 0f385d6 commit 374cd2c
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 42 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
CHANGELOG.md
dummy.go
komorebic/applications.yaml
komorebic/applications.json
/.vs
5 changes: 2 additions & 3 deletions docs/cli/animation-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/application-specific-configuration-schema.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/fetch-app-specific-configuration.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 0 additions & 16 deletions docs/cli/format-app-specific-configuration.md

This file was deleted.

3 changes: 1 addition & 2 deletions docs/cli/toggle-workspace-float-override.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions docs/cli/toggle-workspace-window-container-behaviour.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
2 changes: 1 addition & 1 deletion docs/komorebi.example.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
3 changes: 2 additions & 1 deletion komorebi/src/static_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions komorebic/build.rs
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
14 changes: 8 additions & 6 deletions komorebic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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("\\", "/")
Expand Down
3 changes: 1 addition & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,11 @@ 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
- cli/socket-schema.md
- cli/static-config-schema.md
- cli/generate-static-config.md
- cli/enable-autostart.md
- cli/disable-autostart.md
- cli/disable-autostart.md
2 changes: 1 addition & 1 deletion schema.bar.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 374cd2c

Please sign in to comment.