Is anyone building a file explorer with textual? #2199
Replies: 5 comments 7 replies
-
|
Our very own @darrenburns was building a file explorer with Textual. |
Beta Was this translation helpful? Give feedback.
-
|
Hi! Jumping in as a long time user of Last File Manager (lfm). Same, very interested in a textual file explorer! It's a game changer, especially when working on remote machines from ssh. Any plans to maintain and make kupo into a main project of textual? |
Beta Was this translation helpful? Give feedback.
-
That's Cool! Thanks for recommending me such a great project! |
Beta Was this translation helpful? Give feedback.
-
|
Not long ago, I stumbled upon rovr - a very fancy file explorer. |
Beta Was this translation helpful? Give feedback.
-
|
Textual is actually a great fit for a file explorer — the built-in A minimal working file explorer: from textual.app import App, ComposeResult
from textual.widgets import DirectoryTree, Header, Footer
from textual.binding import Binding
class FileExplorer(App):
BINDINGS = [
Binding("q", "quit", "Quit"),
Binding("enter", "open_file", "Open"),
]
def compose(self) -> ComposeResult:
yield Header()
yield DirectoryTree(".")
yield Footer()
def on_directory_tree_file_selected(
self, event: DirectoryTree.FileSelected
) -> None:
self.notify(f"Selected: {event.path}")
# open in editor, preview in panel, etc.Features worth adding: Split pane with preview: from textual.widgets import Static
from textual.containers import Horizontal
class FileExplorer(App):
def compose(self) -> ComposeResult:
with Horizontal():
yield DirectoryTree(".", id="tree")
yield Static("", id="preview")
def on_directory_tree_file_selected(self, event):
try:
content = event.path.read_text()
self.query_one("#preview").update(content[:2000])
except Exception:
self.query_one("#preview").update("[binary file]")Keyboard navigation for vim users: bind Filtering: add an Are you building this as a standalone tool or as a component within a larger TUI application? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm a long time user of Ranger (a file explorer written in Python), but development has stalled (last release is 3 years old) and a reboot using textual seems like a fun project.
I know very little about textual. I would love to get advice for how to architecture such a project and if it makes sense to use this library.
Is anyone working on a file explorer already?
Beta Was this translation helpful? Give feedback.
All reactions