Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git
Fix: session-scope ccec state and default tag layouts to Cascade to align with layout page
src/restart.rs | 3 ++-
src/state.rs | 16 +++++++++++-----
src/types.rs | 2 +-
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/restart.rs b/src/restart.rs
index af84cc5..ca1f11d 100644
--- a/src/restart.rs
+++ b/src/restart.rs
@@ -200,7 +200,8 @@ pub fn wm_reload(state: &mut WindowManager) {
}
// Clear per-tag layout defaults
- state.has_tag_layout = [false; crate::types::NUM_TAGS];
+ state.tag_layouts = [crate::types::TilingMode::Cascade; crate::types::NUM_TAGS];
+ state.has_tag_layout = [true; crate::types::NUM_TAGS];
// Mark status for update after reload
state.needs_status_update = true;
diff --git a/src/state.rs b/src/state.rs
index 978d4ce..8e41a94 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -23,11 +23,17 @@ use std::path::PathBuf;
/// Get the state file path: ~/.cache/ccec_state
fn state_file_path() -> PathBuf {
- let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".to_string());
- let mut path = PathBuf::from(home);
- path.push(".cache");
- path.push("ccec_state");
- path
+ if let Ok(runtime_dir) = std::env::var("XDG_RUNTIME_DIR") {
+ let mut path = PathBuf::from(runtime_dir);
+ path.push("ccec_state");
+ path
+ } else {
+ let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".to_string());
+ let mut path = PathBuf::from(home);
+ path.push(".cache");
+ path.push("ccec_state");
+ path
+ }
}
/// Persistent state snapshot (plain-text, line-oriented).
diff --git a/src/types.rs b/src/types.rs
index 587a606..b906622 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -378,7 +378,7 @@ impl Default for WindowManager {
exit_requested: false,
global_layout: TilingMode::Cascade,
tag_layouts: [TilingMode::Cascade; NUM_TAGS],
- has_tag_layout: [false; NUM_TAGS],
+ has_tag_layout: [true; NUM_TAGS],
input_devices: Vec::new(),
env_vars: HashMap::new(),
pending_startup_apps: Vec::new(),