Function rustwlc::init [] [src]

pub fn init() -> Option<fn()>

Initialize wlc's callbacks and logger with a WlcInterface.

Deprecated

wlc has deprecated this callback interface. They offer a new API with a series of methods found in the callback module

To initialize wlc, register your callbacks with the functions described in the callbacks module, and the logger using log_set_handler or log_set_default_handler. Then call init2().

Permissions

If a compositor is initialized from the tty using suid or logind, it will drop extra permissions after a call to init() or init2(). It is strongly recommended to delay code which is not registering callbacks until after this call.

wlc Example

use rustwlc;
use rustwlc::callback;
use rustwlc::WlcView;

// An example callback function
// See the various functions in the callback module for more information
extern "C" fn view_focus_callback(view: WlcView, focused: bool) {
    println!("A view came into focus!");
}

// Set a default log callback
rustwlc::log_set_default_handler();

// Register some callbacks
callback::view_focus(view_focus_callback);
// ... and additional callbacks

// The only thing your code should do before init2 is register callbacks
// and log handlers.
let run_wlc = rustwlc::init()
    .expect("Unable to initialize wlc!");

run_wlc();