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

Feature request: File changed on disk detection #9

Open
Tirus42 opened this issue May 28, 2022 · 2 comments
Open

Feature request: File changed on disk detection #9

Tirus42 opened this issue May 28, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@Tirus42
Copy link

Tirus42 commented May 28, 2022

It would be great if leafpad could inform the user, when the opened file changed on disk
and leafpad has the previous state open.

This can avoid data loss when working inside a shared folder.

A very simple way to achieve this is to check the opened file for the modified data
every time the leafpad window receives the input focus.

A simple popup message would be enough to inform the user or even allow to select,
if the file should be reopened (and all local modifications will be lost) or just to ignore this change (and possibly override with the next save action).

@tarot231 tarot231 added the enhancement New feature or request label May 28, 2022
@suve
Copy link

suve commented Jan 27, 2024

A very simple way to achieve this is to check the opened file for the modified data
every time the leafpad window receives the input focus.

Checking the file modification date on disk vs. last read/write date inside the program is probably the simplest solution, though a bit unreliable. On Linux, I think using inotify will be the best option, as it flips the flow around - instead of polling the filesystem and checking for changes, it's the OS notifying the program about changes.

@tarot231
Copy link
Owner

Please pull request. However inotify depends on Linux, so it is preferable to support it with glib.

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

3 participants