Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override redirect Option for window configuration #6482

Open
aadi58002 opened this issue Mar 17, 2023 · 3 comments
Open

Override redirect Option for window configuration #6482

aadi58002 opened this issue Mar 17, 2023 · 3 comments

Comments

@aadi58002
Copy link

aadi58002 commented Mar 17, 2023

Describe the problem

Support for forcing position and size outside the context of window manager

Applications like rofi / dmenu / launcy / alfred / wox, etc uses something called as override-redirect to make them appear at the middle (or some specific location) on the screen bypassing the interference of the window-manager and other utilities.

(PS: We can also start rofi as normal window with rofi -normal-window to see the difference)

It allows them to draw custom popup menu anywhere on the screen, including on tiling window managers, on their own decision.

It is very useful for applications including:

App Launchers
File Searchers
Quick Workspace Navigation
Clipboard Management
Quick Calculator
Quick Access to Song Selector / Controller (as popup), etc.

Is there support for this in tauri already, or can there be support for this? I would like to make a few applications on this purpose, and finding it difficult to find a good fit framework instead of going system-specific library for each platform...

-> Original issue -> slint-ui/slint#2289

Describe the solution you'd like

I read the https://tauri.app/v1/api/config#windowconfig Window config docs for tauri and there was no parameter which can bring the window outside of the window manager context

Alternatives considered

Some way to force position and size of the window outside the context of a window manager across platforms.

Additional context

No response

@FabianLars
Copy link
Member

I think you should be able to use gtk's method https://docs.gtk.org/gdk3/method.Window.set_override_redirect.html for this in Rust. Something like this maybe

use tauri::Manager;
use gtk::prelude::WidgetExt;

fn main() {

tauri::Builder::default()
.setup(|app| {
  let window = app.get_window("main").unwrap();
  let gtk_window = window.gtk_window()?;
  if let Some(gdk_window) = gtk_window.window() {
    gdk_window.set_override_redirect(true);
  }
  Ok(())
})
.run(tauri::generate_context!())
.unwrap();

}

Well, at least i hope so, i don't have access to a linux machine over the weekend so i can't check 😅

If it doesn't work, tauri's Window object also as a raw_window_handle method to get that kind of handle which was mentioned in the slint issue.

@aadi58002
Copy link
Author

I think you should be able to use gtk's method https://docs.gtk.org/gdk3/method.Window.set_override_redirect.html for this in Rust. Something like this maybe

use tauri::Manager;
use gtk::prelude::WidgetExt;

fn main() {

tauri::Builder::default()
.setup(|app| {
  let window = app.get_window("main").unwrap();
  let gtk_window = window.gtk_window()?;
  if let Some(gdk_window) = gtk_window.window() {
    gdk_window.set_override_redirect(true);
  }
  Ok(())
})
.run(tauri::generate_context!())
.unwrap();

}

Well, at least i hope so, i don't have access to a linux machine over the weekend so i can't check sweat_smile

If it doesn't work, tauri's Window object also as a raw_window_handle method to get that kind of handle which was mentioned in the slint issue.

This does not seem to work.
I tried it with below environment and just vanilla project.

Environment
  › OS: Arch Linux Unknown X64
  › Node.js: 19.8.1
  › npm: 8.19.2
  › pnpm: 7.30.0
  › yarn: 1.22.19
  › rustup: 1.25.2
  › rustc: 1.70.0-nightly
  › cargo: 1.70.0-nightly
  › Rust toolchain: nightly-x86_64-unknown-linux-gnu 

Packages
WARNING: no lock files found, defaulting to npm
  › @tauri-apps/cli [NPM]: 1.2.2 (outdated, latest: 1.2.3)
  › @tauri-apps/api [NPM]: Not installed!
  › tauri [RUST]: 1.2.4,
  › tauri-build [RUST]: 1.2.1,
  › tao [RUST]: 0.15.8,
  › wry [RUST]: 0.23.4,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../src
  › devPath: ../src
package.json not found

App directory structure
  ├─ src-tauri
  ├─ .vscode
  └─ src

@bjarnekniebel
Copy link

afaik x11 window managers check override redirect when creating a window. So you'd need to set it before the window is drawn to the screen.

@github-project-automation github-project-automation bot moved this to 📬Proposal in Roadmap Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📬Proposal
Development

No branches or pull requests

3 participants