-
Notifications
You must be signed in to change notification settings - Fork 225
Labels
Milestone
Description
Dangerzone has some logic for detecting which application (*.desktop file) can open a PDF:
dangerzone/dangerzone/gui/logic.py
Lines 97 to 123 in 65776d8
| def _find_pdf_viewers(self) -> Dict[str, str]: | |
| pdf_viewers: Dict[str, str] = {} | |
| if platform.system() == "Linux": | |
| # Find all .desktop files | |
| for search_path in [ | |
| "/usr/share/applications", | |
| "/usr/local/share/applications", | |
| os.path.expanduser("~/.local/share/applications"), | |
| ]: | |
| try: | |
| for filename in os.listdir(search_path): | |
| full_filename = os.path.join(search_path, filename) | |
| if os.path.splitext(filename)[1] == ".desktop": | |
| # See which ones can open PDFs | |
| desktop_entry = DesktopEntry(full_filename) | |
| if ( | |
| "application/pdf" in desktop_entry.getMimeTypes() | |
| and "dangerzone" not in desktop_entry.getName().lower() | |
| ): | |
| pdf_viewers[desktop_entry.getName()] = ( | |
| desktop_entry.getExec() | |
| ) | |
| except FileNotFoundError: | |
| pass | |
| return pdf_viewers |
The result on Tails 6.2 is the following application list:
However, what's missing here is to present to the user the default application for opening PDFs. Instead, the first choice is picked up at random. Here, it's GIMP, whereas it should be Document Viewer.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done
