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

differentiate (un)focused windows + smart_shadow #139

Open
litoj opened this issue Mar 28, 2023 · 2 comments
Open

differentiate (un)focused windows + smart_shadow #139

litoj opened this issue Mar 28, 2023 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@litoj
Copy link

litoj commented Mar 28, 2023

Just as we have different colors for border, it would be nice if the colors settings could be expanded to shadows too, possibly like:

set $... #color
client.focused          $border $bg $text $indicator $child_border $shadow
client.focused_inactive $border $bg $text $indicator $child_border $shadow
client.unfocused        $border $bg $text $indicator $child_border $shadow

Maybe a toggle for the shadow/saturation altogether with focused windows, something like:

#       focused inactive unfocused
shadows on/off  on/off   on/off
saturation 0-2  0-2      0-2

And lastly an option to disable shadows, when there is only one window (if no gaps or smart_gaps is set, then the shadow has nowhere to display, aside of over the statusbar (which is probably unwanted by the user)). This could be implicit (toggle with smart_gaps) or explicit: smart_shadows on/off

These are just ideas, it is currently already possible using swayipc, I made a simple script for this functionality:

#!/usr/bin/bash

declare -i last=0
declare -a line
while read -ra line; do
	if [[ ${line[2]} == '"focus",' ]]; then # line[1]="change":
		swaymsg "[con_id=$last]" shadows off
		swaymsg "[con_id=$last"' app_id="^(?!firefox|mpv).*$"]' saturation set 0.8
		last=${line[6]%,} # line[5]="id":
		# line[32]="width": line[34]="height":
		(( ${line[33]%,} >= 2550 && ${line[35]%,} >= 1560 )) ||
			swaymsg "[con_id=$last]" shadows on 1
		# [[ ${line[12]} == '1.0,' ]] line[11]="percent":

		swaymsg "[con_id=$last]" saturation set 1
	fi
done < <(swaymsg -t subscribe -m "['window']")

Edit:

BTW the forementioned script doesn't work perfectly, since 100% windows are all windows that have changed tiling mode for the next window. I fixed that with detecting their size. Still, both have the problem that when closing a second-to-last window, the last will be focused but resized after the event, meaning it reports size < screen size so it has enabled shadows even though it shouldn't.

When trying to detect floating mode change (resizing happend) it works with getting into floating mode, but the size and percent is completely messed up when going back to tiling mode.
I don't know why, but it reports window size 2526x1542 when it tiles as the only window on tiled workspace, but full screen res (without statusbar) 2560x1576 when other tiled windows are present.

@litoj litoj added the enhancement New feature or request label Mar 28, 2023
@WillPower3309
Copy link
Owner

WillPower3309 commented Apr 7, 2023

smart shadow is what I was trying to get at with #116 , and will definitely be implemented (in fact, I think that could even default to being on). The color settings are a really good idea, but I don't want to clash with sway upstream by changing them. Perhaps we can implement the toggle like idea you had!

@litoj
Copy link
Author

litoj commented Apr 7, 2023

To expand on the idea of how to specify the colours, would it make sense to use the shadows option and instead of on just directly specify the colour or use off to disable altogether?

shadows off/#RRGGBB off/on/#RRGGBB off/on/#RRGGBB

on could imply to be the same color as for the first/active window column, just an idea

@WillPower3309 WillPower3309 added this to the 1.0 milestone Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants