mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-28 18:39:12 +00:00
Fix/122 (#128)
* fix/122: register quit shortcut for macOS * fix/122: version bump
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ontime-ui",
|
"name": "ontime-ui",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chakra-ui/react": "^2.0.0-next.3",
|
"@chakra-ui/react": "^2.0.0-next.3",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useCallback, useRef, useState } from 'react';
|
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
||||||
import { Button, IconButton } from '@chakra-ui/button';
|
import { Button, IconButton } from '@chakra-ui/button';
|
||||||
import {
|
import {
|
||||||
AlertDialog,
|
AlertDialog,
|
||||||
@@ -11,17 +11,28 @@ import {
|
|||||||
import { Tooltip } from '@chakra-ui/tooltip';
|
import { Tooltip } from '@chakra-ui/tooltip';
|
||||||
import { FiPower } from '@react-icons/all-files/fi/FiPower';
|
import { FiPower } from '@react-icons/all-files/fi/FiPower';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import { LoggingContext } from '../../../app/context/LoggingContext';
|
||||||
|
|
||||||
export default function QuitIconBtn(props) {
|
export default function QuitIconBtn(props) {
|
||||||
const { clickHandler, size = 'lg', ...rest } = props;
|
const { clickHandler, size = 'lg', ...rest } = props;
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
const { emitInfo } = useContext(LoggingContext);
|
||||||
const onClose = () => setIsOpen(false);
|
const onClose = () => setIsOpen(false);
|
||||||
const cancelRef = useRef();
|
const cancelRef = useRef();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (window.process?.type === 'renderer') {
|
||||||
|
window.ipcRenderer.on('user-request-shutdown', () => {
|
||||||
|
emitInfo('Shutdown request')
|
||||||
|
setIsOpen(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [emitInfo]);
|
||||||
|
|
||||||
const handleShutdown = useCallback(() => {
|
const handleShutdown = useCallback(() => {
|
||||||
onClose();
|
onClose();
|
||||||
clickHandler();
|
clickHandler();
|
||||||
},[clickHandler]);
|
}, [clickHandler]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export default function MenuBar(props) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.process.type === 'renderer') {
|
if (window.process?.type === 'renderer') {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 'min':
|
case 'min':
|
||||||
window.ipcRenderer.send('set-window', 'to-tray');
|
window.ipcRenderer.send('set-window', 'to-tray');
|
||||||
|
|||||||
@@ -115,6 +115,12 @@ app.whenReady().then(() => {
|
|||||||
app.setAppUserModelId(app.name);
|
app.setAppUserModelId(app.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// allow usual quit in mac
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
globalShortcut.register('Command+Q', () => {
|
||||||
|
win.send('user-request-shutdown');
|
||||||
|
});
|
||||||
|
}
|
||||||
createWindow();
|
createWindow();
|
||||||
|
|
||||||
// register global shortcuts
|
// register global shortcuts
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ontime",
|
"name": "ontime",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"author": "Carlos Valente",
|
"author": "Carlos Valente",
|
||||||
"description": "Time keeping for live events",
|
"description": "Time keeping for live events",
|
||||||
"repository": "https://github.com/cpvalente/ontime",
|
"repository": "https://github.com/cpvalente/ontime",
|
||||||
|
|||||||
Reference in New Issue
Block a user