Summary
| Mentor(s): | Prof. Bill Griffin-Dubson Dr. Mike Murphy |
|---|---|
| Project Type: | Software development and engineering; user interface design |
| Technologies: | Python, Qt (PySide6, Qt Designer), Git |
| Undergraduate Credit: | CSCI 399, CSCI 490 |
| Graduate Credit: | IST 659 |
| Locality: | Main campus and/or remote |
Purpose
On some systems, notably Windows, a file extension is used to tell the system what kind of data a file contains. For example, on Windows, a .mp3 extension identifies an MP3 file, while a .exe extension identifies a program. On Linux systems, the file is inspected to see what kind of data it contains, and the extension is normally only used for the benefit of the human user (and for interoperability with Windows). In order to determine the file type, the system looks at the first few bytes of the file and matches those bytes against a set of known patterns. When a file matches a pattern, its type is identified using Multipurpose Internet Mail Extensions (MIME) conventions. Examples of MIME types include text/html and application/pdf.
TealFiler uses the standard xdg-open command (documented in section 1 of the manual pages) to check the MIME type and decide what program to launch in order to open the file. In turn xdg-open builds an association between programs and their declared MIME type support to locate available applications. As long as there is at least 1 application with support for the given MIME type, xdg-open can call a program to view or edit the corresponding file.
On many systems, more than one program is available for some MIME types. For example, both a modern web browser and a PDF viewer can open files of type application/pdf. By default, xdg-open will just pick one of those applications to open a PDF file. However, the user might have a preference as to which program to use. The user can both set their desired program for a given MIME type and associate programs with MIME types using a mimeapps.list file.
[Added Associations]
x-scheme-handler/http=librewolf.desktop
x-scheme-handler/https=librewolf.desktop
[Default Applications]
application/pdf=io.github.JakubMelka.Pdf4qt.Pdf4QtViewer.desktop
image/jpeg=org.nomacs.ImageLounge.desktop
image/png=org.nomacs.ImageLounge.desktop
inode/directory=edu.coastal.tealfiler.desktop
text/plain=nvim.desktop
x-scheme-handler/http=librewolf.desktop
x-scheme-handler/https=librewolf.desktop
Listing 1 shows a mimeapps.list file that sets the default web browser (x-scheme-handler/http and x-scheme-handler-https) MIME types to the LibreWolf browser. It also configures PDF4QT as the default PDF reader, nomacs as the default image viewer, TealFiler as the default file manager, and Neovim as the default text editor. In our current lightweight environment, the user would have to edit this file by hand. However, it would improve usability to have a graphical setting to enable the user to pick which application would open which type of file.
Scope of Work
Add a file type association editor to the TealFiler settings to make it easy for a user to configure the mimeapps.list file. This graphical settings tool will need to allow the user to set default applications and add associations between MIME types and programs. Use the existing XDG desktop entry data (which TealFiler already parses) to show the user what programs are available for which file types. Also show the default application that will be used if the user hasn't picked one (this information is available from the xdg-mime command).