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

background image #163

Closed
rtorresware opened this issue Nov 5, 2017 · 120 comments · Fixed by #2326
Closed

background image #163

rtorresware opened this issue Nov 5, 2017 · 120 comments · Fixed by #2326

Comments

@rtorresware
Copy link

now that we can show images in the kitty terminal (awesome), can we get support for background images?

@kovidgoyal
Copy link
Owner

Not something I care about, personally. But it should be trivial to implement. Patches welcome.

@coxley
Copy link

coxley commented Sep 15, 2018

Would love if this had a toggle for current wallpaper + dim. Only feature keeping me from kitty full time :)

@teratorn
Copy link

+1 need Fallout PipBoy-terminal background image support... going fully transparent against the desktop wallpaper results in horribly broken anti-aliasing and looks like garbage on MacOS.

(On a side note - defaulting to pure-black background hurts peoples eyes. You can't focus in to a black-hole, and you should have something for the eyes to focus on if you want to avoid eye-strain... a nice grey would be a better default, imho)

If I find time, I'll try to work on this. Are there PNG and JPG image loaders already in the codebase?

@Luflosi
Copy link
Contributor

Luflosi commented Nov 13, 2018

@teratorn #1005 describes your anti-aliasing issue.
I agree that the black background color is not very good but I'm not sure it should be changed since this is personal preference and most people will probably change it anyways and might not like a different default color any more than the current one.

@kovidgoyal
Copy link
Owner

@teratorn kitty already links against libpng and uses it for its graphics protocol. just search for the png headers to see where and how it is used. As for staring into black, I strongly disagree. I find it very relaxing for my eyes. Not to mention that monitors displaying a black color are not black holes, they still emit light.

@giftig
Copy link

giftig commented Jan 11, 2019

I've just swapped to using kitty today and I'm loving it; much better than all the other options I've tried in linux. I came here to ask for exactly this feature since I like having pokemon images in my terminal like a nerd.

If it's something you think is trivial to implement @kovidgoyal I'll gladly have a crack at it sometime soon if you can give me some vague pointers about where to be looking in your codebase to build it. I'm a python dev but not a C dev so I might scratch my head a bit if it involves much C.

@kovidgoyal
Copy link
Owner

Well, this will definitely require a fair bit of C code. You will need to load the PNG image usingthe same code that does it for kitty's exisint image display capabilities (see grahoics.c) and then display it in the kitty graphics shader in shaders.c. This will all be C code, I'm afraid.

@jason81474
Copy link

I need coins

@dagadbm
Copy link

dagadbm commented Jun 11, 2019

will this ever be done?

@disruptek
Copy link

What about an option to specify an alternate background color for inactive windows? I'd like to use less opacity on my inactive windows, to let backgrounds show through... Did I miss an option to do this?

@sukima
Copy link

sukima commented Jul 3, 2019

@disruptek that question is not related to background image. Please open a new issue so we can keep this thread focused on one specific request (all be it a pipe dream at this point).

@fenetikm
Copy link

@disruptek you can partway do that if you run inside tmux and set the colours appropriately

@miaXcova
Copy link

miaXcova commented Dec 6, 2019

I have been trying for hours to enable backgroundimage=yes in both the .ini file and using the registry. Can someone tell me how to enable this feature? If this feature is not yet available, how is the screenshot on this page possible?

@SolitudeSF
Copy link
Contributor

SolitudeSF commented Dec 6, 2019

@miaXcova this is a wrong kitty. here's the one you're looking for https://github.com/cyd01/KiTTY/

@ctrlcctrlv
Copy link
Contributor

I did a bit of looking into this, as many have asked for this feature, and while I think it's cool, I don't think it essential. But I'm happy to work on something many people want as long as it's cool—after the failure of #2259, I think it best I work on things that will actually be of the greatst practical benefit for Kitty's users.

After all, my work is supported by grant.

Obviously, as @kovidgoyal mentioned, the best way in is through the existing Kitty graphics protocol. So I dug around in graphics.c. I think actually have everything we need already, if it were to just be done with a particularly clever Python script.

The icat kitten is a good starting point. Just use IM to turn down the opacity of input image, draw it to screen (center vertically), make sure that z-index is negative, and draw your text on top. Hook screen clearing event to do this again whenever needed.

One missing ingredient I can think of is that z-index is only defined as "integer" - this is a big problem for interoperability if we want to put an image at the bottom below which no image can be drawn, because I don't know if it's a Python integer, or if it's a C integer, if a certain size is guaranteed, and the spec doesn't specify.

However, once we clear up that problem...I don't think C is really necessary...

@kovidgoyal
Copy link
Owner

You cant use the graphics protocol for this, as that means doing a clear
would delete the image. The background image has to be stored specially
not as one of the graphics protocol images.

@ctrlcctrlv
Copy link
Contributor

Hook screen clearing event to do this again whenever needed.

If it's not possible to hook this, it would need to be made so

@kovidgoyal
Copy link
Owner

kovidgoyal commented Jan 8, 2020 via email

@ctrlcctrlv
Copy link
Contributor

I don't mind :)

I guess I'll just add it to GraphicsManager struct, then allocate it as needed in grman_alloc (based on something I'll probably add to global state)...the type can be Image *...the thing is scaling, not sure how I'll do that, as the example code uses ImageMagick. And surely some users are going to want tiling and not scaling. And I also have to think about DPI

