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"
|
||||
|
||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||
tauri-plugin-single-instance = "2"
|
||||
tauri-plugin-window-state = "2"
|
||||
|
||||
[profile.release]
|
||||
|
||||
@@ -2,13 +2,19 @@
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": [
|
||||
"main"
|
||||
],
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"shell: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 sysinfo::Disks;
|
||||
use tauri::{State, WebviewUrl, WebviewWindowBuilder};
|
||||
use tauri::{Manager, State, WebviewUrl, WebviewWindowBuilder};
|
||||
|
||||
use tauri_plugin_shell::ShellExt;
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -102,7 +102,7 @@ fn stream(node: &serde_json::Value, parent: &str, map: &mut HashMap<String, Vec<
|
||||
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 {
|
||||
name: name.to_string(),
|
||||
@@ -163,6 +163,11 @@ fn reset_scan(state: State<'_, AppState>) {
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
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_prevent_default::init())
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
|
||||
+16
-8
@@ -12,7 +12,7 @@ import {
|
||||
import { v5 as uuidv5 } from 'uuid'
|
||||
import prettyBytes from 'pretty-bytes'
|
||||
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 {
|
||||
name: string
|
||||
@@ -165,7 +165,7 @@ export default function App () {
|
||||
{breadcrumbs.map((p, i) => (
|
||||
<button
|
||||
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)}
|
||||
>
|
||||
{i == 0 ? p : p.split('/').pop()}
|
||||
@@ -173,7 +173,7 @@ export default function App () {
|
||||
))}
|
||||
</div>
|
||||
<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()}
|
||||
>
|
||||
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'
|
||||
onClick={() => {
|
||||
if (f.is_dir) setCurrentPath(f.path)
|
||||
else openPath(f.path)
|
||||
}}
|
||||
title={f.is_dir ? undefined : 'Click to open the file'}
|
||||
>
|
||||
<p>
|
||||
<FontAwesomeIcon
|
||||
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}
|
||||
</p>
|
||||
<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
|
||||
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 => {
|
||||
e.stopPropagation()
|
||||
revealItemInDir(f.path)
|
||||
}}
|
||||
/>
|
||||
</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
|
||||
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 => {
|
||||
e.stopPropagation()
|
||||
|
||||
|
||||
Reference in new issue
Block a user