Skip to content

Commit

Permalink
Add mini-mode to tray icon, provide visual feedback on list change. Re:
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsage committed Dec 2, 2023
1 parent 49c4bab commit 849a05e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modAssist_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1086,14 +1086,15 @@ ipcMain.on('toMain_findContextMenu', async (event, thisMod) => {
/** END : Find window operation*/

ipcMain.on('toMain_toggleMiniPin', () => { win.toggleAlwaysOnTop('mini'); refreshClientModList() })
ipcMain.on('toMain_openMiniMode', () => {
ipcMain.on('toMain_openMiniMode', () => { toggleMiniWindow() })

const toggleMiniWindow = () => {
if ( win.isValid('mini') && win.isVisible('mini') ) {
win.safeClose('mini')
} else {
win.createNamedWindow('mini')
}
})

}
/** Preferences window operation */
ipcMain.on('toMain_openPrefs', () => { win.createNamedWindow('prefs') })
ipcMain.on('toMain_getPref', (event, name) => { event.returnValue = mcStore.get(name) })
Expand Down Expand Up @@ -2327,6 +2328,10 @@ app.whenReady().then(() => {
label : myTranslator.syncStringLookup('tray_show'),
click : () => { win.win.main.show() },
},
{
label : myTranslator.syncStringLookup('mini_mode_button__title'),
click : () => { toggleMiniWindow() },
},
{
label : myTranslator.syncStringLookup('launch_game'),
click : () => { gameLauncher() },
Expand Down
12 changes: 12 additions & 0 deletions renderer/renderJS/mini_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ function clientMakeListActive() {

if ( activePick !== '0' && activePick !== '999' ) {
blinkLED()
fsgUtil.clsOrGate('active_button', true, 'btn-success', 'btn-warning')
flasherCounter = 0
flasherInterval = setInterval(() => {
flasherCounter++
if ( flasherCounter > 7 ) {
clearInterval(flasherInterval)
flasherInterval = null
fsgUtil.clsOrGate('active_button', false, 'btn-success', 'btn-warning')
} else {
fsgUtil.clsOrGate('active_button', flasherCounter%2 === 0, 'btn-success', 'btn-warning')
}
}, 250)
window.mods.makeActive(activePick)
}
}
Expand Down

0 comments on commit 849a05e

Please sign in to comment.