Disable set title if needed

This commit is contained in:
Lea Anthony 2020-11-17 21:18:38 +11:00
commit 659fe1b281
No known key found for this signature in database
GPG key ID: 33DAF7BB90A58405

View file

@ -1,5 +1,5 @@
<script>
import { Window } from '@wails/runtime';
import { Window, System } from '@wails/runtime';
import CodeBlock from '../../../components/CodeBlock.svelte';
import CodeSnippet from '../../../components/CodeSnippet.svelte';
import jsCode from './code.jsx';
@ -9,6 +9,9 @@
var isJs = false;
var title = '';
let appConfig = System.AppConfig();
console.log(appConfig);
let windowActions = ["SetTitle", "Fullscreen", "UnFullscreen", "Maximise", "Unmaximise", "Minimise", "Unminimise", "Center", "Show", "Hide", "SetSize", "SetPosition", "Close"]
var disabledActions = ['Show', 'Unminimise'];
var windowAction = windowActions[0];
@ -47,6 +50,16 @@
var positionX = 100;
var positionY = 100;
var setTitleEnabled = true;
if( System.Platform() == 'darwin' ) {
let titlebar = appConfig.Mac.TitleBar;
if( titlebar.HideTitle || titlebar.HideTitleBar ) {
setTitleEnabled = false;
disabledActions.push("SetTitle");
windowAction = windowActions[1];
}
}
$: {
switch (windowAction) {
case 'SetSize':
@ -81,6 +94,7 @@
<label for="{id}-{option}">{option}
{#if option == 'Hide' } - Show() will be called after 3 seconds {/if}
{#if option == 'Minimise' } - Unminimise() will be called after 3 seconds {/if}
{#if option == 'SetTitle' && !setTitleEnabled} - disabled as there is no title displayed {/if}
</label>
{#if option == "SetSize"}
@ -95,7 +109,7 @@
{/if}
{/if}
{#if option == "SetTitle"}
{#if option == "SetTitle" && setTitleEnabled}
{#if windowAction == "SetTitle" }
<div class="form-inline form-group numberInputGroup">Title: <input type="text" class="form-control" bind:value={title}></div>
{/if}