Skip to content

Commit

Permalink
init: store true if daemon is already started
Browse files Browse the repository at this point in the history
  • Loading branch information
DashieTM committed Jun 12, 2024
1 parent 0b12d95 commit e7c0995
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ A window manager/compositor agnostic settings application for Linux written in r
ReSet features a plugin system by loading dynamic libraries for both the daemon and the ReSet graphical user interface.
A list of official plugins, installation guides and their documentation can be found at [ReSet-Plugins](https://github.com/Xetibo/ReSet-Plugins).

### Installation

Plugins are loaded either from `/usr/lib/reset` or `~/.config/reset/plugins`. In order to install the plugin, either install a distribution specific package that places the library into the specified system folder, or place the library in the plugins folder in your config directory.

Note, after installation, please move to confirmation.

### Confirmation

In order for your plugins to load, you have to define them in `.config/reset/ReSet.toml`.
Expand Down
10 changes: 10 additions & 0 deletions src/components/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ use glib::prelude::Cast;
use glib::Object;
use gtk::prelude::{GObjectPropertyExpressionExt, ListBoxRowExt, ListItemExt, WidgetExt};
use gtk::{Align, SignalListItemFactory, StringObject};
use re_set_lib::ERROR;
#[cfg(debug_assertions)]
use re_set_lib::{utils::macros::ErrorLevel, write_log_to_file};

pub const DBUS_PATH: &str = "/org/Xetibo/ReSet/Daemon";
pub const WIRELESS: &str = "org.Xetibo.ReSet.Network";
Expand Down Expand Up @@ -93,5 +96,12 @@ pub fn get_capabilities() -> Vec<String> {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(BASE, DBUS_PATH, Duration::from_millis(10000));
let res: Result<(Vec<String>,), Error> = proxy.method_call(BASE, "GetCapabilities", ());
if res.is_err() {
ERROR!(
"Could not call capabilities from daemon",
ErrorLevel::Critical
);
return Vec::new();
}
res.unwrap().0
}
4 changes: 3 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::hint::{self};
use std::sync::atomic::AtomicBool;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::thread;
use std::time::Duration;
Expand Down Expand Up @@ -81,5 +81,7 @@ async fn daemon_check(ready: Arc<AtomicBool>) {
let res = handle.join();
if res.unwrap().is_err() {
run_daemon(Some(ready)).await;
} else {
ready.store(true, Ordering::SeqCst);
}
}

0 comments on commit e7c0995

Please sign in to comment.