feat(borders): add windows accent implementation

This commit adds the ability for users to select between komorebi's
implementation of borders with variable widths and the native Windows 11
implementation of thin "accent" borders.

The new border_implementation configuration option defaults to
BorderImplementation::Komorebi in order to preserve compat with existing
user configurations.

This option will be most useful for people who prefer ultra-thin
borders, and people who want borders to be animated along with
application windows if they are using the animation feature being worked
on in PR #685.
This commit is contained in:
LGUG2Z
2024-06-20 20:13:22 -07:00
parent 9a65a4ae92
commit 9e37baa88a
9 changed files with 407 additions and 218 deletions
+25
View File
@@ -684,6 +684,19 @@ struct BorderOffset {
/// Desired offset of the window border
offset: i32,
}
#[derive(Parser)]
struct BorderStyle {
/// Desired border style
#[clap(value_enum)]
style: komorebi_core::BorderStyle,
}
#[derive(Parser)]
struct BorderImplementation {
/// Desired border implementation
#[clap(value_enum)]
style: komorebi_core::BorderImplementation,
}
#[derive(Parser)]
#[allow(clippy::struct_excessive_bools)]
@@ -1176,6 +1189,12 @@ enum SubCommand {
#[clap(arg_required_else_help = true)]
#[clap(alias = "active-window-border-offset")]
BorderOffset(BorderOffset),
/// Set the border style
#[clap(arg_required_else_help = true)]
BorderStyle(BorderStyle),
/// Set the border implementation
#[clap(arg_required_else_help = true)]
BorderImplementation(BorderImplementation),
/// Enable or disable transparency for unfocused windows
#[clap(arg_required_else_help = true)]
Transparency(Transparency),
@@ -2269,6 +2288,12 @@ Stop-Process -Name:komorebi -ErrorAction SilentlyContinue
SubCommand::BorderOffset(arg) => {
send_message(&SocketMessage::BorderOffset(arg.offset).as_bytes()?)?;
}
SubCommand::BorderStyle(arg) => {
send_message(&SocketMessage::BorderStyle(arg.style).as_bytes()?)?;
}
SubCommand::BorderImplementation(arg) => {
send_message(&SocketMessage::BorderImplementation(arg.style).as_bytes()?)?;
}
SubCommand::Transparency(arg) => {
send_message(&SocketMessage::Transparency(arg.boolean_state.into()).as_bytes()?)?;
}