-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Configuration Option to Prevent Window Raise on 'File Modified Externally' #167
Comments
I'll see what I can do |
So I'm going to keep looking into this, but there is a feature which gets you halfway there (but at a cost). You can disable the feature entirely With:
Not ideal since you'll NEVER get alerted, but better than it firing every time you move the mouse around ;-). |
Hi @eteran I made an attempt at solving this issue: It currently tracks whether the current window is modified and the text cursor position the last time This is not a perfect solution, but it works pretty good for me so far. I tried to find a way to work around the actual problem that opening the ideally I could tie it to the user clicking on the application anywhere instead of just moving the cursor. But I couldnt figure out where/how to find out when that happens. Then i wouldnt have to tie to the cursor position. just clicking anywhere for instance on a menu, on the title bar, on the scroll handle, even moving the mouse wheel on the application window. I was wondering if you would accept a PR of this kind of change. I would need to make a configuration preference for it. I wanted to make sure you would accept something like this before I try and figure out how the configuration system works and how to add a configuration parameter for this feature. Also if you could point me to a way that i could tell if the user interacts with the application in another way than it just getting focus, we could tie it to that instead and it would be a better solution. Anyway. Thanks for this application. If you dont want to be bothered with this feature, I can maintain it on my own in my repo. Especially if there isnt anyone else that would like to have this feature. |
@jlsantiago0 Not only am I happy to look at your PR, but I also love the idea of having more contributors to the project :-) I haven't looked at your branch quite yet, but your description sounds reasonable at first glance. I'm usually happy to tuck divergences from how legacy nedit works behind a setting. (And honestly if NG is just "different" because of Qt-isms already, maybe if your approach makes it different, but better than current NG it can be the default...) So yes, please make a PR, I'd love to look at it! |
OK, took a quick look and the concept seems pretty sound. We should probably add some setting for it, and perhaps it's possible to detect if the window manager has mouse follow focus enabled? If so, we could possibly make it a bit automagical |
Maybe, if we're lucky, we can detect a difference in focus reason? |
OK. I will see if FocusReason gives us any useful information. |
Doesnt seem like we can use the FocusReason. But i think i see where i can get the information about someone clicking on the text window, using the mouse wheel in the text window, and moving the sliders. So that can be used to improve this further. Let me make those improvements and I will make a PR. Is it difficult to add an appilcation configuration option for this feature? Perhaps you can point me to the useful bits. Seems like it should go under the DefaultSettings->Warnings list. |
It's not too difficult at all. I would start with it being entirely in the config.ini and then we'll worry about the UI bits. Basically, it's a bit more complex than it should be because the design evolved slowly from where nedit was to where NG is, but here's the gist: You add a new bool variable to Then you add lines to save and load are fairly straightforward, you're simply getting a value and casting for a load, and simply setting a value for save. "import" is SLIGHTLY more complex in that it's like a load, except that if it's not found, it will default to the existing value (this is used to allow multiple files to be loaded and they can "layer" over each other. So in summary: load:
save:
import:
From there... we can (and sometimes do, I need to be more consistent) just include "Settings.h" in the appropriate file and then direclty read/write the setting as needed. But we often have an extra layer of abstraction especially if it is going to be set by the UI. So we'll probably want to do it. In the main Which tends to look like this (following the same
So... there's not a "lot", but it's not completely trivial. let me know if you have any questions. Once you have this working, I can help with the UI bits :-) |
Perfect. Thank you for the write up. It is very helpful. It will likely take me a little time. |
Hi @eteran I have the feature itself implemented and it seems to be working very well. It currently operates as the original behavior. Which will pop-up the The next step is to add configuration options. I envision 3 checkboxes in the: The You can test the different behavior by setting the 3 parameters in My next step is to figure out how to add this to the configuration per your earlier instructions and to remove all the debug. Let know know if you like the current implementation or if i need to change anything. |
OK. I just added the configuration management for the 3 new options: warnAlways |
OK. So the feature is implemented and the configuration options are created and being used for implementation. The next step is adding the configuration to the UI. Looking at that now to see if i can figure it out. |
I submitted a pull request. #326 . Thank you for considering my PR. The code for this project is well organized btw. I was able to find what i needed without too much hastle. |
@jlsantiago0 fantastic. Life is a little bit on the busy side right now, so it may take a little bit before I give it a close look. But rest assured, I am very interested in getting improvements in! Thanks! |
@jlsantiago0 OK, I took a quick look and it generally looks great, you even did the UI parts :-) ! I have one question though. Is the intention for
and the implied If so, we can probably use a group to make the UI elements act as a radio select. I think the independent settings will kinda self resolve anyway, since they are based on the whole concept of "checked" vs "unchecked". I think. Otherwise, things look pretty good. Besides that, if we could possibly come up with a more descriptive name than Anyway, great work and thanks ! |
Thank you for evaluating my PR. I will change the name of the
|feature167CheckEnabled |
||variable and add it to the PR.
The never condition 'warn disabled' is handled exactly as before.
warnAlways is the original mode when warn is enabled. if warnAlways is
not enabled, but warn is enabled, then warnWhenLocalMods and
warnWhenUserInteracts fine tune the when you want to be warned. You can
enable or disable them independently. If all 3 are off, then it works
like warn was disabled. You are right that it would be good if we could
control these as a group in the UI. For instance when warn is disabled,
it doesnt matter what the other 3 settings are. So they could be greyed
out in the UI. I didnt know how to do that. Also if warn is enabled and
warnAlways is enabled, then the warnWhenLocalMods and
warnWhenUserInteracts could be greyed out as well. I dont know enough
about how the menu items in the UI work to make that happen.
||
…On 3/21/22 16:43, Evan Teran wrote:
@jlsantiago0 <https://github.com/jlsantiago0> OK, I took a quick look
and it generally looks great, you even did the UI parts :-) !
I have one question though. Is the intention for
|warnAlways warnWhenLocalMods warnWhenUserInteracts |
and the implied |warnNever| to be mututally exclusive, as in, it is
only meaningful to pick one?
If so, we can probably use a group to make the UI elements act as a
radio select. I think the independent settings will kinda self resolve
anyway, since they are based on the whole concept of "checked" vs
"unchecked". I *think*.
Otherwise, things look pretty good. Besides that, if we could possibly
come up with a more descriptive name than |feature167CheckEnabled| for
this, and I think I'll be happy :-). Maybe
"extendedModificationWarnings" or something like that? Pretty much
anything that would make it so I don't have to look at the github page
to know what it is when I see it a year from now ;-).
Anyway, great work and thanks !
—
Reply to this email directly, view it on GitHub
<#167 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMAKMDL7O52CLSLEX5Y3HDVBDUOPANCNFSM4QFD6Q4Q>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
OK, this is a great jumping off point. I'll play with it to see what the best UI tweaks might be 👍🏻 |
@jlsantiago0 Hey just wanted to check in. No worries if you're busy, I'm in no rush; I just wanted to make sure you weren't waiting on me for more input or for me to make a tweak to the PR on my end. Thanks! |
I use mouse follow focus and would like to see a configuration option that disables the raising of the window if 'File Modified Externally' happens on a window that gets focus but is not raised 'e.g. is behind another window' and hasnt been clicked on. The window should only raise in that case if it is clicked.
The text was updated successfully, but these errors were encountered: