sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
809 stars 39 forks source link

Add dimming of inactive views to core #2041

Closed FichteFoll closed 3 years ago

FichteFoll commented 6 years ago

Status Quo

The InactivePanes package dims inactive views to more visibly separate them from the active one. I've been using this package since its creation on all my ST installs. Here's a quick (old) screenshot illustrating the feature:

image

The way in which it works is already fundamentally hacky because it relies on modifying a user's color scheme under a different name and using per-view settings to overwrite. Things get more complicated when you factor in the various sources that a color scheme can be specified in settings and having to track changes to the underlying but also overridden color_scheme view setting.

With the recent addition of the new color scheme format, this becomes even more complex because I additionally need to manually perform resource file merging for the selected scheme before I can create a new scheme (inside the cache folder, which I'm not sure is considered with the new format). Furthermore, you can't create/use hidden new color schemes currently and it doesn't make sense to have these temporary schemes be selectable in the UI.

Proposal

Thus, I propose this feature to be added to core, which will be much easier to maintain because it doesn't require the various hacky workarounds and can be handled in the drawing pipeline directly. The functionality is already there for selections anyway.

In detail, I propose an inactive_background global setting to be added, similar to inactive_selection, which will have a sane default for both dark and white background colors, and a dim_inactive_views/groups setting to toggle this behavior.

Alternatively, a CSS4 color template could be specified by the scheme to modify all colors with that template, although I don't think this is necessary and only adjusting the background (and selection) color would be sufficient.

I don't particularly care whether the "active" view gets dimmed when the entire window is inactive. This is more or less an implementation detail of InactivePanes due to relying on on_deactivated.

rwols commented 6 years ago

This very same idea is already present in iTerm2, and I like it a lot.

I would add that it should also be possible to dim the foreground colors, instead of the background color.

For example, here are two screenshots from iTerm2 in which the left pane is active, and the right pane is active.

schermafbeelding 2017-11-05 om 21 13 39 schermafbeelding 2017-11-05 om 21 13 41
FichteFoll commented 6 years ago

Hm yes, maybe combine my two proposals with a specific inactive_background color and a generic inactive_foreground_template where you specify a template to dim all the various foreground colors since you'll have more than one.

safield commented 5 years ago

+1 for this!

I really like this feature in other editors and multi pane applications. I am disappointed sublime does not have this behaviour implemented in some way. I can say that I use the InactivePanes plugin, and it is indeed buggy!

safield commented 5 years ago

Also, there are a lot of ways to skin this cat, and I don't think that dimming the panel is the only solution. As long as I can easily tell which panel has focus, I personally would be happy....

safield commented 5 years ago

InactivePanes plugin pops errors everytime I open sublime text. Please make haste on this issue!!! :)

AmjadHD commented 4 years ago

https://github.com/sublimehq/sublime_text/issues/3165

wbond commented 3 years ago

As of build 4095, there are a couple of new features/changes that make this possible. The Default, Default Dark and Adaptive themes use these features to enable inactive sheet dimming when using the rounded or square file tab style.

This implementation notably does not allow affecting the foreground colors. The implementation of such would have been much more invasive, and I felt the approach I implemented does a pretty good job of accomplishing the usability improvement of making it really obvious where input focus is.

I did implement it in text line controls also in the default themes. I'm not as convinced about that implementation, so that may be tweaked a little in the future.

Because this is implemented via theme attributes and properties, it does require that each theme decide to support such functionality, but it also opens up the underlying capabilities to be tweaked further. For instance, with the attributes provided and tab_connector, it is fairly trivial to tweak a theme so it makes the tab connector much higher contrast if the tab is overhanging to one side of the sheet.