From 8a46cc45bb94b2a55dcfe3f2d0a31020f04c3cf3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 3 May 2014 09:22:32 +0530 Subject: [PATCH] Linux install: Have the calibre GUI programs redirect stdout and stderr to null when launched via .desktop files to workaround systems where the GUI launchers are broken. See #1315458 (Calibre can't open AZW3 books if launched from Ubuntu Dash) --- src/calibre/gui2/__init__.py | 4 ++-- src/calibre/linux.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index e41968581e..f3eec4eefa 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -854,8 +854,8 @@ def setup_gui_option_parser(parser): help='Detach from the controlling terminal, if any (linux only)') def detach_gui(): - if islinux and not DEBUG and sys.stdout.isatty(): - # We are a GUI process running in a terminal so detach from the controlling terminal + if islinux and not DEBUG: + # Detach from the controlling process. if os.fork() != 0: raise SystemExit(0) os.setsid() diff --git a/src/calibre/linux.py b/src/calibre/linux.py index c746606bee..0063714263 100644 --- a/src/calibre/linux.py +++ b/src/calibre/linux.py @@ -929,7 +929,7 @@ Name=E-book Viewer GenericName=Viewer for E-books Comment=Viewer for E-books in all the major formats TryExec=ebook-viewer -Exec=ebook-viewer %f +Exec=ebook-viewer --detach %f Icon=calibre-viewer Categories=Graphics;Viewer; ''' @@ -942,7 +942,7 @@ Name=Edit E-book GenericName=Edit E-books Comment=Edit e-books in various formats TryExec=ebook-edit -Exec=ebook-edit %f +Exec=ebook-edit --detach %f Icon=calibre-ebook-edit Categories=Office; ''' @@ -955,7 +955,7 @@ Name=calibre GenericName=E-book library management Comment=E-book library management: Convert, view, share, catalogue all your e-books TryExec=calibre -Exec=calibre %F +Exec=calibre --detach %F Icon=calibre-gui Categories=Office; '''