housekeeping

This commit is contained in:
Penelope Gwen 2026-01-24 14:11:41 -08:00
parent 8e9567e6e0
commit 4d857b9a99
10 changed files with 33 additions and 32 deletions

View file

@ -1,5 +1,8 @@
use clap::{CommandFactory, command};
use clap_complete::{aot::Elvish, generate_to, shells::{Bash, Fish, Zsh}};
use clap_complete::{
generate_to,
shells::{Bash, Fish, Zsh, Elvish},
};
use std::env;
use std::io::Error;
@ -12,17 +15,15 @@ fn main() -> Result<(), Error> {
};
let mut cmd = Cli::command();
let bash_path = generate_to(
Bash,
&mut cmd, // We need to specify what generator to use
"sdu", // We need to specify the bin name manually
&outdir, // We need to specify where to write to
)?;
let zsh_path = generate_to(Zsh, &mut cmd, "sdu", &outdir)?;
let fish_path = generate_to(Fish, &mut cmd, "sdu", &outdir)?;
let elvish_path = generate_to(Elvish, &mut cmd, "sdu", outdir)?;
let bin_name = "sdu";
let bash_path = generate_to(Bash, &mut cmd, bin_name, &outdir)?;
let zsh_path = generate_to(Zsh, &mut cmd, bin_name, &outdir)?;
let fish_path = generate_to(Fish, &mut cmd, bin_name, &outdir)?;
let elvish_path = generate_to(Elvish, &mut cmd, bin_name, outdir)?;
println!("cargo:warning=completion files were generated: [ {bash_path:?}, {zsh_path:?}, {fish_path:?}, {elvish_path:?} ]");
println!(
"cargo:warning=completion files were generated: [ {bash_path:?}, {zsh_path:?}, {fish_path:?}, {elvish_path:?} ]"
);
Ok(())
}
}

View file

@ -188,4 +188,3 @@ pub enum ProfileGetCommand {
#[clap(alias = "i")]
Icon,
}

View file

@ -4,7 +4,7 @@ use log::debug;
use crate::{
config::{Profile, Programs},
lib::{profile::active_profile, get_sway_connection, run_sway_command, SDUError},
lib::{SDUError, get_sway_connection, profile::active_profile, run_sway_command},
};
pub fn launch(

View file

@ -16,7 +16,8 @@ use shellexpand::tilde;
use xdg::BaseDirectories;
use crate::{
config::LockConf, lib::{sway_ipc::get_sway_connection, DirectoryType, SDUError},
config::LockConf,
lib::{DirectoryType, SDUError, sway_ipc::get_sway_connection},
};
#[derive(Serialize, Deserialize, Debug)]

View file

@ -8,9 +8,9 @@ mod scratchpad;
mod shortcuts;
mod sway;
mod sway_ipc;
mod utils;
mod windows;
mod workspaces;
mod utils;
pub use {
cli::{Cli, Commands},
@ -22,7 +22,7 @@ pub use {
shortcuts::shortcuts_fn,
sway::sway_fn,
sway_ipc::{get_sway_connection, run_sway_command},
utils::{DirectoryType, SDUError, get_xdg_dirs, setup_runtime_dir},
windows::get_window_info,
workspaces::get_workspace_info,
utils::{setup_runtime_dir, get_xdg_dirs, SDUError, DirectoryType}
};

View file

@ -1,7 +1,8 @@
use {
crate::{
config::LockConf, lib::cli::PowerCommand,
lib::{lock_screen, get_sway_connection, run_sway_command, SDUError},
config::LockConf,
lib::cli::PowerCommand,
lib::{SDUError, get_sway_connection, lock_screen, run_sway_command},
},
dialog::DialogBox,
log::debug,

View file

@ -1,11 +1,12 @@
use {
crate::{
config::{Config, Profile},
//lib::get,
get_xdg_dirs,
lib::{
SDUError,
cli::{ProfileCommand, ProfileGetCommand, ProfileSwitchCommand},
get, get_sway_connection, run_sway_command, shortcuts_fn, SDUError
get, get_sway_connection, run_sway_command, shortcuts_fn,
sway::focused_workspace_profile,
},
setup_runtime_dir,
},
@ -121,11 +122,10 @@ pub fn profile_fn(
Ok(())
}
ProfileCommand::Shortcuts { shortcut_command } => {
let active_profile =
active_profile(profiles_config).expect("could not determine active profile");
let focused_profile = focused_workspace_profile(profiles_config);
shortcuts_fn(
shortcut_command,
active_profile
focused_profile
.scripts
.expect("could not find scripts for profile"),
)

View file

@ -2,11 +2,11 @@ use {
crate::{
config::{Profile, WindowIcon},
lib::{
SDUError,
cli::{SwayCommand, SwayGetCommand},
get_scratchpad_info, get_sway_connection, get_window_info, get_workspace_info,
profile::profile_from_index,
sway_ipc::{self, get_sway_info},
SDUError
},
},
log::debug,

View file

@ -2,14 +2,14 @@ use {
crate::{
config::{Profile, WindowIcon},
lib::{
cli::SwayGetCommand, get_scratchpad_info, sway::focused_workspace_profile,
windows::get_window_info, workspaces::get_workspace_info, SDUError
}
SDUError, cli::SwayGetCommand, get_scratchpad_info, sway::focused_workspace_profile,
windows::get_window_info, workspaces::get_workspace_info,
},
},
log::debug,
serde_json::{Value, json},
std::time::Instant,
swayipc::{Connection, EventType}
swayipc::{Connection, EventType},
};
#[derive(serde::Serialize)]

View file

@ -1,7 +1,6 @@
#![warn(unused_crate_dependencies)]
//#![allow(clippy::style)]
mod config;
#[path = "lib/mod.rs"]
mod lib;
@ -10,9 +9,9 @@ use {
crate::{
config::Config,
lib::{
Cli, Commands, get_xdg_dirs, launch, lock_screen, power_fn, profile_fn, setup_runtime_dir, shortcuts_fn, sway_fn
Cli, Commands, get_xdg_dirs, launch, lock_screen, power_fn, profile_fn,
setup_runtime_dir, shortcuts_fn, sway_fn,
},
},
clap::Parser,
log::{debug, error},