From 846284943baabadc4dc539894cacb00bf1f96169 Mon Sep 17 00:00:00 2001 From: Francesco Marella Date: Tue, 22 Jun 2010 16:14:39 +0200 Subject: utils.py: copy the desktop file in autostart folder --- src/gtk-redshift/utils.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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': -- cgit v1.2.3-70-g09d2