fix sdu launch logic
This commit is contained in:
parent
416ee4b5d3
commit
4e2716cb46
5 changed files with 21 additions and 19 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -1852,7 +1852,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sway-de-utils"
|
||||
version = "0.1.7"
|
||||
version = "0.1.8"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"clap_complete",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "sway-de-utils"
|
||||
version = "0.1.7"
|
||||
version = "0.1.8"
|
||||
authors = ["Penelope Gwen <support@pogmom.me>"]
|
||||
edition = "2024"
|
||||
license-file = "LICENSE.md"
|
||||
|
|
|
|||
7
debian/changelog
vendored
7
debian/changelog
vendored
|
|
@ -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 <support@pogmom.me> 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
|
||||
|
|
|
|||
|
|
@ -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,23 +38,18 @@ 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);
|
||||
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());
|
||||
swaymsg_command = append_arguments(swaymsg_command, profile_args.1.to_owned());
|
||||
}
|
||||
Ok(swaymsg_command)
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
None => Err(SDUError {
|
||||
message: String::from("No matching program found"),
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ pub fn active_profile_index() -> usize {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn active_profile(profiles: Vec<Profile>) -> Result<Profile, SDUError> {
|
||||
pub fn _active_profile(profiles: Vec<Profile>) -> Result<Profile, SDUError> {
|
||||
match profiles.get(active_profile_index()) {
|
||||
Some(p) => Ok(p.clone()),
|
||||
None => Err(SDUError {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue