Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Files (`folio`) is Omarchy's file manager. It's one quiet window that follows your Omarchy theme and language, works from the keyboard, and never crawls your home folder in the background: folders are read when you open them, and thumbnails are made when a tile needs one, shared with every other app through `~/.cache/thumbnails`.

- **Three views**: Finder-style columns, a list that opens folders in place as a tree, and a grid with real previews. Ctrl+1/2/3 switches.
- **Space previews** pictures, video, audio, PDFs, text and Markdown at full size, in their own window.
- **Space previews** pictures, video, audio, PDFs, text and Markdown at full size, and the names inside archives, in their own window.
- **The sidebar** holds everything in your home folder, pinned folders (shared with GTK file dialogs), Recents, Trash with restore, your drives, and the machines on your tailnet, which open over SFTP.
- **Right-click** (or Alt+Enter) to open with another app, rename, duplicate, compress, share by Dropbox link, Taildrop or LocalSend, and delete. Copy and paste work with other apps, and nothing is ever overwritten.
- **Split** the window in two with Ctrl+Alt+N to move things between folders.
Expand Down
18 changes: 14 additions & 4 deletions src/PreviewPane.qml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ Rectangle {
readonly property var info: backend.details
// The item's type: its name's, or the one read from what it holds when its name gave none, never one read for another item.
readonly property string type: (info.path === item.path && info.mime) || item.mime || ""
// Text files show their opening lines in a frame, archives bsdtar can list the names inside.
readonly property bool archive: hasItem && backend.listsArchive(type)
readonly property bool listed: hasItem && (item.kind === "text" || archive)
// Described once the folder's loaded has put the cursor back on its
// item: a re-read leaves another item on the cursor's row for a moment,
// and describing that would drop what's been read of this one.
Expand Down Expand Up @@ -117,7 +120,7 @@ Rectangle {
// As many pixels as it's drawn with, in steps, so resizing
// the window doesn't read it again at every width.
readonly property int pixels: Math.min(8192, Math.ceil(Math.max(width, height) * Screen.devicePixelRatio / 512) * 512)
readonly property bool shown: pane.hasItem && !pane.item.isDir && pane.item.kind !== "text" && !pane.pluginItem
readonly property bool shown: pane.hasItem && !pane.item.isDir && !pane.listed && !pane.pluginItem
// The file the cursor last rested on, and those read ahead.
property string rested: ""
property var ahead: []
Expand Down Expand Up @@ -150,10 +153,10 @@ Rectangle {
visible: status === Image.Ready
}

// Text files show their opening lines instead of a picture.
// Text files show their opening lines instead of a picture, archives the names inside.
Rectangle {
anchors.fill: parent
visible: pane.hasItem && pane.item.kind === "text"
visible: pane.listed
color: theme.background
border.width: 1
border.color: Qt.alpha(theme.foreground, 0.12)
Expand All @@ -168,14 +171,21 @@ Rectangle {
textFormat: Text.PlainText
elide: Text.ElideRight
}
Sentence {
visible: pane.archive && !pane.info.text
margin: 14
text: pane.info.sentence || qsTr("Reading the archive…")
color: theme.secondaryForeground
size: 12
}
}

// Only for what has no picture: while one's on its way (moving
// quickly through files) the space stays empty rather than
// flashing the icon.
Glyph {
anchors.centerIn: parent
visible: pane.hasItem && pane.item.kind !== "text"
visible: pane.hasItem && !pane.listed
&& (!big.shown || (big.failed && quick.status !== Image.Ready))
name: pane.pluginItem ? pane.item.icon : pane.hasItem && pane.item.isDir ? "folder" : "file"
size: 72
Expand Down
17 changes: 10 additions & 7 deletions src/PreviewWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ ApplicationWindow {
anchors.fill: parent
active: !win.external
sourceComponent: win.viewer === "image" || win.viewer === "animated" ? imageView
: win.viewer === "text" || win.viewer === "markdown" ? textView
: win.viewer === "text" || win.viewer === "markdown" || win.viewer === "archive" ? textView
: win.viewer === "folder" ? folderView
: otherView
}
Expand All @@ -173,6 +173,13 @@ ApplicationWindow {
: qsTr("Playing video and audio needs Qt Multimedia, from the qt6-multimedia package.")
color: theme.foreground
}

// An archive's names are read as bsdtar prints them.
Sentence {
visible: win.viewer === "archive" && !previewer.text
text: previewer.sentence || qsTr("Reading the archive…")
color: previewer.sentence ? theme.foreground : theme.secondaryForeground
}
}
}

Expand Down Expand Up @@ -285,7 +292,7 @@ ApplicationWindow {
}
}

