Loungy icon indicating copy to clipboard operation
Loungy copied to clipboard

✨ Linux support?

Open jd-solanki opened this issue 1 year ago • 18 comments
trafficstars

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?

jd-solanki avatar Feb 08 '24 05:02 jd-solanki

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 avatar Feb 08 '24 05:02 MatthiasGrandl

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.

MatthiasGrandl avatar Feb 19 '24 12:02 MatthiasGrandl

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 avatar Feb 19 '24 18:02 sharkdp

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.

sharkdp avatar Feb 19 '24 18:02 sharkdp

@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.

MatthiasGrandl avatar Feb 19 '24 18:02 MatthiasGrandl

@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.

:+1:

sharkdp avatar Feb 19 '24 18:02 sharkdp

Any updates about Linux ver?

Partysun avatar May 10 '24 19:05 Partysun

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

MatthiasGrandl avatar May 10 '24 19:05 MatthiasGrandl

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 https://github.com/tauri-apps/global-hotkey/issues/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.

MatthiasGrandl avatar May 13 '24 12:05 MatthiasGrandl

Fixed window positioning

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

mikayla-maki avatar May 13 '24 19:05 mikayla-maki

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

Davincible avatar May 15 '24 15:05 Davincible

@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?

MatthiasGrandl avatar May 15 '24 15:05 MatthiasGrandl

Hey! 👋 I might be able to do this. I'll have a look next week.

f8thl3ss avatar May 15 '24 15:05 f8thl3ss

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

MatthiasGrandl avatar Jun 21 '24 10:06 MatthiasGrandl