diff --git a/src/handlers/dbus.rs b/src/handlers/dbus.rs deleted file mode 100644 index ab4dc30..0000000 --- a/src/handlers/dbus.rs +++ /dev/null @@ -1,43 +0,0 @@ -use dbus::blocking::Connection; -use std::time::Duration; - -pub fn test() -> Result<(), Box> { - // First open up a connection to the session bus - let conn = Connection::new_session()?; - - // Second, create a wrapper struct around the connection that makes it easy - // to send method calls to a specific destination and path. - let proxy = conn.with_proxy( - "org.kde.plasmashell", - "/PlasmaShell", - Duration::from_millis(5000), - ); - - use dbus_s::OrgKdePlasmaShell; - // Now make the method call. The ListNames method call takes zero input parameters and - // one output parameter which is an array of strings - // Therefore the input is a zero tuple "()", and the output is a single tuple "(names, )" - - let test = " - var allDesktops = desktops(); - allDesktops[0].wallpaperPlugin = 'org.kde.image'; - allDesktops[0].currentConfigGroup = Array('Wallpaper', 'org.kde.image', 'General'); - allDesktops[0].writeConfig('Image', 'file:///home/ben/Pictures/wallpaper-ultra/wallhaven-pkj7gm.png');w - allDesktops[1].wallpaperPlugin = 'org.kde.image'; - allDesktops[1].currentConfigGroup = Array('Wallpaper', 'org.kde.image', 'General'); - allDesktops[1].writeConfig('Image', 'file:///home/ben/Pictures/wallpaper-hor/papes/1490136858978.jpg'); - "; - - proxy.evaluate_script(test); - - // let (_, error): (String, dbus::Error) = proxy - // .method_call("org.kde.PlasmaShell", "evaluateScript", (test,)) - // .unwrap(); - - // Let's print all the names to stdout - // for name in names { - // println!("{}", name); - // } - - Ok(()) -} diff --git a/src/handlers/dbus_s.rs b/src/handlers/dbus_plasma_interface.rs similarity index 100% rename from src/handlers/dbus_s.rs rename to src/handlers/dbus_plasma_interface.rs diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index a408d83..880d104 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -1,4 +1,4 @@ -pub mod dbus_s; -use dbus_s::*; +pub mod dbus_plasma_interface; +use dbus_plasma_interface::*; pub mod plasma; use plasma::*; diff --git a/src/handlers/plasma.rs b/src/handlers/plasma.rs index ad34944..461da74 100644 --- a/src/handlers/plasma.rs +++ b/src/handlers/plasma.rs @@ -1,5 +1,5 @@ use crate::config::Monitors; -use crate::handlers::dbus_s; +use crate::handlers::dbus_plasma_interface; use crate::Wallpapers; use dbus::blocking::Connection; @@ -18,7 +18,7 @@ pub fn change_wallpapers(wallpapers: &Wallpapers) { Duration::from_millis(5000), ); - use dbus_s::OrgKdePlasmaShell; + use dbus_plasma_interface::OrgKdePlasmaShell; let javascript = generate_js(wallpapers); let resp = proxy.evaluate_script(javascript.as_ref());