|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
<script>
|
|
|
|
|
import { open } from '@tauri-apps/plugin-opener'
|
|
|
|
|
import * as opener from '@tauri-apps/plugin-opener'
|
|
|
|
|
|
|
|
|
|
export let onMessage
|
|
|
|
|
|
|
|
|
@ -17,34 +17,83 @@
|
|
|
|
|
'wslview'
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
let url = ''
|
|
|
|
|
let path = ''
|
|
|
|
|
let revealPath = ''
|
|
|
|
|
|
|
|
|
|
let program = 'Default'
|
|
|
|
|
let urlProgram = 'Default'
|
|
|
|
|
let pathProgram = 'Default'
|
|
|
|
|
|
|
|
|
|
function openUrl() {
|
|
|
|
|
opener
|
|
|
|
|
.openUrl(url, urlProgram === 'Default' ? undefined : urlProgram)
|
|
|
|
|
.catch(onMessage)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function openPath() {
|
|
|
|
|
open(path, program === 'Default' ? undefined : program).catch(onMessage)
|
|
|
|
|
opener
|
|
|
|
|
.openPath(path, pathProgram === 'Default' ? undefined : urlProgram)
|
|
|
|
|
.catch(onMessage)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function revealItemInDir() {
|
|
|
|
|
opener.revealItemInDir(revealPath).catch(onMessage)
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<div class="flex flex-col">
|
|
|
|
|
<div class="flex flex-col gap-2">
|
|
|
|
|
<form
|
|
|
|
|
class="flex flex-row gap-2 items-center"
|
|
|
|
|
on:submit|preventDefault={openUrl}
|
|
|
|
|
>
|
|
|
|
|
<button class="btn" type="submit">Open URL</button>
|
|
|
|
|
|
|
|
|
|
<input
|
|
|
|
|
class="input grow"
|
|
|
|
|
placeholder="Type the URL to open..."
|
|
|
|
|
bind:value={url}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<span> with </span>
|
|
|
|
|
<select class="input" bind:value={urlProgram}>
|
|
|
|
|
<option value="Default">Default</option>
|
|
|
|
|
{#each programs as p}
|
|
|
|
|
<option value={p}>{p}</option>
|
|
|
|
|
{/each}
|
|
|
|
|
</select>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
<form
|
|
|
|
|
class="flex flex-row gap-2 items-center"
|
|
|
|
|
on:submit|preventDefault={openPath}
|
|
|
|
|
>
|
|
|
|
|
<button class="btn" type="submit">Open Path</button>
|
|
|
|
|
|
|
|
|
|
<input
|
|
|
|
|
class="input grow"
|
|
|
|
|
placeholder="Type the path to watch..."
|
|
|
|
|
placeholder="Type the path to open..."
|
|
|
|
|
bind:value={path}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<span> with </span>
|
|
|
|
|
<select class="input" bind:value={program}>
|
|
|
|
|
<select class="input" bind:value={pathProgram}>
|
|
|
|
|
<option value="Default">Default</option>
|
|
|
|
|
{#each programs as p}
|
|
|
|
|
<option value={p}>{p}</option>
|
|
|
|
|
{/each}
|
|
|
|
|
</select>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
<button class="btn" type="submit">Open</button>
|
|
|
|
|
<form
|
|
|
|
|
class="flex flex-row gap-2 items-center"
|
|
|
|
|
on:submit|preventDefault={revealItemInDir}
|
|
|
|
|
>
|
|
|
|
|
<button class="btn" type="submit">Reveal</button>
|
|
|
|
|
|
|
|
|
|
<input
|
|
|
|
|
class="input grow"
|
|
|
|
|
placeholder="Type the path to reveal..."
|
|
|
|
|
bind:value={revealPath}
|
|
|
|
|
/>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|