mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 14:19:38 +00:00
Better window size controls
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
<div *ngIf="settingsService.rateLimitDelay < 30" class="ui warning message">
|
||||
<i class="exclamation circle icon"></i>
|
||||
<b>Warning:</b> downloading files from Google with a delay less than about 30 seconds will eventually cause Google to
|
||||
refuse download requests from this program for a few hours. If you can find a way around this limitation, contact the devs.
|
||||
refuse download requests from this program for a few hours. If you can find a way around this limitation, contact Geo#8488 on discord.
|
||||
</div>
|
||||
|
||||
<h3 class="ui header">Theme</h3>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<div class="right menu">
|
||||
<a class="item traffic-light" (click)="minimize()"><i class="minus icon"></i></a>
|
||||
<a class="item traffic-light" (click)="maximize()"><i class="plus icon"></i></a>
|
||||
<a class="item traffic-light" (click)="maximize()"><i class="icon window" [ngClass]="isMaximized ? 'restore' : 'maximize'"></i></a>
|
||||
<a class="item traffic-light" (click)="close()"><i class="x icon"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { Component, OnInit } from '@angular/core'
|
||||
import { ElectronService } from '../../core/services/electron.service'
|
||||
|
||||
@Component({
|
||||
@@ -6,16 +6,27 @@ import { ElectronService } from '../../core/services/electron.service'
|
||||
templateUrl: './toolbar.component.html',
|
||||
styleUrls: ['./toolbar.component.scss']
|
||||
})
|
||||
export class ToolbarComponent {
|
||||
export class ToolbarComponent implements OnInit {
|
||||
|
||||
isMaximized: boolean
|
||||
|
||||
constructor(private electronService: ElectronService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.isMaximized = this.electronService.currentWindow.isMaximized()
|
||||
}
|
||||
|
||||
minimize() {
|
||||
this.electronService.currentWindow.minimize()
|
||||
}
|
||||
|
||||
maximize() {
|
||||
this.electronService.currentWindow.maximize()
|
||||
if (this.isMaximized) {
|
||||
this.electronService.currentWindow.restore()
|
||||
} else {
|
||||
this.electronService.currentWindow.maximize()
|
||||
}
|
||||
this.isMaximized = !this.isMaximized
|
||||
}
|
||||
|
||||
close() {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { app, BrowserWindow, screen, ipcMain } from 'electron'
|
||||
import { app, BrowserWindow, ipcMain } from 'electron'
|
||||
import * as windowStateKeeper from 'electron-window-state'
|
||||
import * as path from 'path'
|
||||
import * as url from 'url'
|
||||
|
||||
@@ -6,6 +7,7 @@ import * as url from 'url'
|
||||
import { getIPCInvokeHandlers, getIPCEmitHandlers, IPCEmitEvents } from './shared/IPCHandler'
|
||||
import Database from './shared/Database'
|
||||
import { getSettingsHandler } from './ipc/SettingsHandler.ipc'
|
||||
import { dataPath } from './shared/Paths'
|
||||
|
||||
let mainWindow: BrowserWindow
|
||||
const args = process.argv.slice(1)
|
||||
@@ -56,10 +58,18 @@ function handleOSXWindowClosed() {
|
||||
*/
|
||||
function createBridgeWindow() {
|
||||
|
||||
// Load window size and maximized/restored state from previous session
|
||||
const windowState = windowStateKeeper({
|
||||
defaultWidth: 1000,
|
||||
defaultHeight: 800,
|
||||
path: dataPath
|
||||
})
|
||||
|
||||
// Create the browser window
|
||||
mainWindow = createBrowserWindow()
|
||||
mainWindow = createBrowserWindow(windowState)
|
||||
|
||||
mainWindow.maximize()
|
||||
// Store window size and maximized/restored state for next session
|
||||
windowState.manage(mainWindow)
|
||||
|
||||
// Don't use a system menu
|
||||
mainWindow.setMenu(null)
|
||||
@@ -84,14 +94,12 @@ function createBridgeWindow() {
|
||||
/**
|
||||
* Initialize a BrowserWindow object with initial parameters
|
||||
*/
|
||||
function createBrowserWindow() {
|
||||
const targetWindowSize = screen.getPrimaryDisplay().workAreaSize
|
||||
|
||||
function createBrowserWindow(windowState: windowStateKeeper.State) {
|
||||
return new BrowserWindow({
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: targetWindowSize.width,
|
||||
height: targetWindowSize.height,
|
||||
x: windowState.x,
|
||||
y: windowState.y,
|
||||
width: windowState.width,
|
||||
height: windowState.height,
|
||||
frame: false,
|
||||
title: 'Bridge',
|
||||
webPreferences: {
|
||||
|
||||
Reference in New Issue
Block a user