This commit is contained in:
Penelope Gwen 2026-05-01 09:55:29 -07:00
parent 02aa0489e1
commit 7977caafb3
7 changed files with 25 additions and 6 deletions

2
Cargo.lock generated
View file

@ -1754,7 +1754,7 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "sway-de-utils"
version = "0.1.12"
version = "0.1.13"
dependencies = [
"clap",
"clap_complete",

View file

@ -1,6 +1,6 @@
[package]
name = "sway-de-utils"
version = "0.1.12"
version = "0.1.13"
authors = ["Penelope Gwen <support@pogmom.me>"]
edition = "2024"
license-file = "LICENSE.md"

7
debian/changelog vendored
View file

@ -1,3 +1,10 @@
sway-de-utils (0.1.13-1) unstable; urgency=medium
* add ability to append arguments to sdu launch program calls
* fix wallpaper cache directory
-- Penelope Gwen <support@pogmom.me> Tue, 01 May 2026 09:52:07 -0800
sway-de-utils (0.1.12-1) unstable; urgency=medium
* fix kb_order profile name logic

View file

@ -18,8 +18,12 @@ pub enum Commands {
/// Launch Program with Current Workspace's Profile Configuration
#[clap(alias = "L")]
Launch {
/// Program from config file to be launched
#[arg(short, long)]
program: String,
/// (optional) additional args to be passed to the program
#[arg(short, long)]
args: Option<Vec<String>>,
},
/// Set up blurred wallpaper for screen lock, and locks screen
#[clap(alias = "l")]

View file

@ -9,11 +9,12 @@ use crate::{
pub fn launch(
exec: &String,
extra_args: Option<Vec<String>>,
profiles: Vec<Profile>,
programs: HashMap<String, Programs>,
) -> Result<(), SDUError> {
debug!("{}", exec);
match profile_launch(profiles, programs, exec) {
match profile_launch(profiles, programs, exec, extra_args) {
Ok(p) => {
debug!("{}", p);
run_sway_command(&mut get_sway_connection(), p)
@ -33,6 +34,7 @@ pub fn profile_launch(
profiles: Vec<Profile>,
programs_config: HashMap<String, Programs>,
program_arg: &String,
extra_args: Option<Vec<String>>,
) -> Result<String, SDUError> {
match programs_config.iter().find(|x| x.0.eq(program_arg)) {
Some(p) => {
@ -47,7 +49,11 @@ pub fn profile_launch(
.find(|x| x.0.eq(p.0))
{
swaymsg_command = append_arguments(swaymsg_command, profile_args.1.to_owned());
if let Some(a) = extra_args {
swaymsg_command = append_arguments(swaymsg_command, a)
}
}
debug!("{:#?}", swaymsg_command);
Ok(swaymsg_command)
}
None => Err(SDUError {

View file

@ -32,7 +32,7 @@ pub fn lock_screen(lock_config: LockConf, force_bg_render: bool) -> Result<(), S
match &lock_config.wallpaper_path {
Some(wallpaper_path) => {
let wallpaper_root_path = PathBuf::from(tilde(&wallpaper_path).to_string());
let wp_cache_dir = get_path(DirectoryType::Cache, "sway-profiles-rs/lock/");
let wp_cache_dir = get_path(DirectoryType::Cache, "sway-de-utils/lock/");
DirBuilder::new()
.recursive(true)
@ -163,7 +163,7 @@ pub fn wallpaper_check_hash(hashes_json_path: PathBuf) -> Vec<WallpaperCache> {
}
pub fn get_path(dir_type: DirectoryType, suffix: &str) -> PathBuf {
let base_directories = BaseDirectories::with_prefix("sway-profiles-rs");
let base_directories = BaseDirectories::with_prefix("sway-de-utils");
let base_dir = match dir_type {
DirectoryType::Cache => base_directories.cache_home,
DirectoryType::Config => base_directories.config_home,

View file

@ -40,7 +40,9 @@ fn main() -> Result<(), ()> {
config.profiles,
config.preserve_keyboard_order,
),
Commands::Launch { program } => launch(program, config.profiles, config.programs),
Commands::Launch { program, args } => {
launch(program, args.clone(), config.profiles, config.programs)
}
Commands::Lock {
force_render_background,
} => lock_screen(config.lock, force_render_background.unwrap_or_default()),