Accessing mutter libraries #1679
-
I'm messing around with creating a drop down window using this library. I'd like to be able to move the window a fixed position on screen, from what I can see in the gnome shell extensions for drop-down terminals and tiling extensions they all use a mutter function
// build.rs
use std::{env, path::PathBuf};
fn main() {
let mutter = pkg_config::probe_library("libmutter-13").unwrap();
let bindings = bindgen::Builder::default()
.header("src/mutter/wrapper.h")
.clang_args(mutter.include_paths.iter().map(|path| format!("-I{}", path.to_string_lossy())))
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings");
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
First of all, This has nothing to do with gtk4-rs. Secondly, libmutter is meant to be used from the compositor (Shell extensions are run by GNOME Shell, which is a compositor built with libmutter) and not by the apps themselves. So what are you trying to achieve would be the proper question to ask. |
Beta Was this translation helpful? Give feedback.
I see, well when people say this has to be done by the compositor, it doesn't mean the app should use the compositor library for that. Things will break pretty badly imho.
That basically means, the application cannot control their position at all. You should ship a GNOME Shell extension alongside the app if you want such behaviour (and it will only work in GNOME Shell obviously)
For the window size, just set the default-width/default-height of your window.