Skip to content

Commit

Permalink
finished for now
Browse files Browse the repository at this point in the history
  • Loading branch information
lacymorrow committed Jun 3, 2023
1 parent 709a7e5 commit 9dfd4fd
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 deletions.
10 changes: 10 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,18 @@ module.exports = async () => {
// app.on(...)
register.appEvents()

// Quit app when all windows are closed; Fix for Linux tray
app.on( 'before-quit', _ => {

// https://electronjs.org/docs/api/app#event-before-quit
// https://electronjs.org/docs/api/tray#traydestroy
tray.instance?.destroy()

} )

// wait for app.on('ready')
await app.whenReady()
// Remove tray in Linux to fully quit

console.timeLog( 'init' )

Expand Down
10 changes: 0 additions & 10 deletions src/main/crossover.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const keyboard = require( './keyboard' )
const log = require( './log' )
const save = require( './save' )
const set = require( './set' )
const tray = require( './tray' )
const sound = require( './sound' )
const windows = require( './windows' )
const reset = require( './reset' )
Expand All @@ -17,15 +16,6 @@ const preferences = Preferences.init()

let previousPreferences = preferences.preferences

// Remove tray in Linux to fully quit
app.on( 'before-quit', _ => {

// https://electronjs.org/docs/api/app#event-before-quit
// https://electronjs.org/docs/api/tray#traydestroy
tray.instance?.destroy()

} )

const quit = () => app.quit()

const changeCrosshair = src => windows.each( win => set.crosshair( src, win ) )
Expand Down
36 changes: 18 additions & 18 deletions src/main/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const preferencesConfig = {
label: 'Welcome to CrossOver',
fields: [
{
content: '<p>Use <code>CTRL+ALT+SHIFT+X</code> to lock CrossOver in place and hide the background window.</p>',
content: '<p><b>Use <code>CTRL+ALT+SHIFT+X</code> to lock CrossOver in place and hide the background window.</b></p>',
type: 'message',
},
],
Expand Down Expand Up @@ -133,6 +133,16 @@ const preferencesConfig = {
treatPackageAsDirectory: false, // (macos) Treat packages, such as .app folders, as a directory instead of a file.
dontAddToRecent: true, // (windows) Do not add the item being opened to the recent documents list.
},
{
label: 'Reticle',
key: 'reticle',
type: 'radio',
options: [
{ label: 'Dot', value: 'dot' },
{ label: 'Cross', value: 'cross' },
{ label: 'No reticle', value: 'off' },
],
},
{
label: 'Crosshair Size',
key: 'size',
Expand All @@ -148,14 +158,12 @@ const preferencesConfig = {
max: 100,
},
{
label: 'Reticle',
key: 'reticle',
type: 'radio',
options: [
{ label: 'Dot', value: 'dot' },
{ label: 'Cross', value: 'cross' },
{ label: 'No reticle', value: 'off' },
],
label: 'Reticle Scale',
key: 'reticleScale',
type: 'slider',
min: 1,
max: 500,
help: 'Reticle scale percentage (compared to crosshair)',
},
{
label: 'Reticle Color',
Expand All @@ -164,14 +172,6 @@ const preferencesConfig = {
format: 'hex', // Can be hex, hsl or rgb
help: 'Center reticle color',
},
{
label: 'Reticle Scale',
key: 'reticleScale',
type: 'slider',
min: 1,
max: 500,
help: 'Reticle scale percentage (compared to crosshair)',
},
{
heading: 'SVG Customization Options',
},
Expand Down Expand Up @@ -211,7 +211,7 @@ const preferencesConfig = {
},
{
id: 'actions',
label: 'Crosshair Actions',
label: 'Mouse Actions',
icon: 'turtle',
form: {
groups: [
Expand Down
4 changes: 3 additions & 1 deletion src/main/tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ const init = () => {
}

tray.instance = new Tray( getIconPath() )

console.log( preferencesMenuItems )
const contextMenu = Menu.buildFromTemplate( [
showAppMenuItem,
...preferencesMenuItems,
preferencesMenuItems,
openCustomImageMenuItem,
resetMenuItem,
{ role: 'quit' },
Expand Down

0 comments on commit 9dfd4fd

Please sign in to comment.