ghostty icon indicating copy to clipboard operation
ghostty copied to clipboard

Add `toggle_background_opacity` keybind action

Open mitchellh opened this issue 11 months ago • 4 comments

Discussed in https://github.com/ghostty-org/ghostty/discussions/4664

Originally posted by yanskun January 5, 2025 I like to use the terminal with a transparent background. However, when sharing a screen for pair programming, etc., it seems that noise can be introduced depending on the other person, so I would like to be able to easily turn off transparency.

iTerm has a Toggle Transparency feature that allows you to switch between custom opacity and non-transparent by pressing cmd + u. https://stackoverflow.com/questions/34159559/toggle-opacity-with-hotkey-in-terminal-iterm#:~:text=cmd%20%2B%20u%20toggles%20the%20transparency.

Does Ghostty have it?

Since Alacritty doesn't seem to have this feature, I prepared a shell script to change the config directly.

If Ghostty doesn't have this feature, I'll prepare a Shell Script. However, if Ghostty has it, I'd like to use it. (If I get excited, I'd like to implement it directly in Ghostty and submit a PR.)

Proposal

Add a new keybind action toggle_background_opacity. This does nothing if background-opacity is 1+.

If background-opacity is less than 1, then this will either set the window transparent or not depending on its current state.

When reloading the config, it is acceptable that background opacity is reapplied. This will make implementing this easier.

This should be implemented for macOS, X11, and Wayland.

mitchellh avatar Jan 14 '25 05:01 mitchellh

It would be even better if the transparency adjustment could be triggered with a shortcut, because sometimes when working on a small screen, I want to see what's behind my terminal.

imkgh avatar Mar 04 '25 09:03 imkgh

Please add it, I really want it from my muscle memory :-)

yujinqiu avatar Jun 12 '25 05:06 yujinqiu

…the entire point of this Issue is to track its addition. Subscribe if you want to know when it's done (you can even choose to subscribe to specifically when it is closed; it's under “Notifications” on the sidebar → “Customize” → “Custom”).

+1

Use the 👍️ button, you're just sending all subscribers an email and using up space; the 👍️ button also makes it much easier to gauge interest (it has a number!!).

A screenshot of hovering over the 👍️ button on the Issue starter, with multiple crude arrows pointed at it.

00-kat avatar Jun 12 '25 08:06 00-kat

Introducing increase_background_opacity and decrease_background_opacity actions along with the toggle_background_opacity action would be a fantastic addition.

ShunsukeMatsuno avatar Jun 16 '25 16:06 ShunsukeMatsuno