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

Add option to remove desktop after focus change #3

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
1 participant
@MyNameIsCosmo
Copy link

MyNameIsCosmo commented Jan 21, 2019

This will allow you to keep an empty desktop open if you're focused in it
Set remove-focused = false in your config.toml to active this feature

Fixes #1

Add option to remove desktop after focus change
This will allow you to keep an empty desktop open if you're focused in
it
Set `remove-focused = false` in your config.toml to active this feature
@MyNameIsCosmo

This comment has been minimized.

Copy link
Author

MyNameIsCosmo commented Jan 21, 2019

I have only tested this on 1 monitor, so I am not sure of the behavior across monitors.

@@ -89,6 +90,7 @@ func newDefaultConfig() *viper.Viper {
c.SetDefault("min", 1)
c.SetDefault("max", math.MaxInt64)
c.SetDefault("remove-empty", true)
c.SetDefault("remove-focused", true)

This comment has been minimized.

@MyNameIsCosmo

MyNameIsCosmo Jan 25, 2019

Author

@cmschuetz Should btops default to not removing focused desktops by default (false) or should it keep the previous behavior of removing focused desktops (true)?

continue
}

if r.config.Min >= len(monitor.Desktops) {
// TODO: Should we handle desktop destruction if the monitor focus is switched?
if !r.config.RemoveFocused && monitor.FocusedDesktopId == desktop.Id {

This comment has been minimized.

@MyNameIsCosmo

MyNameIsCosmo Jan 25, 2019

Author

@cmschuetz One side effect of this is that an empty desktop could end up in the middle of the desktops.
I.E. where bold means not empty
"1 2 3 4"
// close window in 2, 2 is focused so btops removes 4
"1 2 3"

I suggest adding in a MoveHandler, and having a config option move-empty where a value such as first, last, keep would move the empty desktop to the beginning, end, or not move the desktop (respectively)
A MoveHandler may eventually be used along with the RenameHandler to move a desktop to the specified position if it contains a window or has a name, i.e:

[[names.classified]]
"web" = ["Chromium", "Firefox"]
position = 0


[[names.classified]]
"" = ["Termite", "Alacritty", "URxvt"]
position = 1

This would share a similar priority metric as RenameHandler would (if I'm skimming the code correctly) in addition to a check if the position is available (i.e. if there's only 1 desktop, no movement operations are needed, or if the position requested is 5, but there's only 3 desktops, move the desktop to the end)
One unexpected side effect from the second example would be the case where there are 4 desktops, a new one is created, and the empty desktop is switched with the position 5 desktop. Another option could be added to swap with empty desktops...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment