mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-04-25 01:58:51 +02:00
feat(cli): make --config optional for enable-autostart (#596)
* feat(cli): make `--config` optional for `enable-autostart` * actually make it optional * remove unnecessary `action` attribute
This commit is contained in:
@@ -448,16 +448,16 @@ fn detect_deadlocks() {
|
|||||||
#[clap(author, about, version)]
|
#[clap(author, about, version)]
|
||||||
struct Opts {
|
struct Opts {
|
||||||
/// Allow the use of komorebi's custom focus-follows-mouse implementation
|
/// Allow the use of komorebi's custom focus-follows-mouse implementation
|
||||||
#[clap(action, short, long = "ffm")]
|
#[clap(short, long = "ffm")]
|
||||||
focus_follows_mouse: bool,
|
focus_follows_mouse: bool,
|
||||||
/// Wait for 'komorebic complete-configuration' to be sent before processing events
|
/// Wait for 'komorebic complete-configuration' to be sent before processing events
|
||||||
#[clap(action, short, long)]
|
#[clap(short, long)]
|
||||||
await_configuration: bool,
|
await_configuration: bool,
|
||||||
/// Start a TCP server on the given port to allow the direct sending of SocketMessages
|
/// Start a TCP server on the given port to allow the direct sending of SocketMessages
|
||||||
#[clap(action, short, long)]
|
#[clap(short, long)]
|
||||||
tcp_port: Option<usize>,
|
tcp_port: Option<usize>,
|
||||||
/// Path to a static configuration JSON file
|
/// Path to a static configuration JSON file
|
||||||
#[clap(action, short, long)]
|
#[clap(short, long)]
|
||||||
config: Option<PathBuf>,
|
config: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -631,29 +631,29 @@ struct ActiveWindowBorderOffset {
|
|||||||
#[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
|
||||||
#[clap(action, short, long = "ffm")]
|
#[clap(short, long = "ffm")]
|
||||||
ffm: bool,
|
ffm: bool,
|
||||||
/// Path to a static configuration JSON file
|
/// Path to a static configuration JSON file
|
||||||
#[clap(action, short, long)]
|
#[clap(short, long)]
|
||||||
config: Option<PathBuf>,
|
config: Option<PathBuf>,
|
||||||
/// Wait for 'komorebic complete-configuration' to be sent before processing events
|
/// Wait for 'komorebic complete-configuration' to be sent before processing events
|
||||||
#[clap(action, short, long)]
|
#[clap(short, long)]
|
||||||
await_configuration: bool,
|
await_configuration: bool,
|
||||||
/// Start a TCP server on the given port to allow the direct sending of SocketMessages
|
/// Start a TCP server on the given port to allow the direct sending of SocketMessages
|
||||||
#[clap(action, short, long)]
|
#[clap(short, long)]
|
||||||
tcp_port: Option<usize>,
|
tcp_port: Option<usize>,
|
||||||
/// Start whkd in a background process
|
/// Start whkd in a background process
|
||||||
#[clap(action, long)]
|
#[clap(long)]
|
||||||
whkd: bool,
|
whkd: bool,
|
||||||
/// Start autohotkey configuration file
|
/// Start autohotkey configuration file
|
||||||
#[clap(action, long)]
|
#[clap(long)]
|
||||||
ahk: bool,
|
ahk: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, AhkFunction)]
|
#[derive(Parser, AhkFunction)]
|
||||||
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(action, long)]
|
#[clap(long)]
|
||||||
whkd: bool,
|
whkd: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -719,15 +719,15 @@ struct AltFocusHack {
|
|||||||
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)]
|
||||||
config: PathBuf,
|
config: Option<PathBuf>,
|
||||||
/// Enable komorebi's custom focus-follows-mouse implementation
|
/// Enable komorebi's custom focus-follows-mouse implementation
|
||||||
#[clap(action, short, long = "ffm")]
|
#[clap(short, long = "ffm")]
|
||||||
ffm: bool,
|
ffm: bool,
|
||||||
/// Enable autostart of whkd
|
/// Enable autostart of whkd
|
||||||
#[clap(action, long)]
|
#[clap(long)]
|
||||||
whkd: bool,
|
whkd: bool,
|
||||||
/// Enable autostart of ahk
|
/// Enable autostart of ahk
|
||||||
#[clap(action, long)]
|
#[clap(long)]
|
||||||
ahk: bool,
|
ahk: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1099,7 +1099,6 @@ enum SubCommand {
|
|||||||
/// Generates a static configuration JSON file based on the current window manager state
|
/// Generates a static configuration JSON file based on the current window manager state
|
||||||
GenerateStaticConfig,
|
GenerateStaticConfig,
|
||||||
/// Generates the komorebi.lnk shortcut in shell:startup to autostart komorebi
|
/// Generates the komorebi.lnk shortcut in shell:startup to autostart komorebi
|
||||||
#[clap(arg_required_else_help = true)]
|
|
||||||
EnableAutostart(EnableAutostart),
|
EnableAutostart(EnableAutostart),
|
||||||
/// Deletes the komorebi.lnk shortcut in shell:startup to disable autostart
|
/// Deletes the komorebi.lnk shortcut in shell:startup to disable autostart
|
||||||
DisableAutostart,
|
DisableAutostart,
|
||||||
@@ -1205,10 +1204,12 @@ fn main() -> Result<()> {
|
|||||||
let shortcut_file = startup_dir.join("komorebi.lnk");
|
let shortcut_file = startup_dir.join("komorebi.lnk");
|
||||||
let shortcut_file = dunce::simplified(&shortcut_file);
|
let shortcut_file = dunce::simplified(&shortcut_file);
|
||||||
|
|
||||||
let mut arguments = format!(
|
let mut arguments = String::from("start");
|
||||||
"start --config {}",
|
|
||||||
dunce::canonicalize(args.config)?.display()
|
if let Some(config) = args.config {
|
||||||
);
|
arguments.push_str("--config ");
|
||||||
|
arguments.push_str(&config.to_string_lossy());
|
||||||
|
}
|
||||||
|
|
||||||
if args.ffm {
|
if args.ffm {
|
||||||
arguments.push_str(" --ffm");
|
arguments.push_str(" --ffm");
|
||||||
|
|||||||
Reference in New Issue
Block a user