Compare commits

...

2 commits

Author SHA1 Message Date
Penelope Gwen
92baf2639f 0.1.6 2026-01-22 12:37:34 -08:00
Penelope Gwen
2d630af082 I should test my code before releases 2026-01-22 12:36:29 -08:00
5 changed files with 33 additions and 15 deletions

2
Cargo.lock generated
View file

@ -1827,7 +1827,7 @@ dependencies = [
[[package]]
name = "sway-de-utils"
version = "0.1.5"
version = "0.1.6"
dependencies = [
"clap",
"confy",

View file

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

6
debian/changelog vendored
View file

@ -1,3 +1,9 @@
sway-de-utils (0.1.6-1) unstable; urgency=medium
* add retrieval of current workspace profile information for real this time
-- Penelope Gwen <support@pogmom.me> Thu, 22 Jan 2026 12:37:22 -0800
sway-de-utils (0.1.5-1) unstable; urgency=medium
* add retrieval of current workspace profile information

View file

@ -3,16 +3,30 @@ use {
config::{Profile, WindowIcon},
lib::{
cli::{SwayCommand, SwayGetCommand},
get_scratchpad_info, get_window_info, get_workspace_info,
profile::{active_profile_index, profile_from_index},
get_scratchpad_info, get_sway_connection, get_window_info, get_workspace_info,
profile::profile_from_index,
sway_ipc::{self, get_sway_info},
},
utils::SDUError,
},
log::debug,
serde_json::json,
swayipc::EventType,
};
pub fn focused_workspace_profile(profiles: Vec<Profile>) -> Profile {
let focused_ws_index = get_sway_connection()
.get_workspaces()
.expect("unable to parse workspaces")
.iter()
.find(|w| w.focused)
.map(|w| w.num)
.unwrap_or_default() as usize
/ 10;
debug!("found profile {:?} for focused workspace", focused_ws_index);
profile_from_index(profiles, focused_ws_index)
}
pub fn sway_fn(
sway_command: &SwayCommand,
window_icons: &[WindowIcon],
@ -30,10 +44,9 @@ pub fn sway_fn(
SwayGetCommand::Window => get_window_info(window_icons),
SwayGetCommand::Full => get_sway_info(window_icons, profile_list.clone(), kb_order),
SwayGetCommand::Scratchpad => get_scratchpad_info(),
SwayGetCommand::WorkspaceProfile => json!(profile_from_index(
profile_list.clone(),
active_profile_index()
)),
SwayGetCommand::WorkspaceProfile => {
json!(focused_workspace_profile(profile_list.clone()))
}
};
println!("{}", sway_json);
let _: () = if monitor.unwrap_or_default() {

View file

@ -2,11 +2,8 @@ use {
crate::{
config::{Profile, WindowIcon},
lib::{
cli::SwayGetCommand,
get_scratchpad_info,
profile::{active_profile_index, profile_from_index},
windows::get_window_info,
workspaces::get_workspace_info,
cli::SwayGetCommand, get_scratchpad_info, sway::focused_workspace_profile,
windows::get_window_info, workspaces::get_workspace_info,
},
utils::SDUError,
},
@ -49,7 +46,7 @@ pub fn get_sway_info(
let window_info = get_window_info(window_icons);
let workspace_info = get_workspace_info(profile_list.clone(), kb_order);
let scratchpad_info = get_scratchpad_info();
let workspace_profile = json!(profile_from_index(profile_list, active_profile_index()));
let workspace_profile = json!(focused_workspace_profile(profile_list.clone()));
let full_info = SwayInfo {
window_info,
workspace_info,
@ -78,7 +75,9 @@ pub fn monitor_events(
SwayGetCommand::Workspaces => get_workspace_info(profile_list.clone(), kb_order),
SwayGetCommand::Full => get_sway_info(window_icons, profile_list.clone(), kb_order),
SwayGetCommand::Scratchpad => get_scratchpad_info(),
SwayGetCommand::WorkspaceProfile => todo!(),
SwayGetCommand::WorkspaceProfile => {
json!(focused_workspace_profile(profile_list.clone()))
}
},
_ => unreachable!(),
};