mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-10 23:22:43 +02:00
refactor(ahk): remove derive-ahk and references
This commit finally sunsets the derive-ahk proc macro and the ahk-library cli command. There is now a dedicated, stripped down komorebi.ahk example on the docs website which mirrors the contents and style of the sample whkdrc: https://lgug2z.github.io/komorebi/common-workflows/autohotkey.html
This commit is contained in:
Generated
-11
@@ -1116,15 +1116,6 @@ dependencies = [
|
|||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "derive-ahk"
|
|
||||||
version = "0.1.1"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 1.0.109",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "digest"
|
name = "digest"
|
||||||
version = "0.10.7"
|
version = "0.10.7"
|
||||||
@@ -2400,11 +2391,9 @@ dependencies = [
|
|||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
"derive-ahk",
|
|
||||||
"dirs",
|
"dirs",
|
||||||
"dunce",
|
"dunce",
|
||||||
"fs-tail",
|
"fs-tail",
|
||||||
"heck 0.5.0",
|
|
||||||
"komorebi-client",
|
"komorebi-client",
|
||||||
"komorebi-core",
|
"komorebi-core",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
members = [
|
members = [
|
||||||
"derive-ahk",
|
|
||||||
"komorebi",
|
"komorebi",
|
||||||
"komorebi-client",
|
"komorebi-client",
|
||||||
"komorebi-core",
|
"komorebi-core",
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "derive-ahk"
|
|
||||||
version = "0.1.1"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
proc-macro = true
|
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
proc-macro2 = "1.0"
|
|
||||||
syn = "1.0"
|
|
||||||
quote = "1.0"
|
|
||||||
@@ -1,225 +0,0 @@
|
|||||||
#![warn(clippy::all, clippy::nursery, clippy::pedantic)]
|
|
||||||
#![allow(clippy::missing_errors_doc)]
|
|
||||||
#![no_implicit_prelude]
|
|
||||||
|
|
||||||
use ::std::clone::Clone;
|
|
||||||
use ::std::convert::From;
|
|
||||||
use ::std::convert::Into;
|
|
||||||
use ::std::format;
|
|
||||||
use ::std::iter::Extend;
|
|
||||||
use ::std::iter::Iterator;
|
|
||||||
use ::std::matches;
|
|
||||||
use ::std::option::Option::Some;
|
|
||||||
use ::std::string::String;
|
|
||||||
use ::std::string::ToString;
|
|
||||||
use ::std::unreachable;
|
|
||||||
use ::std::vec::Vec;
|
|
||||||
|
|
||||||
use ::quote::quote;
|
|
||||||
use ::syn::parse_macro_input;
|
|
||||||
use ::syn::Data;
|
|
||||||
use ::syn::DataEnum;
|
|
||||||
use ::syn::DeriveInput;
|
|
||||||
use ::syn::Fields;
|
|
||||||
use ::syn::FieldsNamed;
|
|
||||||
use ::syn::FieldsUnnamed;
|
|
||||||
use ::syn::Meta;
|
|
||||||
use ::syn::NestedMeta;
|
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
|
||||||
#[proc_macro_derive(AhkFunction)]
|
|
||||||
pub fn ahk_function(input: ::proc_macro::TokenStream) -> ::proc_macro::TokenStream {
|
|
||||||
let input = parse_macro_input!(input as DeriveInput);
|
|
||||||
let name = input.ident;
|
|
||||||
|
|
||||||
match input.data {
|
|
||||||
Data::Struct(s) => match s.fields {
|
|
||||||
Fields::Named(FieldsNamed { named, .. }) => {
|
|
||||||
let argument_idents = named
|
|
||||||
.iter()
|
|
||||||
// Filter out the flags
|
|
||||||
.filter(|&f| {
|
|
||||||
let mut include = true;
|
|
||||||
for attribute in &f.attrs {
|
|
||||||
if let ::std::result::Result::Ok(Meta::List(list)) =
|
|
||||||
attribute.parse_meta()
|
|
||||||
{
|
|
||||||
for nested in list.nested {
|
|
||||||
if let NestedMeta::Meta(Meta::Path(path)) = nested {
|
|
||||||
if path.is_ident("long") {
|
|
||||||
include = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
include
|
|
||||||
})
|
|
||||||
.map(|f| &f.ident);
|
|
||||||
|
|
||||||
let argument_idents_clone = argument_idents.clone();
|
|
||||||
|
|
||||||
let called_arguments = quote! {#(%#argument_idents_clone%) *}
|
|
||||||
.to_string()
|
|
||||||
.replace(" %", "%")
|
|
||||||
.replace("% ", "%")
|
|
||||||
.replace("%%", "% %");
|
|
||||||
|
|
||||||
let flag_idents = named
|
|
||||||
.iter()
|
|
||||||
// Filter only the flags
|
|
||||||
.filter(|f| {
|
|
||||||
let mut include = false;
|
|
||||||
|
|
||||||
for attribute in &f.attrs {
|
|
||||||
if let ::std::result::Result::Ok(Meta::List(list)) =
|
|
||||||
attribute.parse_meta()
|
|
||||||
{
|
|
||||||
for nested in list.nested {
|
|
||||||
if let NestedMeta::Meta(Meta::Path(path)) = nested {
|
|
||||||
// Identify them using the --long flag name
|
|
||||||
if path.is_ident("long") {
|
|
||||||
include = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
include
|
|
||||||
})
|
|
||||||
.map(|f| &f.ident);
|
|
||||||
|
|
||||||
let has_flags = flag_idents.clone().count() != 0;
|
|
||||||
|
|
||||||
if has_flags {
|
|
||||||
let flag_idents_concat = flag_idents.clone();
|
|
||||||
let argument_idents_concat = argument_idents.clone();
|
|
||||||
|
|
||||||
// Concat the args and flag args if there are flags
|
|
||||||
let all_arguments =
|
|
||||||
quote! {#(#argument_idents_concat,) * #(#flag_idents_concat), *}
|
|
||||||
.to_string();
|
|
||||||
|
|
||||||
let flag_idents_clone = flag_idents.clone();
|
|
||||||
let flags = quote! {#(--#flag_idents_clone) *}
|
|
||||||
.to_string()
|
|
||||||
.replace("- - ", "--")
|
|
||||||
.replace('_', "-");
|
|
||||||
|
|
||||||
let called_flag_arguments = quote! {#(%#flag_idents%) *}
|
|
||||||
.to_string()
|
|
||||||
.replace(" %", "%")
|
|
||||||
.replace("% ", "%")
|
|
||||||
.replace("%%", "% %");
|
|
||||||
|
|
||||||
let flags_split: Vec<_> = flags.split(' ').collect();
|
|
||||||
let flag_args_split: Vec<_> = called_flag_arguments.split(' ').collect();
|
|
||||||
let mut consolidated_flags: Vec<String> = Vec::new();
|
|
||||||
|
|
||||||
for (idx, flag) in flags_split.iter().enumerate() {
|
|
||||||
consolidated_flags.push(format!("{} {}", flag, flag_args_split[idx]));
|
|
||||||
}
|
|
||||||
|
|
||||||
let all_flags = consolidated_flags.join(" ");
|
|
||||||
|
|
||||||
quote! {
|
|
||||||
impl AhkFunction for #name {
|
|
||||||
fn generate_ahk_function() -> String {
|
|
||||||
::std::format!(r#"
|
|
||||||
{}({}) {{
|
|
||||||
RunWait, komorebic.exe {} {} {}, , Hide
|
|
||||||
}}"#,
|
|
||||||
::std::stringify!(#name),
|
|
||||||
#all_arguments,
|
|
||||||
::std::stringify!(#name).to_kebab_case(),
|
|
||||||
#called_arguments,
|
|
||||||
#all_flags,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let arguments = quote! {#(#argument_idents), *}.to_string();
|
|
||||||
|
|
||||||
quote! {
|
|
||||||
impl AhkFunction for #name {
|
|
||||||
fn generate_ahk_function() -> String {
|
|
||||||
::std::format!(r#"
|
|
||||||
{}({}) {{
|
|
||||||
RunWait, komorebic.exe {} {}, , Hide
|
|
||||||
}}"#,
|
|
||||||
::std::stringify!(#name),
|
|
||||||
#arguments,
|
|
||||||
::std::stringify!(#name).to_kebab_case(),
|
|
||||||
#called_arguments
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => unreachable!("only to be used on structs with named fields"),
|
|
||||||
},
|
|
||||||
_ => unreachable!("only to be used on structs"),
|
|
||||||
}
|
|
||||||
.into()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[proc_macro_derive(AhkLibrary)]
|
|
||||||
pub fn ahk_library(input: ::proc_macro::TokenStream) -> ::proc_macro::TokenStream {
|
|
||||||
let input = parse_macro_input!(input as DeriveInput);
|
|
||||||
let name = input.ident;
|
|
||||||
|
|
||||||
match input.data {
|
|
||||||
Data::Enum(DataEnum { variants, .. }) => {
|
|
||||||
let enums = variants.iter().filter(|&v| {
|
|
||||||
matches!(v.fields, Fields::Unit) || matches!(v.fields, Fields::Unnamed(..))
|
|
||||||
});
|
|
||||||
|
|
||||||
let mut stream = ::proc_macro2::TokenStream::new();
|
|
||||||
|
|
||||||
for variant in enums.clone() {
|
|
||||||
match &variant.fields {
|
|
||||||
Fields::Unnamed(FieldsUnnamed { unnamed, .. }) => {
|
|
||||||
for field in unnamed {
|
|
||||||
stream.extend(quote! {
|
|
||||||
v.push(#field::generate_ahk_function());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Fields::Unit => {
|
|
||||||
let name = &variant.ident;
|
|
||||||
stream.extend(quote! {
|
|
||||||
v.push(::std::format!(r#"
|
|
||||||
{}() {{
|
|
||||||
RunWait, komorebic.exe {}, , Hide
|
|
||||||
}}"#,
|
|
||||||
::std::stringify!(#name),
|
|
||||||
::std::stringify!(#name).to_kebab_case()
|
|
||||||
));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Fields::Named(_) => {
|
|
||||||
unreachable!("only to be used with unnamed and unit fields");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
quote! {
|
|
||||||
impl #name {
|
|
||||||
fn generate_ahk_library() -> String {
|
|
||||||
let mut v: Vec<String> = vec![String::from("; Generated by komorebic.exe")];
|
|
||||||
|
|
||||||
#stream
|
|
||||||
|
|
||||||
v.join("\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => unreachable!("only to be used on enums"),
|
|
||||||
}
|
|
||||||
.into()
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#![warn(clippy::all, clippy::nursery, clippy::pedantic)]
|
#![warn(clippy::all)]
|
||||||
#![allow(clippy::missing_errors_doc)]
|
#![allow(clippy::missing_errors_doc)]
|
||||||
|
|
||||||
pub use komorebi::colour::Colour;
|
pub use komorebi::colour::Colour;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#![warn(clippy::all, clippy::nursery, clippy::pedantic)]
|
#![warn(clippy::all)]
|
||||||
#![allow(clippy::missing_errors_doc, clippy::use_self, clippy::doc_markdown)]
|
#![allow(clippy::missing_errors_doc, clippy::use_self, clippy::doc_markdown)]
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#![allow(clippy::assigning_clones)]
|
#![warn(clippy::all)]
|
||||||
|
|
||||||
use eframe::egui;
|
use eframe::egui;
|
||||||
use eframe::egui::color_picker::Alpha;
|
use eframe::egui::color_picker::Alpha;
|
||||||
@@ -715,7 +715,7 @@ impl eframe::App for KomorebiGui {
|
|||||||
.text_edit_singleline(workspace_name)
|
.text_edit_singleline(workspace_name)
|
||||||
.lost_focus()
|
.lost_focus()
|
||||||
{
|
{
|
||||||
workspace.name = workspace_name.clone();
|
workspace.name.clone_from(workspace_name);
|
||||||
komorebi_client::send_message(
|
komorebi_client::send_message(
|
||||||
&SocketMessage::WorkspaceName(
|
&SocketMessage::WorkspaceName(
|
||||||
monitor_idx,
|
monitor_idx,
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#![warn(clippy::all)]
|
||||||
|
|
||||||
pub mod border_manager;
|
pub mod border_manager;
|
||||||
pub mod com;
|
pub mod com;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#![warn(clippy::all, clippy::nursery, clippy::pedantic)]
|
#![warn(clippy::all)]
|
||||||
#![allow(
|
#![allow(
|
||||||
clippy::missing_errors_doc,
|
clippy::missing_errors_doc,
|
||||||
clippy::redundant_pub_crate,
|
clippy::redundant_pub_crate,
|
||||||
|
|||||||
@@ -493,20 +493,16 @@ impl From<&WindowManager> for StaticConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl StaticConfig {
|
impl StaticConfig {
|
||||||
#[allow(
|
#[allow(clippy::cognitive_complexity, clippy::too_many_lines)]
|
||||||
clippy::cognitive_complexity,
|
|
||||||
clippy::too_many_lines,
|
|
||||||
clippy::assigning_clones
|
|
||||||
)]
|
|
||||||
fn apply_globals(&mut self) -> Result<()> {
|
fn apply_globals(&mut self) -> Result<()> {
|
||||||
if let Some(monitor_index_preferences) = &self.monitor_index_preferences {
|
if let Some(monitor_index_preferences) = &self.monitor_index_preferences {
|
||||||
let mut preferences = MONITOR_INDEX_PREFERENCES.lock();
|
let mut preferences = MONITOR_INDEX_PREFERENCES.lock();
|
||||||
*preferences = monitor_index_preferences.clone();
|
preferences.clone_from(monitor_index_preferences);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(display_index_preferences) = &self.display_index_preferences {
|
if let Some(display_index_preferences) = &self.display_index_preferences {
|
||||||
let mut preferences = DISPLAY_INDEX_PREFERENCES.lock();
|
let mut preferences = DISPLAY_INDEX_PREFERENCES.lock();
|
||||||
*preferences = display_index_preferences.clone();
|
preferences.clone_from(display_index_preferences);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(behaviour) = self.window_hiding_behaviour {
|
if let Some(behaviour) = self.window_hiding_behaviour {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
derive-ahk = { path = "../derive-ahk" }
|
|
||||||
komorebi-core = { path = "../komorebi-core" }
|
komorebi-core = { path = "../komorebi-core" }
|
||||||
komorebi-client = { path = "../komorebi-client" }
|
komorebi-client = { path = "../komorebi-client" }
|
||||||
|
|
||||||
@@ -21,7 +20,6 @@ color-eyre = { workspace = true }
|
|||||||
dirs = { workspace = true }
|
dirs = { workspace = true }
|
||||||
dunce = { workspace = true }
|
dunce = { workspace = true }
|
||||||
fs-tail = "0.1"
|
fs-tail = "0.1"
|
||||||
heck = "0.5"
|
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
miette = { version = "7", features = ["fancy"] }
|
miette = { version = "7", features = ["fancy"] }
|
||||||
paste = "1"
|
paste = "1"
|
||||||
|
|||||||
+56
-99
@@ -1,4 +1,4 @@
|
|||||||
#![warn(clippy::all, clippy::nursery, clippy::pedantic)]
|
#![warn(clippy::all)]
|
||||||
#![allow(clippy::missing_errors_doc, clippy::doc_markdown)]
|
#![allow(clippy::missing_errors_doc, clippy::doc_markdown)]
|
||||||
|
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
@@ -24,7 +24,6 @@ use color_eyre::eyre::bail;
|
|||||||
use color_eyre::Result;
|
use color_eyre::Result;
|
||||||
use dirs::data_local_dir;
|
use dirs::data_local_dir;
|
||||||
use fs_tail::TailedFile;
|
use fs_tail::TailedFile;
|
||||||
use heck::ToKebabCase;
|
|
||||||
use komorebi_core::resolve_home_path;
|
use komorebi_core::resolve_home_path;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use miette::NamedSource;
|
use miette::NamedSource;
|
||||||
@@ -39,8 +38,6 @@ use windows::Win32::UI::WindowsAndMessaging::ShowWindow;
|
|||||||
use windows::Win32::UI::WindowsAndMessaging::SHOW_WINDOW_CMD;
|
use windows::Win32::UI::WindowsAndMessaging::SHOW_WINDOW_CMD;
|
||||||
use windows::Win32::UI::WindowsAndMessaging::SW_RESTORE;
|
use windows::Win32::UI::WindowsAndMessaging::SW_RESTORE;
|
||||||
|
|
||||||
use derive_ahk::AhkFunction;
|
|
||||||
use derive_ahk::AhkLibrary;
|
|
||||||
use komorebi_client::StaticConfig;
|
use komorebi_client::StaticConfig;
|
||||||
use komorebi_core::config_generation::ApplicationConfigurationGenerator;
|
use komorebi_core::config_generation::ApplicationConfigurationGenerator;
|
||||||
use komorebi_core::ApplicationIdentifier;
|
use komorebi_core::ApplicationIdentifier;
|
||||||
@@ -102,15 +99,6 @@ lazy_static! {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
trait AhkLibrary {
|
|
||||||
fn generate_ahk_library() -> String;
|
|
||||||
}
|
|
||||||
|
|
||||||
trait AhkFunction {
|
|
||||||
fn generate_ahk_function() -> String;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug, miette::Diagnostic)]
|
#[derive(thiserror::Error, Debug, miette::Diagnostic)]
|
||||||
#[error("{message}")]
|
#[error("{message}")]
|
||||||
#[diagnostic(code(komorebi::configuration), help("try fixing this syntax error"))]
|
#[diagnostic(code(komorebi::configuration), help("try fixing this syntax error"))]
|
||||||
@@ -142,7 +130,7 @@ macro_rules! gen_enum_subcommand_args {
|
|||||||
( $( $name:ident: $element:ty ),+ $(,)? ) => {
|
( $( $name:ident: $element:ty ),+ $(,)? ) => {
|
||||||
$(
|
$(
|
||||||
paste! {
|
paste! {
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
#[clap(value_enum)]
|
#[clap(value_enum)]
|
||||||
[<$element:snake>]: $element
|
[<$element:snake>]: $element
|
||||||
@@ -182,7 +170,7 @@ macro_rules! gen_target_subcommand_args {
|
|||||||
// SubCommand Pattern
|
// SubCommand Pattern
|
||||||
( $( $name:ident ),+ $(,)? ) => {
|
( $( $name:ident ),+ $(,)? ) => {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
/// Target index (zero-indexed)
|
/// Target index (zero-indexed)
|
||||||
target: usize,
|
target: usize,
|
||||||
@@ -207,7 +195,7 @@ macro_rules! gen_named_target_subcommand_args {
|
|||||||
// SubCommand Pattern
|
// SubCommand Pattern
|
||||||
( $( $name:ident ),+ $(,)? ) => {
|
( $( $name:ident ),+ $(,)? ) => {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
/// Target workspace name
|
/// Target workspace name
|
||||||
workspace: String,
|
workspace: String,
|
||||||
@@ -231,7 +219,7 @@ macro_rules! gen_workspace_subcommand_args {
|
|||||||
( $( $name:ident: $(#[enum] $(@$value_enum:tt)?)? $value:ty ),+ $(,)? ) => (
|
( $( $name:ident: $(#[enum] $(@$value_enum:tt)?)? $value:ty ),+ $(,)? ) => (
|
||||||
paste! {
|
paste! {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser)]
|
||||||
pub struct [<Workspace $name>] {
|
pub struct [<Workspace $name>] {
|
||||||
/// Monitor index (zero-indexed)
|
/// Monitor index (zero-indexed)
|
||||||
monitor: usize,
|
monitor: usize,
|
||||||
@@ -263,7 +251,7 @@ macro_rules! gen_named_workspace_subcommand_args {
|
|||||||
( $( $name:ident: $(#[enum] $(@$value_enum:tt)?)? $value:ty ),+ $(,)? ) => (
|
( $( $name:ident: $(#[enum] $(@$value_enum:tt)?)? $value:ty ),+ $(,)? ) => (
|
||||||
paste! {
|
paste! {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser)]
|
||||||
pub struct [<NamedWorkspace $name>] {
|
pub struct [<NamedWorkspace $name>] {
|
||||||
/// Target workspace name
|
/// Target workspace name
|
||||||
workspace: String,
|
workspace: String,
|
||||||
@@ -285,7 +273,7 @@ gen_named_workspace_subcommand_args! {
|
|||||||
Tiling: #[enum] BooleanState,
|
Tiling: #[enum] BooleanState,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
pub struct ClearWorkspaceLayoutRules {
|
pub struct ClearWorkspaceLayoutRules {
|
||||||
/// Monitor index (zero-indexed)
|
/// Monitor index (zero-indexed)
|
||||||
monitor: usize,
|
monitor: usize,
|
||||||
@@ -294,7 +282,7 @@ pub struct ClearWorkspaceLayoutRules {
|
|||||||
workspace: usize,
|
workspace: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
pub struct WorkspaceCustomLayout {
|
pub struct WorkspaceCustomLayout {
|
||||||
/// Monitor index (zero-indexed)
|
/// Monitor index (zero-indexed)
|
||||||
monitor: usize,
|
monitor: usize,
|
||||||
@@ -306,7 +294,7 @@ pub struct WorkspaceCustomLayout {
|
|||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
pub struct NamedWorkspaceCustomLayout {
|
pub struct NamedWorkspaceCustomLayout {
|
||||||
/// Target workspace name
|
/// Target workspace name
|
||||||
workspace: String,
|
workspace: String,
|
||||||
@@ -315,7 +303,7 @@ pub struct NamedWorkspaceCustomLayout {
|
|||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
pub struct WorkspaceLayoutRule {
|
pub struct WorkspaceLayoutRule {
|
||||||
/// Monitor index (zero-indexed)
|
/// Monitor index (zero-indexed)
|
||||||
monitor: usize,
|
monitor: usize,
|
||||||
@@ -330,7 +318,7 @@ pub struct WorkspaceLayoutRule {
|
|||||||
layout: DefaultLayout,
|
layout: DefaultLayout,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
pub struct NamedWorkspaceLayoutRule {
|
pub struct NamedWorkspaceLayoutRule {
|
||||||
/// Target workspace name
|
/// Target workspace name
|
||||||
workspace: String,
|
workspace: String,
|
||||||
@@ -342,7 +330,7 @@ pub struct NamedWorkspaceLayoutRule {
|
|||||||
layout: DefaultLayout,
|
layout: DefaultLayout,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
pub struct WorkspaceCustomLayoutRule {
|
pub struct WorkspaceCustomLayoutRule {
|
||||||
/// Monitor index (zero-indexed)
|
/// Monitor index (zero-indexed)
|
||||||
monitor: usize,
|
monitor: usize,
|
||||||
@@ -357,7 +345,7 @@ pub struct WorkspaceCustomLayoutRule {
|
|||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
pub struct NamedWorkspaceCustomLayoutRule {
|
pub struct NamedWorkspaceCustomLayoutRule {
|
||||||
/// Target workspace name
|
/// Target workspace name
|
||||||
workspace: String,
|
workspace: String,
|
||||||
@@ -369,7 +357,7 @@ pub struct NamedWorkspaceCustomLayoutRule {
|
|||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct Resize {
|
struct Resize {
|
||||||
#[clap(value_enum)]
|
#[clap(value_enum)]
|
||||||
edge: OperationDirection,
|
edge: OperationDirection,
|
||||||
@@ -377,7 +365,7 @@ struct Resize {
|
|||||||
sizing: Sizing,
|
sizing: Sizing,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct ResizeAxis {
|
struct ResizeAxis {
|
||||||
#[clap(value_enum)]
|
#[clap(value_enum)]
|
||||||
axis: Axis,
|
axis: Axis,
|
||||||
@@ -385,13 +373,13 @@ struct ResizeAxis {
|
|||||||
sizing: Sizing,
|
sizing: Sizing,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct ResizeDelta {
|
struct ResizeDelta {
|
||||||
/// The delta of pixels by which to increase or decrease window dimensions when resizing
|
/// The delta of pixels by which to increase or decrease window dimensions when resizing
|
||||||
pixels: i32,
|
pixels: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct InvisibleBorders {
|
struct InvisibleBorders {
|
||||||
/// Size of the left invisible border
|
/// Size of the left invisible border
|
||||||
left: i32,
|
left: i32,
|
||||||
@@ -403,7 +391,7 @@ struct InvisibleBorders {
|
|||||||
bottom: i32,
|
bottom: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct GlobalWorkAreaOffset {
|
struct GlobalWorkAreaOffset {
|
||||||
/// Size of the left work area offset (set right to left * 2 to maintain right padding)
|
/// Size of the left work area offset (set right to left * 2 to maintain right padding)
|
||||||
left: i32,
|
left: i32,
|
||||||
@@ -415,7 +403,7 @@ struct GlobalWorkAreaOffset {
|
|||||||
bottom: i32,
|
bottom: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct MonitorWorkAreaOffset {
|
struct MonitorWorkAreaOffset {
|
||||||
/// Monitor index (zero-indexed)
|
/// Monitor index (zero-indexed)
|
||||||
monitor: usize,
|
monitor: usize,
|
||||||
@@ -429,7 +417,7 @@ struct MonitorWorkAreaOffset {
|
|||||||
bottom: i32,
|
bottom: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct MonitorIndexPreference {
|
struct MonitorIndexPreference {
|
||||||
/// Preferred monitor index (zero-indexed)
|
/// Preferred monitor index (zero-indexed)
|
||||||
index_preference: usize,
|
index_preference: usize,
|
||||||
@@ -443,7 +431,7 @@ struct MonitorIndexPreference {
|
|||||||
bottom: i32,
|
bottom: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct DisplayIndexPreference {
|
struct DisplayIndexPreference {
|
||||||
/// Preferred monitor index (zero-indexed)
|
/// Preferred monitor index (zero-indexed)
|
||||||
index_preference: usize,
|
index_preference: usize,
|
||||||
@@ -451,7 +439,7 @@ struct DisplayIndexPreference {
|
|||||||
display: String,
|
display: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct EnsureWorkspaces {
|
struct EnsureWorkspaces {
|
||||||
/// Monitor index (zero-indexed)
|
/// Monitor index (zero-indexed)
|
||||||
monitor: usize,
|
monitor: usize,
|
||||||
@@ -459,7 +447,7 @@ struct EnsureWorkspaces {
|
|||||||
workspace_count: usize,
|
workspace_count: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct EnsureNamedWorkspaces {
|
struct EnsureNamedWorkspaces {
|
||||||
/// Monitor index (zero-indexed)
|
/// Monitor index (zero-indexed)
|
||||||
monitor: usize,
|
monitor: usize,
|
||||||
@@ -467,7 +455,7 @@ struct EnsureNamedWorkspaces {
|
|||||||
names: Vec<String>,
|
names: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct FocusMonitorWorkspace {
|
struct FocusMonitorWorkspace {
|
||||||
/// Target monitor index (zero-indexed)
|
/// Target monitor index (zero-indexed)
|
||||||
target_monitor: usize,
|
target_monitor: usize,
|
||||||
@@ -475,7 +463,7 @@ struct FocusMonitorWorkspace {
|
|||||||
target_workspace: usize,
|
target_workspace: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
pub struct SendToMonitorWorkspace {
|
pub struct SendToMonitorWorkspace {
|
||||||
/// Target monitor index (zero-indexed)
|
/// Target monitor index (zero-indexed)
|
||||||
target_monitor: usize,
|
target_monitor: usize,
|
||||||
@@ -483,7 +471,7 @@ pub struct SendToMonitorWorkspace {
|
|||||||
target_workspace: usize,
|
target_workspace: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
pub struct MoveToMonitorWorkspace {
|
pub struct MoveToMonitorWorkspace {
|
||||||
/// Target monitor index (zero-indexed)
|
/// Target monitor index (zero-indexed)
|
||||||
target_monitor: usize,
|
target_monitor: usize,
|
||||||
@@ -495,7 +483,7 @@ macro_rules! gen_focused_workspace_padding_subcommand_args {
|
|||||||
// SubCommand Pattern
|
// SubCommand Pattern
|
||||||
( $( $name:ident ),+ $(,)? ) => {
|
( $( $name:ident ),+ $(,)? ) => {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
/// Pixels size to set as an integer
|
/// Pixels size to set as an integer
|
||||||
size: i32,
|
size: i32,
|
||||||
@@ -513,7 +501,7 @@ macro_rules! gen_padding_subcommand_args {
|
|||||||
// SubCommand Pattern
|
// SubCommand Pattern
|
||||||
( $( $name:ident ),+ $(,)? ) => {
|
( $( $name:ident ),+ $(,)? ) => {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
/// Monitor index (zero-indexed)
|
/// Monitor index (zero-indexed)
|
||||||
monitor: usize,
|
monitor: usize,
|
||||||
@@ -535,7 +523,7 @@ macro_rules! gen_named_padding_subcommand_args {
|
|||||||
// SubCommand Pattern
|
// SubCommand Pattern
|
||||||
( $( $name:ident ),+ $(,)? ) => {
|
( $( $name:ident ),+ $(,)? ) => {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
/// Target workspace name
|
/// Target workspace name
|
||||||
workspace: String,
|
workspace: String,
|
||||||
@@ -556,7 +544,7 @@ macro_rules! gen_padding_adjustment_subcommand_args {
|
|||||||
// SubCommand Pattern
|
// SubCommand Pattern
|
||||||
( $( $name:ident ),+ $(,)? ) => {
|
( $( $name:ident ),+ $(,)? ) => {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
#[clap(value_enum)]
|
#[clap(value_enum)]
|
||||||
sizing: Sizing,
|
sizing: Sizing,
|
||||||
@@ -576,7 +564,7 @@ macro_rules! gen_application_target_subcommand_args {
|
|||||||
// SubCommand Pattern
|
// SubCommand Pattern
|
||||||
( $( $name:ident ),+ $(,)? ) => {
|
( $( $name:ident ),+ $(,)? ) => {
|
||||||
$(
|
$(
|
||||||
#[derive(clap::Parser, derive_ahk::AhkFunction)]
|
#[derive(clap::Parser)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
#[clap(value_enum)]
|
#[clap(value_enum)]
|
||||||
identifier: ApplicationIdentifier,
|
identifier: ApplicationIdentifier,
|
||||||
@@ -597,7 +585,7 @@ gen_application_target_subcommand_args! {
|
|||||||
RemoveTitleBar,
|
RemoveTitleBar,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct InitialWorkspaceRule {
|
struct InitialWorkspaceRule {
|
||||||
#[clap(value_enum)]
|
#[clap(value_enum)]
|
||||||
identifier: ApplicationIdentifier,
|
identifier: ApplicationIdentifier,
|
||||||
@@ -609,7 +597,7 @@ struct InitialWorkspaceRule {
|
|||||||
workspace: usize,
|
workspace: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct InitialNamedWorkspaceRule {
|
struct InitialNamedWorkspaceRule {
|
||||||
#[clap(value_enum)]
|
#[clap(value_enum)]
|
||||||
identifier: ApplicationIdentifier,
|
identifier: ApplicationIdentifier,
|
||||||
@@ -619,7 +607,7 @@ struct InitialNamedWorkspaceRule {
|
|||||||
workspace: String,
|
workspace: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct WorkspaceRule {
|
struct WorkspaceRule {
|
||||||
#[clap(value_enum)]
|
#[clap(value_enum)]
|
||||||
identifier: ApplicationIdentifier,
|
identifier: ApplicationIdentifier,
|
||||||
@@ -631,7 +619,7 @@ struct WorkspaceRule {
|
|||||||
workspace: usize,
|
workspace: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct NamedWorkspaceRule {
|
struct NamedWorkspaceRule {
|
||||||
#[clap(value_enum)]
|
#[clap(value_enum)]
|
||||||
identifier: ApplicationIdentifier,
|
identifier: ApplicationIdentifier,
|
||||||
@@ -641,13 +629,13 @@ struct NamedWorkspaceRule {
|
|||||||
workspace: String,
|
workspace: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct ToggleFocusFollowsMouse {
|
struct ToggleFocusFollowsMouse {
|
||||||
#[clap(value_enum, short, long, default_value = "windows")]
|
#[clap(value_enum, short, long, default_value = "windows")]
|
||||||
implementation: FocusFollowsMouseImplementation,
|
implementation: FocusFollowsMouseImplementation,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct FocusFollowsMouse {
|
struct FocusFollowsMouse {
|
||||||
#[clap(value_enum, short, long, default_value = "windows")]
|
#[clap(value_enum, short, long, default_value = "windows")]
|
||||||
implementation: FocusFollowsMouseImplementation,
|
implementation: FocusFollowsMouseImplementation,
|
||||||
@@ -655,13 +643,13 @@ struct FocusFollowsMouse {
|
|||||||
boolean_state: BooleanState,
|
boolean_state: BooleanState,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct Border {
|
struct Border {
|
||||||
#[clap(value_enum)]
|
#[clap(value_enum)]
|
||||||
boolean_state: BooleanState,
|
boolean_state: BooleanState,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct BorderColour {
|
struct BorderColour {
|
||||||
#[clap(value_enum, short, long, default_value = "single")]
|
#[clap(value_enum, short, long, default_value = "single")]
|
||||||
window_kind: WindowKind,
|
window_kind: WindowKind,
|
||||||
@@ -673,19 +661,19 @@ struct BorderColour {
|
|||||||
b: u32,
|
b: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct BorderWidth {
|
struct BorderWidth {
|
||||||
/// Desired width of the window border
|
/// Desired width of the window border
|
||||||
width: i32,
|
width: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct BorderOffset {
|
struct BorderOffset {
|
||||||
/// Desired offset of the window border
|
/// Desired offset of the window border
|
||||||
offset: i32,
|
offset: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
#[allow(clippy::struct_excessive_bools)]
|
#[allow(clippy::struct_excessive_bools)]
|
||||||
struct Start {
|
struct Start {
|
||||||
/// Allow the use of komorebi's custom focus-follows-mouse implementation
|
/// Allow the use of komorebi's custom focus-follows-mouse implementation
|
||||||
@@ -708,56 +696,56 @@ struct Start {
|
|||||||
ahk: bool,
|
ahk: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct Stop {
|
struct Stop {
|
||||||
/// Stop whkd if it is running as a background process
|
/// Stop whkd if it is running as a background process
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
whkd: bool,
|
whkd: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct SaveResize {
|
struct SaveResize {
|
||||||
/// File to which the resize layout dimensions should be saved
|
/// File to which the resize layout dimensions should be saved
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct LoadResize {
|
struct LoadResize {
|
||||||
/// File from which the resize layout dimensions should be loaded
|
/// File from which the resize layout dimensions should be loaded
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct LoadCustomLayout {
|
struct LoadCustomLayout {
|
||||||
/// JSON or YAML file from which the custom layout definition should be loaded
|
/// JSON or YAML file from which the custom layout definition should be loaded
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct SubscribeSocket {
|
struct SubscribeSocket {
|
||||||
/// Name of the socket to send event notifications to
|
/// Name of the socket to send event notifications to
|
||||||
socket: String,
|
socket: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct UnsubscribeSocket {
|
struct UnsubscribeSocket {
|
||||||
/// Name of the socket to stop sending event notifications to
|
/// Name of the socket to stop sending event notifications to
|
||||||
socket: String,
|
socket: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct SubscribePipe {
|
struct SubscribePipe {
|
||||||
/// Name of the pipe to send event notifications to (without "\\.\pipe\" prepended)
|
/// Name of the pipe to send event notifications to (without "\\.\pipe\" prepended)
|
||||||
named_pipe: String,
|
named_pipe: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct UnsubscribePipe {
|
struct UnsubscribePipe {
|
||||||
/// Name of the pipe to stop sending event notifications to (without "\\.\pipe\" prepended)
|
/// Name of the pipe to stop sending event notifications to (without "\\.\pipe\" prepended)
|
||||||
named_pipe: String,
|
named_pipe: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct AhkAppSpecificConfiguration {
|
struct AhkAppSpecificConfiguration {
|
||||||
/// YAML file from which the application-specific configurations should be loaded
|
/// YAML file from which the application-specific configurations should be loaded
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
@@ -765,7 +753,7 @@ struct AhkAppSpecificConfiguration {
|
|||||||
override_path: Option<PathBuf>,
|
override_path: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct PwshAppSpecificConfiguration {
|
struct PwshAppSpecificConfiguration {
|
||||||
/// YAML file from which the application-specific configurations should be loaded
|
/// YAML file from which the application-specific configurations should be loaded
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
@@ -773,19 +761,19 @@ struct PwshAppSpecificConfiguration {
|
|||||||
override_path: Option<PathBuf>,
|
override_path: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct FormatAppSpecificConfiguration {
|
struct FormatAppSpecificConfiguration {
|
||||||
/// YAML file from which the application-specific configurations should be loaded
|
/// YAML file from which the application-specific configurations should be loaded
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct AltFocusHack {
|
struct AltFocusHack {
|
||||||
#[clap(value_enum)]
|
#[clap(value_enum)]
|
||||||
boolean_state: BooleanState,
|
boolean_state: BooleanState,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser)]
|
||||||
struct EnableAutostart {
|
struct EnableAutostart {
|
||||||
/// Path to a static configuration JSON file
|
/// Path to a static configuration JSON file
|
||||||
#[clap(action, short, long)]
|
#[clap(action, short, long)]
|
||||||
@@ -808,7 +796,7 @@ struct Opts {
|
|||||||
subcmd: SubCommand,
|
subcmd: SubCommand,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkLibrary)]
|
#[derive(Parser)]
|
||||||
enum SubCommand {
|
enum SubCommand {
|
||||||
#[clap(hide = true)]
|
#[clap(hide = true)]
|
||||||
Docgen,
|
Docgen,
|
||||||
@@ -1180,8 +1168,6 @@ enum SubCommand {
|
|||||||
MouseFollowsFocus(MouseFollowsFocus),
|
MouseFollowsFocus(MouseFollowsFocus),
|
||||||
/// Toggle mouse follows focus on all workspaces
|
/// Toggle mouse follows focus on all workspaces
|
||||||
ToggleMouseFollowsFocus,
|
ToggleMouseFollowsFocus,
|
||||||
/// Generate a library of AutoHotKey helper functions
|
|
||||||
AhkLibrary,
|
|
||||||
/// Generate common app-specific configurations and fixes to use in komorebi.ahk
|
/// Generate common app-specific configurations and fixes to use in komorebi.ahk
|
||||||
#[clap(arg_required_else_help = true)]
|
#[clap(arg_required_else_help = true)]
|
||||||
#[clap(alias = "ahk-asc")]
|
#[clap(alias = "ahk-asc")]
|
||||||
@@ -1465,35 +1451,6 @@ fn main() -> Result<()> {
|
|||||||
println!("{}", whkdrc.display());
|
println!("{}", whkdrc.display());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SubCommand::AhkLibrary => {
|
|
||||||
let library = HOME_DIR.join("komorebic.lib.ahk");
|
|
||||||
let mut file = OpenOptions::new()
|
|
||||||
.write(true)
|
|
||||||
.create(true)
|
|
||||||
.truncate(true)
|
|
||||||
.open(library.clone())?;
|
|
||||||
|
|
||||||
let output: String = SubCommand::generate_ahk_library();
|
|
||||||
let fixed_id = output.replace("%id%", "\"%id%\"");
|
|
||||||
let fixed_stop_def = fixed_id.replace("Stop(whkd)", "Stop()");
|
|
||||||
let fixed_output =
|
|
||||||
fixed_stop_def.replace("komorebic.exe stop --whkd %whkd%", "komorebic.exe stop");
|
|
||||||
|
|
||||||
file.write_all(fixed_output.as_bytes())?;
|
|
||||||
|
|
||||||
println!(
|
|
||||||
"\nAHKv1 helper library for komorebic written to {}",
|
|
||||||
library.to_string_lossy()
|
|
||||||
);
|
|
||||||
|
|
||||||
println!("\nYou can convert this file to AHKv2 syntax using https://github.com/mmikeww/AHK-v2-script-converter");
|
|
||||||
|
|
||||||
println!(
|
|
||||||
"\nYou can include the converted library at the top of your komorebi.ahk config with this line:"
|
|
||||||
);
|
|
||||||
|
|
||||||
println!("\n#Include komorebic.lib.ahk");
|
|
||||||
}
|
|
||||||
SubCommand::Log => {
|
SubCommand::Log => {
|
||||||
let timestamp = Local::now().format("%Y-%m-%d").to_string();
|
let timestamp = Local::now().format("%Y-%m-%d").to_string();
|
||||||
let color_log = std::env::temp_dir().join(format!("komorebi.log.{timestamp}"));
|
let color_log = std::env::temp_dir().join(format!("komorebi.log.{timestamp}"));
|
||||||
|
|||||||
Reference in New Issue
Block a user