// Text to read, Markdown rendered; selectable, never editable.
// Text to read, Markdown rendered, an archive's names; selectable, never editable.
Component {
id: textView

Expand All @@ -299,11 +306,7 @@ ApplicationWindow {
function scroll(direction) { contentY = Math.max(0, Math.min(contentHeight - height, contentY + direction * 60)) }
function page(direction) { contentY = Math.max(0, Math.min(contentHeight - height, contentY + direction * (height - 60))) }

Connections {
target: previewer
function onChanged() { flick.contentY = 0 }
}

// Never sent to the top when the text changes: an archive's names keep arriving, and another file empties the text first, which brings the view back by itself, even one still gliding.
TextEdit {
id: body
width: Math.min(flick.width - 96, win.viewer === "markdown" ? 820 : 1200)
Expand Down
13 changes: 13 additions & 0 deletions src/Sentence.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import QtQuick

// A sentence in the middle of an empty view: what it waits for, that it's empty, or why not.
FolioText {
// Kept clear on either side.
property int margin: 48

anchors.centerIn: parent
width: parent.width - 2 * margin
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
color: theme.foreground
}
18 changes: 17 additions & 1 deletion src/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ void Backend::describe(const QVariantMap &item, bool inTrash) {
const QString kind = item.value("kind").toString();
const QString mime = item.value("mime").toString();
const quint64 generation = ++*m_describing;
// Whatever a helper program was reading for the last item goes unread.
m_helper.stop();
// The same item again (its folder re-read) keeps what it shows until
// the new reading is in, rather than flickering.
QVariantMap details;
Expand All @@ -464,6 +466,19 @@ void Backend::describe(const QVariantMap &item, bool inTrash) {
// a plugin's own items.
m_pluginItem = path.startsWith('/') && !inTrash ? item : QVariantMap();
showPluginRows(askPlugins());
// What a helper program reads comes on top of the rest.
const auto help = [this, path, mime](const QVariantMap &details) {
// An archive's names, shown as bsdtar prints them: by the type read
// from what it holds when its name gave none.
if (Previewer::listsArchive(details.value("mime", mime).toString())) {
Previewer::listArchive(m_helper, path, [this, details](const QString &text, const QString &sentence) {
m_details = details;
m_details.insert("text", text);
m_details.insert("sentence", sentence);
emit detailsChanged();
});
}
};
// Every real file and folder has a creation time to read; a plugin's
// item has none.
if (!path.startsWith('/'))
Expand All @@ -472,13 +487,14 @@ void Backend::describe(const QVariantMap &item, bool inTrash) {
// Reading the file waits on its disk, which for a slow mount would hold
// up moving through files, so it happens off the UI thread.
auto *watcher = new QFutureWatcher<QVariantMap>(this);
connect(watcher, &QFutureWatcherBase::finished, this, [this, watcher, generation, details]() mutable {
connect(watcher, &QFutureWatcherBase::finished, this, [this, watcher, generation, details, help]() mutable {
watcher->deleteLater();
if (generation != *m_describing)
return; // The selection moved on while this was read.
details.insert(watcher->result());
m_details = details;
emit detailsChanged();
help(details);
});
// Stepping through files faster than they're read queues readings; the
// ones overtaken before they start are skipped rather than left to tie
Expand Down
12 changes: 9 additions & 3 deletions src/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "foldermodel.h"
#include "mounter.h"
#include "plugins.h"
#include "previewer.h"

// Where the window is and how it got there: the current folder, its
// breadcrumbs, back/forward history, and the actions that leave the folder
Expand All @@ -29,9 +30,10 @@ class Backend : public QObject {
Q_PROPERTY(bool previewing READ previewing NOTIFY previewingChanged)
// What the details column shows beyond the listing, for the item last
// given to describe(), once they've been read in the background: a
// picture's dimensions, a text's opening lines, or a trashed item's
// origin and deletion time; and under `plugins`, plugins' rows about a
// file or folder, [[label, value]...].
// picture's dimensions, a text's opening lines, an archive's names (or
// a sentence in their place), or a trashed item's origin and deletion
// time; and under `plugins`, plugins' rows about a file or folder,
// [[label, value]...].
// Changes whenever an order is chosen, for what shows other folders
// than the one shown (the columns) to look their orders up again.
Q_PROPERTY(int sortsRevision READ sortsRevision NOTIFY sortsChanged)
Expand Down Expand Up @@ -96,6 +98,8 @@ class Backend : public QObject {
// The system's own name for a type ("JPEG image"), in the language of
// the moment.
Q_INVOKABLE static QString typeName(const QString &mime);
// Whether the details list an archive of this type's names.
Q_INVOKABLE static bool listsArchive(const QString &mime) { return Previewer::listsArchive(mime); }
// The item to select once the folder has loaded (where we came from, or
// what "Show in folder" asked for); empty means the first item.
Q_INVOKABLE QString takeSelection();
Expand Down Expand Up @@ -218,4 +222,6 @@ class Backend : public QObject {
// The pane the working directory follows: the one used last.
static inline Backend *s_working = nullptr;
void moveWorkingDirectory();
// Reads what only a helper program can, for the item described last.
Helper m_helper{this};
};
18 changes: 18 additions & 0 deletions src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,24 @@
"one": "%Ln item will be deleted permanently. This can't be undone.",
"other": "%Ln items will be deleted permanently. This can't be undone."
},
"%Ln more": {
"one": "%Ln more",
"other": "%Ln more"
},
"A folder here is already called %1.": "A folder here is already called %1.",
"A folder, or a server's address like sftp://host/": "A folder, or a server's address like sftp://host/",
"A name can't contain \"/\".": "A name can't contain \"/\".",
"A screenful up or down": "A screenful up or down",
"Add or remove one": "Add or remove one",
"Archive": "Archive",
"At least %Ln items": {
"one": "At least %Ln item",
"other": "At least %Ln items"
},
"At least %Ln more": {
"one": "At least %Ln more",
"other": "At least %Ln more"
},
"Back / ahead 5 seconds": "Back / ahead 5 seconds",
"Back / forward": "Back / forward",
"Bigger, smaller or normal tiles": "Bigger, smaller or normal tiles",
Expand Down Expand Up @@ -121,6 +133,7 @@
"Couldn't open this PDF: %1": "Couldn't open this PDF: %1",
"Couldn't play this file: %1": "Couldn't play this file: %1",
"Couldn't read %1.": "Couldn't read %1.",
"Couldn't read this archive.": "Couldn't read this archive.",
"Couldn't read this picture.": "Couldn't read this picture.",
"Couldn't recreate %1.": "Couldn't recreate %1.",
"Couldn't remove %1.": "Couldn't remove %1.",
Expand Down Expand Up @@ -161,6 +174,7 @@
"one": "Emptied the trash: %Ln item deleted.",
"other": "Emptied the trash: %Ln items deleted."
},
"Empty": "Empty",
"Empty Trash": "Empty Trash",
"Empty Trash…": "Empty Trash…",
"Empty the trash?": "Empty the trash?",
Expand Down Expand Up @@ -217,6 +231,8 @@
"Keep Both": "Keep Both",
"Keyboard shortcuts": "Keyboard shortcuts",
"Kind": "Kind",
"Listing archives needs bsdtar, from the libarchive package.": "Listing archives needs bsdtar, from the libarchive package.",
"Listing this archive took too long.": "Listing this archive took too long.",
"Making a preview…": "Making a preview…",
"Merge": "Merge",
"Merging adds what's in this folder to the one there. What has the same name inside is replaced, and the replaced items go to the trash.": "Merging adds what's in this folder to the one there. What has the same name inside is replaced, and the replaced items go to the trash.",
Expand Down Expand Up @@ -289,6 +305,7 @@
"Previewing PDFs needs Qt PDF, from the qt6-webengine package.": "Previewing PDFs needs Qt PDF, from the qt6-webengine package.",
"Previous (%1)": "Previous (%1)",
"Previous / next file": "Previous / next file",
"Reading the archive…": "Reading the archive…",
"Recents": "Recents",
"Redid compressing into %1.": "Redid compressing into %1.",
"Redid copying %Ln items.": {
Expand Down Expand Up @@ -395,6 +412,7 @@
"The drive is gone.": "The drive is gone.",
"The drive stopped taking data (%1).": "The drive stopped taking data (%1).",
"The drive was changed or removed.": "The drive was changed or removed.",
"The names in this archive are encrypted.": "The names in this archive are encrypted.",
"The preview closed unexpectedly on %1.": "The preview closed unexpectedly on %1.",
"There's nothing in %1 to extract.": "There's nothing in %1 to extract.",
"There's nothing to redo.": "There's nothing to redo.",
Expand Down
Loading
Loading