@kovidgoyal
Copy link
Owner

kovidgoyal commented Jan 8, 2020 via email

@ctrlcctrlv
Copy link
Contributor

ctrlcctrlv commented Jan 8, 2020

Clearly many people want this, so I will have a draft PR by the end of the week.

I'll let you know if I think a choice I make could be controverisal before I make it so no code is wasted.

There's a lot to consider but it's worth it! Towards making kitty the most complete terminal. alacritty, termite etc move out of the way, there's a new king in town 👑 😂

@kovidgoyal
Copy link
Owner

kovidgoyal commented Jan 8, 2020 via email

@miaXcova
Copy link

miaXcova commented Jan 8, 2020

Would this mean that this KiTTY would be a fork of the other KiTTY from a certain place in time, or do both share the same base code with minor changes?

Would the real Slim KiTTY please stand up... please stand up...

Also, to clarify what I was hoping for with a background image (image or solid color) would have been to change the opacity so that the background transparency could be controlled while the text and window frame remained at full visibility. The way transparency works now is it changes the entire window text, frame and all. It's just nice to be able to see through windows when most of the window will be black anyway. Rocking 6 monitors and still never enough screen real estate.

@ctrlcctrlv
Copy link
Contributor

We have nothing to do with the cyd01 kitty.

Background opacity isn't really on the table here. The image can be made opaque...on Kitty's default background, usually black. We'll have to figure out background opacity in another issue, this really is not the place to discuss it.

@kovidgoyal
Copy link
Owner

kovidgoyal commented Jan 8, 2020 via email

@kovidgoyal
Copy link
Owner

yes there is a remote control command to change background image.

@coxley
Copy link

coxley commented Apr 8, 2020

Sorry, little late to the party. Will portion of the image change depending on where the terminal is open on the window? To simulate "pseudo-transparency" for the wallpaper.

@kovidgoyal
Copy link
Owner

No. kitty has real transparency, use it.

@coxley
Copy link

coxley commented Apr 10, 2020

Without a compositor? Some people can't use them. :\

@kovidgoyal
Copy link
Owner

kovidgoyal commented Apr 10, 2020 via email

@ctrlcctrlv
Copy link
Contributor

The idea of scaling the image to the size of the monitor, and then having the terminal window act as a "viewport", is somewhat appealing to me. I don't think it necessarily needs to be meant to replace a compositor. If you want tips in implementing it @coxley, I can give you some

@ghost
Copy link

ghost commented May 8, 2020

When I add option background_image in my kitty.conf, but it doesn't work.
I didn't found any documentation of it on the main web site.
It does not work for me either
I did not put quotations.

@Luflosi
Copy link
Contributor

Luflosi commented May 8, 2020

Did you make sure to use a PNG image? Other formats like JPEG don't work.

@ghost
Copy link

ghost commented May 8, 2020

I did use PNG.

@ghost
Copy link

ghost commented May 8, 2020

background_image /home/AVCADO/Pictures/backgrounds/doge-space.png

This is what I have.

@Luflosi
Copy link
Contributor

Luflosi commented May 8, 2020

Did you restart kitty after changing the config? Post the output of kitty --debug-config.

@ghost
Copy link

ghost commented May 8, 2020

kitty 0.14.3 created by Kovid Goyal
Linux nickPC 5.3.0-51-generic #44-Ubuntu SMP Wed Apr 22 21:09:44 UTC 2020 x86_64
Ubuntu 19.10 \n \l
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=19.10
DISTRIB_CODENAME=eoan
DISTRIB_DESCRIPTION="Ubuntu 19.10"
Loaded config files: /etc/xdg/kitty/kitty.conf, /home/nick/.config/kitty/kitty.conf
[129 13:20:24.627499] Ignoring unknown config key: bolt_font
[129 13:20:24.627526] Ignoring unknown config key: background_image
[129 13:20:24.627539] Ignoring unknown config key: background_image_layout
Running under: X11

