Add a way to open the item if it is a file

This commit is contained in:
Lncvrt committed 2026-04-15 15:11:29 -07:00
1 parent 72962af606
commit c339436d4c
2 files changed
+14 -6

No files matched your search

+11 -5
View File
@@ -2,13 +2,19 @@
"$schema": "../gen/schemas/desktop-schema.json", "$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default", "identifier": "default",
"description": "Capability for the main window", "description": "Capability for the main window",
"windows": [ "windows": ["main"],
"main"
],
"permissions": [ "permissions": [
"core:default", "core:default",
"shell:default", "shell:default",
"dialog:default", "dialog:default",
"opener:default" "opener:default",
{
"identifier": "opener:allow-open-path",
"allow": [
{
"path": "**"
}
]
}
] ]
} }
+3 -1
View File
@@ -12,7 +12,7 @@ import {
import { v5 as uuidv5 } from 'uuid' import { v5 as uuidv5 } from 'uuid'
import prettyBytes from 'pretty-bytes' import prettyBytes from 'pretty-bytes'
import { ask, message, open } from '@tauri-apps/plugin-dialog' import { ask, message, open } from '@tauri-apps/plugin-dialog'
import { revealItemInDir } from '@tauri-apps/plugin-opener' import { openPath, revealItemInDir } from '@tauri-apps/plugin-opener'
interface Disk { interface Disk {
name: string name: string
@@ -186,7 +186,9 @@ export default function App () {
className='flex justify-between px-2 py-1 cursor-pointer bg-(--col2)/50 hover:bg-(--col4)/50 border border-(--col4)/50 hover:border-(--col6)/50 transition-colors rounded-lg' className='flex justify-between px-2 py-1 cursor-pointer bg-(--col2)/50 hover:bg-(--col4)/50 border border-(--col4)/50 hover:border-(--col6)/50 transition-colors rounded-lg'
onClick={() => { onClick={() => {
if (f.is_dir) setCurrentPath(f.path) if (f.is_dir) setCurrentPath(f.path)
else openPath(f.path)
}} }}
title={f.is_dir ? undefined : 'Click to open the file'}
> >
<p> <p>
<FontAwesomeIcon <FontAwesomeIcon