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

watch for start menu changes on MS Windows #3335

Closed
totaam opened this issue Nov 1, 2021 · 4 comments
Closed

watch for start menu changes on MS Windows #3335

totaam opened this issue Nov 1, 2021 · 4 comments
Labels
enhancement New feature or request server

Comments

@totaam
Copy link
Collaborator

totaam commented Nov 1, 2021

https://github.com/gorakhargosh/watchdog supports more platforms than pyinotify so this could be used as a generic replacement.

@totaam totaam added enhancement New feature or request server labels Nov 1, 2021
@totaam
Copy link
Collaborator Author

totaam commented Nov 8, 2023

More of an issue now with lots of deprecation warnings in python3.12

Other alternatives:

@totaam
Copy link
Collaborator Author

totaam commented Sep 6, 2024

Can be done using Gio monitor, just like 6b3403d

@totaam
Copy link
Collaborator Author

totaam commented Sep 7, 2024

The commit above cleans up the file monitoring code to ensure that all the xdg stuff lives in the posix platform module.
It should also work on MS Windows, but even the basic gio example does not:

from gi.repository import Gio, GLib
import os

def directory_changed(monitor, file1, file2, evt_type):
    if os.path.isdir(file2):    #maybe this needs to be file1?
        add_monitor(file2) 
    print("Changed:", file1, file2, evt_type)

def add_monitor(dir):
    gfile = Gio.File.new_for_path(dir)
    monitor = gfile.monitor_directory(Gio.FileMonitorFlags.NONE, None)
    monitor.connect("changed", directory_changed) 

add_monitor('.')

ml = GLib.MainLoop()
ml.run()

Maybe this is not implemented for MS Windows at all?

totaam added a commit that referenced this issue Sep 7, 2024
takes precedence over Gio file monitor if present
@totaam
Copy link
Collaborator Author

totaam commented Sep 7, 2024

Solved by using python3-watchdog as backend if present.
This one works on all platforms, reliably too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server
Projects
None yet
Development

No branches or pull requests

1 participant