diff --git a/Cargo.lock b/Cargo.lock index e787d21..75ccf9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1852,7 +1852,7 @@ dependencies = [ [[package]] name = "sway-de-utils" -version = "0.1.7" +version = "0.1.8" dependencies = [ "clap", "clap_complete", diff --git a/Cargo.toml b/Cargo.toml index 5f43178..b987397 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-de-utils" -version = "0.1.7" +version = "0.1.8" authors = ["Penelope Gwen "] edition = "2024" license-file = "LICENSE.md" diff --git a/debian/changelog b/debian/changelog index 67bab4a..536c3af 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +sway-de-utils (0.1.8-1) unstable; urgency=medium + + * (slightly) better error handling for power dialog absence + * fix logic behind sdu launch profile detection + + -- Penelope Gwen Sat, 24 Jan 2026 12:48:02 -0800 + sway-de-utils (0.1.7-1) unstable; urgency=medium * implement shell completions for bash, fish, zsh diff --git a/src/lib/launch.rs b/src/lib/launch.rs index e788717..03e2704 100644 --- a/src/lib/launch.rs +++ b/src/lib/launch.rs @@ -4,7 +4,7 @@ use log::debug; use crate::{ config::{Profile, Programs}, - lib::{SDUError, get_sway_connection, profile::active_profile, run_sway_command}, + lib::{SDUError, get_sway_connection, run_sway_command, sway::focused_workspace_profile}, }; pub fn launch( @@ -38,22 +38,17 @@ pub fn profile_launch( Some(p) => { let mut swaymsg_command = format!("exec {}", p.1.command); swaymsg_command = append_arguments(swaymsg_command, p.1.arguments.clone()); - match active_profile(profiles) { - Ok(profile) => { - println!("{:#?}", profile); - if let Some(profile_args) = profile - .program_args - .unwrap_or_default() - .iter() - .find(|x| x.0.eq(p.0)) - { - swaymsg_command = - append_arguments(swaymsg_command, profile_args.1.to_owned()); - } - Ok(swaymsg_command) - } - Err(e) => Err(e), + let profile = focused_workspace_profile(profiles); + debug!("{:#?}", profile); + if let Some(profile_args) = profile + .program_args + .unwrap_or_default() + .iter() + .find(|x| x.0.eq(p.0)) + { + swaymsg_command = append_arguments(swaymsg_command, profile_args.1.to_owned()); } + Ok(swaymsg_command) } None => Err(SDUError { message: String::from("No matching program found"), diff --git a/src/lib/profile.rs b/src/lib/profile.rs index ecee2b4..369d6b4 100644 --- a/src/lib/profile.rs +++ b/src/lib/profile.rs @@ -273,7 +273,7 @@ pub fn active_profile_index() -> usize { } } -pub fn active_profile(profiles: Vec) -> Result { +pub fn _active_profile(profiles: Vec) -> Result { match profiles.get(active_profile_index()) { Some(p) => Ok(p.clone()), None => Err(SDUError {