Compare commits
7
Commits
000389a581
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be3d44420a
|
||
|
|
3fa83d9422
|
||
|
|
04dca68d13
|
||
|
|
a21245a210
|
||
|
|
c339436d4c
|
||
|
|
72962af606
|
||
|
|
13037f1e59
|
No files matched your search
@@ -29,6 +29,7 @@ window-vibrancy = "0.7.1"
|
|||||||
windows-version = "0.1.7"
|
windows-version = "0.1.7"
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||||
|
tauri-plugin-single-instance = "2"
|
||||||
tauri-plugin-window-state = "2"
|
tauri-plugin-window-state = "2"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|||||||
@@ -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": "**"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ use std::{collections::HashMap, fs, path::PathBuf, sync::Mutex};
|
|||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sysinfo::Disks;
|
use sysinfo::Disks;
|
||||||
use tauri::{State, WebviewUrl, WebviewWindowBuilder};
|
use tauri::{Manager, State, WebviewUrl, WebviewWindowBuilder};
|
||||||
|
|
||||||
use tauri_plugin_shell::ShellExt;
|
use tauri_plugin_shell::ShellExt;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
@@ -102,7 +102,7 @@ fn stream(node: &serde_json::Value, parent: &str, map: &mut HashMap<String, Vec<
|
|||||||
format!("{}/{}", parent, name)
|
format!("{}/{}", parent, name)
|
||||||
};
|
};
|
||||||
|
|
||||||
let is_dir = children.as_ref().map(|c| !c.is_empty()).unwrap_or(false);
|
let is_dir = children.map_or(false, |c| !c.is_empty());
|
||||||
|
|
||||||
map.entry(parent.to_string()).or_default().push(FileInfo {
|
map.entry(parent.to_string()).or_default().push(FileInfo {
|
||||||
name: name.to_string(),
|
name: name.to_string(),
|
||||||
@@ -163,6 +163,11 @@ fn reset_scan(state: State<'_, AppState>) {
|
|||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
|
||||||
|
if let Some(window) = app.get_webview_window("main") {
|
||||||
|
let _ = window.set_focus();
|
||||||
|
}
|
||||||
|
}))
|
||||||
.plugin(tauri_plugin_window_state::Builder::new().build())
|
.plugin(tauri_plugin_window_state::Builder::new().build())
|
||||||
.plugin(tauri_plugin_prevent_default::init())
|
.plugin(tauri_plugin_prevent_default::init())
|
||||||
.plugin(tauri_plugin_opener::init())
|
.plugin(tauri_plugin_opener::init())
|
||||||
|
|||||||
+16
-8
@@ -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
|
||||||
@@ -165,7 +165,7 @@ export default function App () {
|
|||||||
{breadcrumbs.map((p, i) => (
|
{breadcrumbs.map((p, i) => (
|
||||||
<button
|
<button
|
||||||
key={p + i}
|
key={p + i}
|
||||||
className='cursor-pointer bg-(--col2)/50 hover:bg-(--col4)/50 border border-(--col4)/50 hover:border-(--col6)/50 px-2 py-1 rounded-lg transition-colors text-white/60 hover:text-white/75'
|
className='cursor-pointer bg-(--col2)/50 hover:bg-(--col4)/50 border border-(--col4)/50 hover:border-(--col6)/50 px-2 py-1 rounded-lg transition-colors text-white'
|
||||||
onClick={() => setCurrentPath(p)}
|
onClick={() => setCurrentPath(p)}
|
||||||
>
|
>
|
||||||
{i == 0 ? p : p.split('/').pop()}
|
{i == 0 ? p : p.split('/').pop()}
|
||||||
@@ -173,7 +173,7 @@ export default function App () {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
className='cursor-pointer bg-(--col2)/50 hover:bg-(--col4)/50 border border-(--col4)/50 hover:border-(--col6)/50 px-2 py-1 rounded-lg transition-colors text-white/60 hover:text-white/75 absolute right-0'
|
className='cursor-pointer bg-(--col2)/50 hover:bg-(--col4)/50 border border-(--col4)/50 hover:border-(--col6)/50 px-2 py-1 rounded-lg transition-colors text-white absolute right-0'
|
||||||
onClick={() => goBackToDisks()}
|
onClick={() => goBackToDisks()}
|
||||||
>
|
>
|
||||||
Back
|
Back
|
||||||
@@ -186,30 +186,38 @@ 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
|
||||||
icon={f.is_dir ? faFolder : faFile}
|
icon={f.is_dir ? faFolder : faFile}
|
||||||
className='text-white/60 hover:text-white/75 transition-all hover:scale-110'
|
className='text-white transition-all hover:scale-110'
|
||||||
/>{' '}
|
/>{' '}
|
||||||
{f.name}
|
{f.name}
|
||||||
</p>
|
</p>
|
||||||
<div className='flex flex-row gap-2 items-center'>
|
<div className='flex flex-row gap-2 items-center'>
|
||||||
<div className='w-4 h-6 flex justify-center items-center'>
|
<div
|
||||||
|
className='w-4 h-6 flex justify-center items-center'
|
||||||
|
title={'Click to show the ' + f.is_dir ? 'folder' : 'file'}
|
||||||
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faFolderOpen}
|
icon={faFolderOpen}
|
||||||
className='text-white/60 hover:text-white/75 transition-all hover:scale-110'
|
className='text-white transition-all hover:scale-110'
|
||||||
onClick={async e => {
|
onClick={async e => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
revealItemInDir(f.path)
|
revealItemInDir(f.path)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className='w-4 h-6 flex justify-center items-center'>
|
<div
|
||||||
|
className='w-4 h-6 flex justify-center items-center'
|
||||||
|
title={'Click to delete the ' + f.is_dir ? 'folder' : 'file'}
|
||||||
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon={faTrashCan}
|
icon={faTrashCan}
|
||||||
className='text-red-500/60 hover:text-red-500/75 transition-all hover:scale-110'
|
className='text-red-500 transition-all hover:scale-110'
|
||||||
onClick={async e => {
|
onClick={async e => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user