General cleanup
This commit is contained in:
parent
ae708d4f87
commit
57bb7bcd8d
@ -1,43 +0,0 @@
|
||||
use dbus::blocking::Connection;
|
||||
use std::time::Duration;
|
||||
|
||||
pub fn test() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// 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(())
|
||||
}
|
||||
@ -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::*;
|
||||
|
||||
@ -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());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user