Skip to content

More options for querying and changing opacity #7804

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smason
Copy link

@smason smason commented Nov 2, 2023

Similar to #7173 I wanted a nicer way to get control over opacity of windows. These changes makes it easy to get the opacity of the current window, e.g., via:

swaymsg -r opacity get

as well as providing more options for altering it via mul and div subcommands, e.g.,:

swaymsg opacity mul 1.25
swaymsg opacity div 1.25

As per the commit message, human senses tend to work on a log-scale; hence multiplicative changes like this tend to feel smoother than linear changes (i.e. via the existing plus and minus).

This change doesn't expose the opacity in the get_tree output as I didn't need it, but could likely add that in if somebody cares about it.

Allow the opacity command to return the current opacity, as per swaywm#7173,
e.g.:
  swaymsg -r opacity get
and make multiplicative changes easy, e.g.:
  swaymsg opacity mul 1.25
  swaymsg opacity div 1.25

Multiplicative options are due to human senses tending to work on a
log-scale, e.g. sound is measured with decibels.
@emersion
Copy link
Member

emersion commented Nov 5, 2023

I don't think we'd want more commands to mutate the opacity. These div/mult operations can easily be done by the IPC client, e.g. in a shell.

I don't think a global "get opacity" command is the way to go. Returning the opacity in the get_tree response would probably make more sense.

All that said not sure we want to expand the opacity stuff at all. It doesn't work with sub-surfaces correctly so maybe we will axe it in a future release.

@smason
Copy link
Author

smason commented Nov 5, 2023

All that said not sure we want to expand the opacity stuff at all. It doesn't work with sub-surfaces correctly

What's wrong with this? Is this why, e.g., menus in firefox become transparent when the whole window does?

so maybe we will axe it in a future release.

Meh, no great preference. I did this because I thought it might me nice to have a transparent video player running over my text-editor in the background and got a bit carried away while configuring. After using it a bit have decided that it doesn't look very good anyway! Ah well, interesting seeing more of the insides of Sway.

@emersion emersion added enhancement New feature or incremental improvement window-management Configuring and arranging toplevels labels Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or incremental improvement window-management Configuring and arranging toplevels
Development

Successfully merging this pull request may close these issues.

2 participants