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

✨ Linux support? #7

Open
jd-solanki opened this issue Feb 8, 2024 · 18 comments
Open

✨ Linux support? #7

jd-solanki opened this issue Feb 8, 2024 · 18 comments

Comments

@jd-solanki
Copy link

Hi πŸ‘‹πŸ»

I loved your efforts towards this project I also wanted to build something like this but for cross-platform and mostly for linux as well. I use python mostly but python don't have great GUI framework I like so just was checking out few stuff and noticed rust implementation.

Do you have plan to add linux support?

@MatthiasGrandl
Copy link
Owner

100% I would love to add Linux support. It is still quite far out since GPUI (the UI framework) lacks cross platform support. It is however WIP and should land according to the devs before EoY. That gives me sometime to mature this project and prepare Linux support as well. Currently basic things like listing apps is built exclusively around MacOS.

MatthiasGrandl added a commit that referenced this issue Feb 16, 2024
@MatthiasGrandl
Copy link
Owner

The first couple of steps are done. It compiles for Linux and there is a very basic app launcher using gtk-launch .

It’s not very pretty yet and the GPUI linux support is in very early stages, so the window will always appear in the top left corner and there is no way to hide it yet, but to be honest I am impressed with how easy it was to even get to this point.

@sharkdp
Copy link

sharkdp commented Feb 19, 2024

I was curious to try it, but it fails with the following error(s) at the moment. I know you said it's early progress, so please don't feel the need to respond to this comment.

[2024-02-19T17:56:27Z ERROR loungy::theme] Failed to read themes: No such file or directory (os error 2)
thread 'main' panicked at /home/shark/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/e9d93a4/blade-graphics/src/vulkan/init.rs:281:55:
called `Result::unwrap()` on an `Err` value: ERROR_LAYER_NOT_PRESENT
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1073:23
   4: blade_graphics::hal::init::<impl blade_graphics::hal::Context>::init_impl
             at /home/shark/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/e9d93a4/blade-graphics/src/vulkan/init.rs:281:13
   5: blade_graphics::hal::init::<impl blade_graphics::hal::Context>::init_windowed
             at /home/shark/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/e9d93a4/blade-graphics/src/vulkan/init.rs:562:9
   6: gpui::platform::linux::x11::window::X11WindowState::new
             at /home/shark/.cargo/git/checkouts/zed-23861290b5d2093f/2b56c43/crates/gpui/src/platform/linux/x11/window.rs:241:17
   7: <gpui::platform::linux::x11::client::X11Client as gpui::platform::linux::client::Client>::open_window
             at /home/shark/.cargo/git/checkouts/zed-23861290b5d2093f/2b56c43/crates/gpui/src/platform/linux/x11/client.rs:234:34
   8: <gpui::platform::linux::platform::LinuxPlatform as gpui::platform::Platform>::open_window
             at /home/shark/.cargo/git/checkouts/zed-23861290b5d2093f/2b56c43/crates/gpui/src/platform/linux/platform.rs:214:9
   9: gpui::window::Window::new
             at /home/shark/.cargo/git/checkouts/zed-23861290b5d2093f/2b56c43/crates/gpui/src/window.rs:329:31
  10: gpui::app::AppContext::open_window::{{closure}}
             at /home/shark/.cargo/git/checkouts/zed-23861290b5d2093f/2b56c43/crates/gpui/src/app.rs:492:30
  11: gpui::app::AppContext::update
             at /home/shark/.cargo/git/checkouts/zed-23861290b5d2093f/2b56c43/crates/gpui/src/app.rs:357:22
  12: gpui::app::AppContext::open_window
             at /home/shark/.cargo/git/checkouts/zed-23861290b5d2093f/2b56c43/crates/gpui/src/app.rs:489:9
  13: loungy::app::run_app::{{closure}}
             at ./src/app.rs:27:9
  14: gpui::app::App::run::{{closure}}
             at /home/shark/.cargo/git/checkouts/zed-23861290b5d2093f/2b56c43/crates/gpui/src/app.rs:145:13
  15: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5
  16: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/boxed.rs:2015:9
  17: <gpui::platform::linux::x11::client::X11Client as gpui::platform::linux::client::Client>::run
             at /home/shark/.cargo/git/checkouts/zed-23861290b5d2093f/2b56c43/crates/gpui/src/platform/linux/x11/client.rs:68:9
  18: <gpui::platform::linux::platform::LinuxPlatform as gpui::platform::Platform>::run
             at /home/shark/.cargo/git/checkouts/zed-23861290b5d2093f/2b56c43/crates/gpui/src/platform/linux/platform.rs:174:9
  19: gpui::app::App::run
             at /home/shark/.cargo/git/checkouts/zed-23861290b5d2093f/2b56c43/crates/gpui/src/app.rs:143:9
  20: loungy::app::run_app
             at ./src/app.rs:15:5
  21: loungy::main
             at ./src/main.rs:22:5
  22: core::ops::function::FnOnce::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@sharkdp
Copy link

sharkdp commented Feb 19, 2024

It works in release mode. It looks fine, but I can't interact with it (keyboard/mouse). Still shows the "Failed to read themes" message. When I try to resize the window, it crashes with

thread 'main' panicked at /home/shark/.cargo/git/checkouts/blade-b2bcd1de1cf7ab6a/e9d93a4/blade-graphics/src/vulkan/init.rs:721:18:
called `Result::unwrap()` on an `Err` value: ERROR_OUT_OF_DATE_KHR
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5
   3: blade_graphics::hal::init::<impl blade_graphics::hal::Context>::acquire_frame
   4: gpui::platform::blade::blade_renderer::BladeRenderer::draw
   5: <gpui::platform::linux::x11::window::X11Window as gpui::platform::PlatformWindow>::draw
   6: gpui::window::AnyWindowHandle::update
   7: util::measure
   8: gpui::window::Window::new::{{closure}}
   9: <gpui::platform::linux::x11::client::X11Client as gpui::platform::linux::client::Client>::run
  10: gpui::app::App::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@MatthiasGrandl
Copy link
Owner

@sharkdp you are on x11 right? I noticed i can only interact with it on wayland for now. For the first error you need Vulkan Validation Layer installed otherwise it crashes like this.

anyway I am in contact with the guys doing the GPUI Linux port and they are aware of all the issues. That’s mostly the reason why I did this early Linux work, so they have something other than Zed to test.

@sharkdp
Copy link

sharkdp commented Feb 19, 2024

@sharkdp you are on x11 right? I noticed i can only interact with it on wayland for now.

yes. I see

anyway I am in contact with the guys doing the GPUI Linux port and they are aware of all the issues. That’s mostly the reason why I did this early Linux work, so they have something other than Zed to test.

πŸ‘

@Partysun
Copy link

Any updates about Linux ver?

@MatthiasGrandl
Copy link
Owner

Still pretty limited. Some necessary APIs for Loungy are still not supported in Linux GPUI. For example hiding of the window.

@MatthiasGrandl
Copy link
Owner

Just checked again...

Stuff that's not working upstream GPUI:

  • Fixed window positioning
  • X11 Gnome has unwanted window decorations, Wayland Gnome doesn't...
  • X11 Gnome is resizable (unwanted), Wayland Gnome only shows unwanted resize indicators
  • Window is not hidable

Issues in Loungy codebase:

  • Most of the features in /src/platform/mac.rs need to be ported for some features like clipboard manager to work.
  • Hotkeys aren't working in Wayland due to Global Shortcut support on WaylandΒ tauri-apps/global-hotkey#28 . I am considering adding an alternative approach to hotkeys, so that you can instead use your system hotkey manager with loungy cli commands. I.e you bind Super+V to execute loungy clipboard, which then opens the Loungy clipboard manager.

@mikayla-maki
Copy link

Fixed window positioning

Unfortunately, I'm sure if this is even possible on Wayland.

@Davincible
Copy link

I am considering adding an alternative approach to hotkeys

Vouching for this one.

One extra request, can you package it as well in your flake.nix, so its easy to install on NixOS

@MatthiasGrandl
Copy link
Owner

@Davincible sadly I have 0 clue about nix. The existing flake/nix stuff if from @f8thl3ss , so maybe they are interested in adding proper nix packaging?

@f8thl3ss
Copy link
Contributor

f8thl3ss commented May 15, 2024

Hey! πŸ‘‹
I might be able to do this. I'll have a look next week.

@MatthiasGrandl
Copy link
Owner

I am considering adding an alternative approach to hotkeys, so that you can instead use your system hotkey manager with loungy cli commands. I.e you bind Super+V to execute loungy clipboard, which then opens the Loungy clipboard manager.

Rough early CLI has been implemented. So you can now control Loungy via CLI:

Loungy is a WIP launcher in the vein of Raycast and Alfred.

Usage: loungy <Action> [Command]

Arguments:
  <Action>   [possible values: toggle, show, hide, quit, command]
  [Command]  [possible values: theme, clipboard, menu, bitwarden, tailscale, root, matrix, process]

Options:
  -h, --help     Print help
  -V, --version  Print version

Usage:

loungy command clipboard

@bbb651
Copy link

bbb651 commented Aug 30, 2024

  • Fixed window positioning

The proper way to solve this on wayland would be to use wlr-layer-shell instead of xdg-shell for the toplevel, which let's you set anchors relative to screen edges, and center it by specifying no anchors. You can also set a the layer which will place it over other toplevels, I think top is the correct one for a launcher. Also keep in mind you'll need to keep the normal window as a fallback for gnome because they don't support the protocol, you can instruct users to turn on center-new-windows with gsettings set org.gnome.mutter center-new-windows true (see this issue) which will at least solve the centering problem.

@MatthiasGrandl
Copy link
Owner

@bbb651 indeed I stumbled across this while evaluating switching to Iced. There is already a maintained extension for Iced to make use of wlr-layer-shell, which looks pretty easy to use.

@bbb651
Copy link

bbb651 commented Aug 31, 2024

@MatthiasGrandl You might wanna look at Gauntlet and cosmic-launcher for reference and evaluation, they are both launchers based on iced with different goals and experience. The extension you're talking about is the pop-os iced fork right? They have an iced_sctk backend with layer-shell support (winit doesn't support it), do keep in mind they are currently rebasing from a fairly old version so I would recommend prototyping with iced master. While looking at the winit issue I found another crate very recently created also for iced layer-shell, unlike the pop-os fork I've never used it myself so I can't say anything about it.

@MatthiasGrandl
Copy link
Owner

Jup I am on Iced master and yes I was talking about this https://github.com/waycrate/exwlshelleventloop . Gauntlet looks cool, didn't see that one yet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants