Skip to content

How to implement a hotkey to toggle background opacity #6691

Closed
@ackerr

Description

@ackerr

I find some options to change background opacity, but it need two different hotkey to implement toggle

map super+u           set_background_opacity 1
map super+shift+u set_background_opacity default

In wezterm, i can write a lua function implement it

wezterm.on("toggle-opacity", function(window, _)
  local overrides = window:get_config_overrides() or {}
  if not overrides.window_background_opacity then
    overrides.window_background_opacity = 0.8
    overrides.text_background_opacity = 0.8
  else
    overrides.window_background_opacity = nil
    overrides.text_background_opacity = nil
  end
  window:set_config_overrides(overrides)
end)

Although I have found a way to implement custom scripts with kitten, but I am not familiar with the APIs inside and don't know where to start.

Can you give some hints?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions