server: Make optional

This commit is contained in:
Kenny Levinsen
2023-11-10 15:22:37 +01:00
parent c169843bcb
commit 7ee58d8d68
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -81,7 +81,7 @@ pub struct Config {
pub widget: Widget, pub widget: Widget,
pub mode: OperationMode, pub mode: OperationMode,
pub background: Option<u32>, pub background: Option<u32>,
pub server: bool, pub server: Option<bool>,
} }
impl Config { impl Config {
@@ -162,7 +162,7 @@ impl Config {
widget: widget, widget: widget,
mode: OperationMode::LayerSurface((1024, 768)), mode: OperationMode::LayerSurface((1024, 768)),
background: Some(0xFAFAFAFA), background: Some(0xFAFAFAFA),
server: false, server: None,
} }
} }
@@ -255,7 +255,7 @@ impl Config {
OperationMode::LayerSurface((1024, 1)) OperationMode::LayerSurface((1024, 1))
}, },
background: Some(0xFAFAFAFA), background: Some(0xFAFAFAFA),
server: false, server: None,
} }
} }
} }
+1 -1
View File
@@ -155,7 +155,7 @@ fn main() {
Err(_) => panic!("configuration file missing"), Err(_) => panic!("configuration file missing"),
}; };
if config.server { if let Some(true) = config.server {
if let Ok(mut socket) = UnixStream::connect(socket_path.clone()) { if let Ok(mut socket) = UnixStream::connect(socket_path.clone()) {
socket.write_all(b"kill\n").unwrap(); socket.write_all(b"kill\n").unwrap();
return; return;