diff options
author | Francesco Marella <francesco.marella@gmail.com> | 2010-06-22 16:14:39 +0200 |
---|---|---|
committer | Francesco Marella <francesco.marella@gmail.com> | 2010-06-22 16:14:39 +0200 |
commit | 846284943baabadc4dc539894cacb00bf1f96169 (patch) | |
tree | 09003576104babe70d4325bc0de763f2677c979c | |
parent | Disable autostart menu item when the desktop file can't be found (diff) | |
download | redshift-ng-846284943baabadc4dc539894cacb00bf1f96169.tar.gz redshift-ng-846284943baabadc4dc539894cacb00bf1f96169.tar.bz2 redshift-ng-846284943baabadc4dc539894cacb00bf1f96169.tar.xz |
utils.py: copy the desktop file in autostart folder
-rw-r--r-- | src/gtk-redshift/utils.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gtk-redshift/utils.py b/src/gtk-redshift/utils.py index 0344406..93e0195 100644 --- a/src/gtk-redshift/utils.py +++ b/src/gtk-redshift/utils.py @@ -28,7 +28,16 @@ def get_autostart(): autostart_dir = base.save_config_path("autostart") autostart_file = os.path.join(autostart_dir, REDSHIFT_DESKTOP) if not os.path.exists(autostart_file): - raise IOError("Installed redshift desktop file not found!") + desktop_files = list(base.load_data_paths("applications", + REDSHIFT_DESKTOP)) + if not desktop_files: + raise IOError("Installed redshift desktop file not found!") + desktop_file_path = desktop_files[0] + # Read installed file and modify it + dfile = desktop.DesktopEntry(desktop_file_path) + dfile.set(AUTOSTART_KEY, "false") + dfile.write(filename=autostart_file) + return False else: dfile = desktop.DesktopEntry(autostart_file) if dfile.get(AUTOSTART_KEY) == 'false': |