diff --git a/assets/desktop/dev.noctalia.luciole.desktop b/assets/desktop/dev.noctalia.luciole.desktop index d372cfa7..bdd326d0 100644 --- a/assets/desktop/dev.noctalia.luciole.desktop +++ b/assets/desktop/dev.noctalia.luciole.desktop @@ -7,6 +7,6 @@ Exec=luciole %F Icon=dev.noctalia.luciole Terminal=false Categories=System;FileTools;FileManager; -MimeType=inode/directory; +MimeType=inode/directory;application/zip;application/x-tar;application/x-7z-compressed;application/vnd.rar;application/x-rar;application/x-rar-compressed;application/x-compressed-tar;application/x-bzip2-compressed-tar;application/x-bzip-compressed-tar;application/x-xz-compressed-tar;application/x-zstd-compressed-tar;application/gzip;application/x-bzip2;application/x-xz;application/zstd; StartupNotify=true StartupWMClass=dev.noctalia.luciole diff --git a/docs/user/archives.md b/docs/user/archives.md index e70cae3f..9b01e3bd 100644 --- a/docs/user/archives.md +++ b/docs/user/archives.md @@ -23,6 +23,8 @@ Open a supported archive member to browse its contents inside Luciole. The bread Other members open in their associated application. Large members and nested archives stream into private temporary storage. Luciole checks available space when the output size is known and reports write failures if space runs out. There is no fixed member-size or member-count quota. Closing the archive view keeps externally opened files available. Temporary files can remain while the tab is available to reopen and are removed when Luciole exits. If another file operation is still finishing, Luciole says so instead of opening. +Luciole also registers itself for archive types, so you can choose it as the default application for archives, for example to open ones downloaded in a chat app. `luciole path/to/archive.zip` does the same from a terminal: Luciole opens the archive's folder and browses the archive there. + ## Extract Select one or more supported native archives and choose **Extract Here** or **Extract To**. **Extract Here** creates a separate folder beside each archive. For one archive, **Extract To** chooses its new output-folder path. For multiple archives, it chooses an existing parent folder and creates a separate output folder for each archive inside it. The folder takes the archive's name without its suffix. If a file or another archive in the batch already uses that name, the folder is numbered, such as `photos (1)`. diff --git a/src/app/cli.cpp b/src/app/cli.cpp index ab0556c2..47c656bc 100644 --- a/src/app/cli.cpp +++ b/src/app/cli.cpp @@ -15,12 +15,13 @@ namespace { constexpr std::string_view kHelp = - R"(Usage: luciole [--] [directory] + R"(Usage: luciole [--] [directory | archive] luciole -h | --help | -v | --version luciole completions luciole config validate -Open Luciole in Home, or browse one directory path or URI. +Open Luciole in Home, browse one directory path or URI, or open one archive's +folder and browse the archive. Options: -h, --help Show this help diff --git a/src/app/page/browser_page.cpp b/src/app/page/browser_page.cpp index 501ee619..a7f33aa5 100644 --- a/src/app/page/browser_page.cpp +++ b/src/app/page/browser_page.cpp @@ -17,6 +17,7 @@ #include "core/timer_manager.h" #include "core/ui_phase.h" #include "cursor-shape-v1-client-protocol.h" +#include "fs/archive_type.h" #include "fs/background_job.h" #include "fs/drive_monitor.h" #include "fs/gio_ptr.h" @@ -296,10 +297,15 @@ void BrowserPage::fontChanged() { } bool BrowserPage::initialize(const std::optional& initialLocation) { - if (initialLocation) { - (void)browser().openText(*initialLocation); - } else { + if (!initialLocation) { browser().home(); + } else if (luciole::isSupportedArchive(luciole::Location::fromUri(*initialLocation), "")) { + // An archive handed over by another app opens its folder and browses it; the name check keeps folders sync. + (void)browser().openTypedText(*initialLocation, [this](const luciole::Location& archive) { + m_archiveController.browse(archive); + }); + } else { + (void)browser().openText(*initialLocation); } return true; }