diff --git a/gui/main.js b/gui/main.js index cc0e4ce2..05660ba8 100644 --- a/gui/main.js +++ b/gui/main.js @@ -229,9 +229,14 @@ function createWindow() { // Emitted when the window is closed. win.on('closed', function() { + console.log("closing all windows.....") + /* win = null; chat = null; logViewer = null; + */ + close_all(); + }) @@ -357,52 +362,10 @@ app.whenReady().then(() => { }) }) + app.on('window-all-closed', () => { - - - // closing the tnc binary if not closed when closing application and also our daemon which has been started by the gui - try { - daemonProcess.kill(); - } catch (e) { - mainLog.error(e) - } - + close_all(); - mainLog.warn('closing tnc'); - - if(os.platform()=='win32' || os.platform()=='win64'){ - exec('Taskkill', ['/IM', 'freedata-tnc.exe', '/F']) - } - - if(os.platform()=='linux'){ - - exec('pkill', ['-9', 'freedata-tnc']) - - // on macOS we need to kill the daemon as well. If we are not doing this, - // the daemon wont startup again because the socket is already in use - //for some reason killing the daemon is killing our screen on Ubuntu..it seems theres another "daemon" out there... - exec('pkill', ['-9', 'freedata-daemon']) - } - - if(os.platform()=='darwin'){ - - exec('pkill', ['-9', 'freedata-tnc']) - - // on macOS we need to kill the daemon as well. If we are not doing this, - // the daemon wont startup again because the socket is already in use - //for some reason killing the daemon is killing our screen on Ubuntu..it seems theres another "daemon" out there... - exec('pkill', ['-9', 'freedata-daemon']) - - } - - /* - if (process.platform !== 'darwin') { - app.quit(); - } - */ - mainLog.warn('quitting app'); - app.quit(); - }) // IPC HANDLER @@ -610,3 +573,57 @@ autoUpdater.on('error', (error) => { +function close_all() { + + // function for closing the application with closing all used processes + + // closing the tnc binary if not closed when closing application and also our daemon which has been started by the gui + try { + daemonProcess.kill(); + } catch (e) { + mainLog.error(e) + } + + + mainLog.warn('closing tnc'); + + if(os.platform()=='win32' || os.platform()=='win64'){ + exec('Taskkill', ['/IM', 'freedata-tnc.exe', '/F']) + } + + if(os.platform()=='linux'){ + + exec('pkill', ['-9', 'freedata-tnc']) + + // on macOS we need to kill the daemon as well. If we are not doing this, + // the daemon wont startup again because the socket is already in use + //for some reason killing the daemon is killing our screen on Ubuntu..it seems theres another "daemon" out there... + exec('pkill', ['-9', 'freedata-daemon']) + } + + if(os.platform()=='darwin'){ + + exec('pkill', ['-9', 'freedata-tnc']) + + // on macOS we need to kill the daemon as well. If we are not doing this, + // the daemon wont startup again because the socket is already in use + //for some reason killing the daemon is killing our screen on Ubuntu..it seems theres another "daemon" out there... + exec('pkill', ['-9', 'freedata-daemon']) + + } + + /* + if (process.platform !== 'darwin') { + app.quit(); + } + */ + mainLog.warn('quitting app'); + + win.destroy(); + chat.destroy(); + logViewer.destroy(); + + app.quit(); +} + + diff --git a/gui/package.json b/gui/package.json index 0ba7402b..5a6395b9 100644 --- a/gui/package.json +++ b/gui/package.json @@ -1,6 +1,6 @@ { "name": "FreeDATA", - "version": "0.3.0-alpha.6", + "version": "0.3.0-alpha.7", "description": "FreeDATA ", "main": "main.js", "scripts": { diff --git a/tnc/audio.py b/tnc/audio.py index baa2be0a..cb350dfa 100644 --- a/tnc/audio.py +++ b/tnc/audio.py @@ -96,7 +96,6 @@ def fetch_audio_devices(input_devices, output_devices): sd._terminate() sd._initialize() - devices = sd.query_devices(device=None, kind=None) index = 0 for device in devices: @@ -108,6 +107,7 @@ def fetch_audio_devices(input_devices, output_devices): #maxOutputChannels = p.get_device_info_by_host_api_device_index(0, i).get('maxOutputChannels') #name = p.get_device_info_by_host_api_device_index(0, i).get('name') name = device["name"] + maxOutputChannels = device["max_output_channels"] maxInputChannels = device["max_input_channels"]