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

Close tab on middle mouse click. #814

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

w1ll-i-code
Copy link

Implements #812.

Allows to close a tab in a window stack with a middle mouse click. Dispatch a close Message on middle mouse click, the rest was already implemented.


I'm sorry this is my first PR in this repo and I'm not sure about the protocol for this here. If anything is missing, please let me know.

@Quackdoc
Copy link
Contributor

Quackdoc commented Sep 5, 2024

Can this be configurable? middle mouse click is something I accidentally hit a lot, accidentally closing the window would be fairly annoying.

@w1ll-i-code
Copy link
Author

w1ll-i-code commented Sep 5, 2024

Thanks for the comment. That's a use-case I have not thought or heard about before. But I do agree that we'd want to avoid that.

But I fear making it configurable might not be the right approach here. I think the discoverability of such an option is quite low. We'd definitely have to place that into the cosmic-settings, but even then I fear people struggling with this behaviour might not think that it's configurable.

If you want, I'd like to first understand your use-case better:

  1. In which cases do you usually accidentally hit that button?
    1. When moving the mouse?
    2. When pressing the left or right mouse buttons?
    3. When moving your hand from the keyboard to the mouse?
    4. On a trackpad?
  2. Have you struggled with that also in other applications?
    1. How often do you close tabs in browsers or text editors accidentally?
    2. Have you found any configuration option there to make life easier?
  3. Which windows do you usually use in a stack like that? My personal use-case is mostly for terminals. But for other use-cases this might be even more annoying.

@Quackdoc
Copy link
Contributor

Quackdoc commented Sep 5, 2024

Due to my RSI, I use an ergonomic mouse, in which the "natural" position has my index finger partially resting on the scroll wheel. With the lack of finger dexterity I have on bad days due to the RSI, I can often accidentally trigger it when try to left click.

It does occasionally happen when using firefox and chromium, if I was working that day, it would probably happen maybe 1 out of 5-20 times I swap a tab. I don't use tabs on editors enough for this to be an issue on them. It's not a major issue in something like a browser since I can just re-open the tab with a hotkey (which I have bound on separate pad), and most of the sites I use load fast on my PC.

I typically keep my telecoms apps like telegram, matrix, discord, and slack in a stack. I wouldn't loose work or anything, it would be at most a minor inconvenience.

at the very least, I haven't heard of other people having issues with this like I have anyways. I'm not sure if discoverability would be a major issue. I for sure see the benefit in having the feature.

@w1ll-i-code
Copy link
Author

Thanks for the detailed response. I totally agree that this is a problem we should address. Accessibility is really important Imo. Sadly I don't have a lot of experience in that field. In this case it really seems like the most pragmatic option. I can definitely implement such a config option.

I'll check later in the code which options are available. I could see either a simple toggle or adjustable key-bindings work well for this. What do you think would be the better option?

@w1ll-i-code
Copy link
Author

I'm not sure if the maintainers already have a concept for accessibility in mind, where we could hook into. Either for discoverability or documentation.

@w1ll-i-code
Copy link
Author

@Drakulix Sorry for pinging you. I think for the config options we need some input/feedback from a maintainer... I'm more than happy to implement this, both here and in cosmic-settings, but I wanna make sure first that we are going in the right direction.

@Drakulix
Copy link
Member

Drakulix commented Sep 9, 2024

@Drakulix Sorry for pinging you. I think for the config options we need some input/feedback from a maintainer... I'm more than happy to implement this, both here and in cosmic-settings, but I wanna make sure first that we are going in the right direction.

I think in general close-on-middle-click as a feature is desirable. I agree, that being able to disable this should be an accessibility feature though.

So what we want to have in cosmic-comp is a setting in src/config.rs to enable/disable close-on-middle-click.

For the cosmic-settings side, I cannot give you much guidance. We have plans for accessibility settings and some very early design, I reckon, but nothing really where you can just add this.
Pinging @maria-komarova in case I am not up-to-date here.

So I am inclined to say we can leave this a config-file only setting for now, but any implementation that is merged should have a way to toggle it.

@maria-komarova
Copy link

The design is not ready yet for the Accessibility settings so leaving it in the config only for now sounds good to me.

@w1ll-i-code w1ll-i-code force-pushed the 812-close-tabs-with-middle-mouse-key- branch 2 times, most recently from 248fccd to 4ec9908 Compare October 6, 2024 09:46
@w1ll-i-code
Copy link
Author

@Drakulix Sorry it took me a while. Now it is configurable and the configuration will be updated live whenever the file changes.

@w1ll-i-code w1ll-i-code force-pushed the 812-close-tabs-with-middle-mouse-key- branch from 4ec9908 to 9a66d8c Compare October 10, 2024 19:52
@w1ll-i-code
Copy link
Author

I just noticed that I did one change only locally through go-to-definition... iced_runtime would need a change for that to work... I need to investigate how else I can propagate config changes to the windows then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants