make terminal emulator configurable

This commit is contained in:
2023-09-09 06:30:19 -07:00
parent e46c3d2b4d
commit c98a065587
10 changed files with 107 additions and 24 deletions

View File

@ -6,7 +6,7 @@
import Nav from '../ui/Nav.svelte';
import Link from '../ui/Link.svelte';
import ErrorAlert from '../ui/ErrorAlert.svelte';
import { Setting, ToggleSetting, NumericSetting } from '../ui/settings';
import { Setting, ToggleSetting, NumericSetting, FileSetting, TextSetting } from '../ui/settings';
import { fly } from 'svelte/transition';
import { backInOut } from 'svelte/easing';
@ -25,18 +25,25 @@
let osType = '';
type().then(t => osType = t);
console.log($appState.config.terminal);
window.term = $appState.config.terminal;
</script>
<Nav>
<h2 slot="title" class="text-2xl font-bold">Settings</h2>
<h1 slot="title" class="text-2xl font-bold">Settings</h1>
</Nav>
{#await invoke('get_config') then config}
<div class="max-w-md mx-auto mt-1.5 p-4">
<div class="max-w-lg mx-auto mt-1.5 p-4">
<!-- <h2 class="text-2xl font-bold text-center">Settings</h2> -->
<ToggleSetting title="Start on login" bind:value={$appState.config.start_on_login} on:update={save}>
<div class="divider mt-0 mb-8">
<h2 class="text-xl font-bold">General</h2>
</div>
<ToggleSetting title="Start on login" divider={false} bind:value={$appState.config.start_on_login} on:update={save}>
<svelte:fragment slot="description">
Start Creddy when you log in to your computer.
</svelte:fragment>
@ -76,6 +83,21 @@
Update or re-enter your encrypted credentials.
</svelte:fragment>
</Setting>
<div class="divider mt-10 mb-8">
<h2 class="text-xl font-bold">Terminal</h2>
</div>
<FileSetting
title="Emulator"
divider={false}
bind:value={$appState.config.terminal.exec}
on:update={save}
>
<svelte:fragment slot="description">
Choose your preferred terminal emulator (e.g. <code>gnome-terminal</code>, <code>wt.exe</code>.) May be an absolute path or an executable discoverable on <code>$PATH</code>.
</svelte:fragment>
</FileSetting>
</div>
{/await}