Config options different from defaults:
update_check_interval 0.0

@Luflosi
Copy link
Contributor

Luflosi commented May 8, 2020

Your version of kitty is too old. The background image feature was introduced in 0.17.0 and you're using 0.14.3. Either try to update your Ubuntu to a version which has a newer kitty or see https://sw.kovidgoyal.net/kitty/binary.html.

@ghost
Copy link

ghost commented May 8, 2020

The newest version is 0.14.3.

@Luflosi
Copy link
Contributor

Luflosi commented May 8, 2020

The newest version of kitty in Ubuntu eoan (19.10) is 0.14.3. In Ubuntu focal (20.04LTS) it's 0.15.0 and in Ubuntu groovy, which hasn't been released yet, it will be 0.17.3. Just uninstall kitty with apt remove kitty or so and then install the truly latest version with the instructions from https://sw.kovidgoyal.net/kitty/binary.html.

@coxley
Copy link

coxley commented May 27, 2020

The idea of scaling the image to the size of the monitor, and then having the terminal window act as a "viewport", is somewhat appealing to me. I don't think it necessarily needs to be meant to replace a compositor. If you want tips in implementing it @coxley, I can give you some

That'd be perfect, @ctrlcctrlv :)

@polypus74
Copy link

That'd be perfect, @ctrlcctrlv :)

I second this. I can use a comp manager but don't want to. I much prefer pseudo-transparency a-la urxvt for both performance and aesthetic reasons.

@Elysium1436
Copy link

Is there a way to clamp the background and center the image?

@page-down
Copy link
Contributor

@Elysium1436

In the nightly version (master branch), you can use the following configuration.

background_image_layout clamped
background_image_anchor center

@rsmath
Copy link

rsmath commented May 6, 2022

Is this feature released into the main download release yet?

@Arrow-x
Copy link

Arrow-x commented May 9, 2022

@ramanshsharma2806 yes
question, can you change the background on the fly?? with a command?
nvm it can with remote.
Adding allow_remote_control yes to the kitty config and running kitty @ set-background-image path/to/png

@rsmath
Copy link

rsmath commented May 9, 2022

Thank you for the reply @Arrow-x. Can I change this permanently in the kitty.conf file? If so, how?
I appreciate the help.

@kovidgoyal
Copy link
Owner

kovidgoyal commented May 9, 2022 via email

@rsmath
Copy link

rsmath commented May 9, 2022

Thank you.
I believe remote control commands can also be set in the kitty.conf file to run at startup?

@Arrow-x
Copy link

Arrow-x commented May 9, 2022

@ramanshsharma2806
yes it's under #: Color scheme in kitty.conf
background_image path/to/png

@stechermichal
Copy link

@Elysium1436

In the nightly version (master branch), you can use the following configuration.

background_image_layout clamped
background_image_anchor center

Was anchor never implemented after all? As of right now it seems like moving the image while in clamped layout is impossible.

@page-down
Copy link
Contributor

@stechermichal

Was anchor never implemented after all? ...

There was a PR for this feature that was merged and later reverted.

The background image can be centered (clamped) with the nightly release.
#5525

background_image_layout centered

@kovidgoyal
#4167 (comment)

I decided to implement per window logos instead. ...

Do you think this configuration option background_image_anchor proposed by the PR 4167 should be reinstated again?
Obviously the window logo is not applied in the OS window background and cannot serve as a substitute for the background image.

I think it makes sense to allow tiled images to be centered.

background_image_layout tiled
background_image_anchor center

Tiled centered

Also the background image can be centered at the bottom with background_image_anchor, instead of adding a value like bottom-centered-clamped.
A cute kitten centered at the bottom

@kovidgoyal
Copy link
Owner

I'm not a fan of another option for this. Just add keywords tiled-centered, north, south, east, west, north-east, north-west, etc to background_image_layout. I will accept a PR that does that

@stechermichal
Copy link

I'm not a fan of another option for this. Just add keywords tiled-centered, north, south, east, west, north-east, north-west, etc to background_image_layout. I will accept a PR that does that

aha, having looked into it more I can see why you went with window logo. That together with what's in the nightly build right now should cover most situations.

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

Successfully merging a pull request may close this issue.