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

Add --background option to run kitty on the Wayland desktop #2590

Closed
wants to merge 1 commit into from

Conversation

quantum5
Copy link

This PR adds the --background argument to kitty. When specified, the kitty window runs behind all other windows, effectively making it the desktop background. This uses the zwlr_layer_shell_v1 Wayland protocol.

This is useful for using CLI applications as the desktop wallpaper. For example, kitty --background htop can be used to show htop as the desktop background.

It can be used to create interesting effects, like running cava on the desktop to visualize music in the background:

cava

@kovidgoyal
Copy link
Owner

It's a cool idea, I really like it, however, I dont want to add unstable Wayland protocols to kitty. If and when this protocol makes it to wayland-protocols so that kitty does not need to carry around definitions of the protocol in its source code, I will be happy to merge.

@ghost
Copy link

ghost commented Apr 8, 2021

It's a cool idea, I really like it, however, I dont want to add unstable Wayland protocols to kitty. If and when this protocol makes it to wayland-protocols so that kitty does not need to carry around definitions of the protocol in its source code, I will be happy to merge.

I respect your choice,
but I'm interested in this feature.
have a nice day.

@quantum5 quantum5 force-pushed the background-layer branch 2 times, most recently from f420cd1 to ccd0a20 Compare June 16, 2021 04:47
--background-monitor can be used to specify exactly which monitor to run
kitty on.
@Dark-Kernel
Copy link

Please finish this thing, we are waiting.

@kovidgoyal
Copy link
Owner

Go ask the maintainers of wayland-protocols to merge the protocol then. I was very clear as to what conditions were required for this PR to land.

@kovidgoyal kovidgoyal closed this Jul 10, 2023
@kovidgoyal
Copy link
Owner

kovidgoyal commented Mar 25, 2024

This is now implemented in master. Tested with sway, Hyprland and kwin. Run

kitty +kitten panel --edge=background htop

to have kitty render the background. Remember to disable any bg in your sway config otherwise it hides the panel background.

@jpmhouston
Copy link

Can panel be brought to macOS? I'd like htop or btop running on my desktop.

@kovidgoyal
Copy link
Owner

No, macOS doesnt support this kind of thing as far as I know.

@jpmhouston
Copy link

jpmhouston commented Apr 13, 2024

https://stackoverflow.com/a/4982619/592739

To display above the desktop but below the desktop icons, you need to do two things:

  1. Call [window setLevel:kCGDesktopWindowLevel] to float below other application windows.
  2. Call [window orderBack:self] to layer behind the window that draws the desktop icons.

Something during app launching brings the application to the front, so you should call orderBack: in your application delegate’s applicationDidFinishLaunching: method.

@kovidgoyal
Copy link
Owner

kovidgoyal commented Apr 14, 2024 via email

@jpmhouston
Copy link

Are you sure you aren’t confusing platforms? I ask because you mention alt-tab window switching whereas of course macOS uses command-tab app switching.

I spoke with the author of the Mac app Particulars, which, in one mode, puts a transparent chromeless window of information on the desktop like it seems this feature currently does on Linux.

FWIW, in its configuration option I use, this app does remove itself from command-tab switching, although I’m not saying kitty needs to do that as, again, this OS feature switches between apps rather than windows. A running app being frontmost with no active aka key window is a-ok.

Here’s the information he sent me about how his app does this using above-board system APIs, over and above the tips in the stack overflow answer I linked to above:

You’ve correctly identified that the window’s level must be set programmatically. Before we can set the window’s level we need a window. Particulars creates the desktop window with NSWindow’s initWithContentRect:styleMask:backing:defer: with the styleMask set to NSWindowStyleMaskBorderless. As stated in the linked documentation, a window with this style mask can’t be become key (have keyboard focus) or be the main window.

Other considerations:

  • text fields or views in these windows should have selecting and editing disabled
  • the app should respond to the NSApplicationDidChangeScreenParametersNotification posted when displays change and update the window size accordingly

In any case, looking more into this kitten and how background is implemented (with no sizing or positioning on the desktop supported), I think I’ll instead search for another open source terminal app to contribute to and try to get this feature in. Thanks anyway,
sorry for hijacking this issue instead of making a new one.

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

Successfully merging this pull request may close these issues.

None yet

4 participants