mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 05:41:16 +01:00
feat(cli): implement generate-static-config cmd
This commit is contained in:
1 parent
c59e882a2d
commit
8f36549fae
4 files changed
+17
-4
No files matched your search
@@ -406,7 +406,7 @@ pub enum SocketMessage {
|
||||
NotificationSchema,
|
||||
SocketSchema,
|
||||
StaticConfigSchema,
|
||||
// GenerateStaticConfig,
|
||||
GenerateStaticConfig,
|
||||
// DebugWindow(isize),
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ use crate::monitor::MonitorInformation;
|
||||
use crate::notify_subscribers;
|
||||
use crate::state::GlobalState;
|
||||
use crate::state::State;
|
||||
use crate::static_config::StaticConfig;
|
||||
use crate::window::AdhocWindow;
|
||||
use crate::window_manager::WindowManager;
|
||||
use crate::workspace::WorkspaceLayer;
|
||||
@@ -1533,6 +1534,11 @@ impl WindowManager {
|
||||
SocketMessage::StopIgnoreRestore => {
|
||||
self.stop(true)?;
|
||||
}
|
||||
SocketMessage::GenerateStaticConfig => {
|
||||
let config = serde_json::to_string_pretty(&StaticConfig::from(&*self))?;
|
||||
|
||||
reply.write_all(config.as_bytes())?;
|
||||
}
|
||||
}
|
||||
|
||||
notify_subscribers(
|
||||
|
||||
@@ -258,7 +258,11 @@ impl From<&Workspace> for WorkspaceConfig {
|
||||
work_area_offset: value.work_area_offset,
|
||||
apply_window_based_work_area_offset: Some(value.apply_window_based_work_area_offset),
|
||||
window_container_behaviour: value.window_container_behaviour,
|
||||
window_container_behaviour_rules: Option::from(window_container_behaviour_rules),
|
||||
window_container_behaviour_rules: if window_container_behaviour_rules.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(window_container_behaviour_rules)
|
||||
},
|
||||
float_override: value.float_override,
|
||||
tile,
|
||||
layout_flip: value.layout_flip,
|
||||
|
||||
@@ -1098,8 +1098,8 @@ enum SubCommand {
|
||||
SocketSchema,
|
||||
/// Generate a JSON Schema of the static configuration file
|
||||
StaticConfigSchema,
|
||||
// /// Generates a static configuration JSON file based on the current window manager state
|
||||
// GenerateStaticConfig,
|
||||
/// Generates a static configuration JSON file based on the current window manager state
|
||||
GenerateStaticConfig,
|
||||
// /// Generates the komorebi.lnk shortcut in shell:startup to autostart komorebi
|
||||
// EnableAutostart(EnableAutostart),
|
||||
// /// Deletes the komorebi.lnk shortcut in shell:startup to disable autostart
|
||||
@@ -1773,6 +1773,9 @@ fn main() -> eyre::Result<()> {
|
||||
SubCommand::UnsubscribeSocket(arg) => {
|
||||
send_message(&SocketMessage::RemoveSubscriberSocket(arg.socket))?;
|
||||
}
|
||||
SubCommand::GenerateStaticConfig => {
|
||||
print_query(&SocketMessage::GenerateStaticConfig);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in new issue
Block a user