Mstdn icon indicating copy to clipboard operation
Mstdn copied to clipboard

Hotkey to switch between full window and docked

Open bennettscience opened this issue 6 years ago • 0 comments

  • Your OS: macOS 10.13
  • App version: 0.2.6

Note: Set a hotkey to toggle the position of the app window, either in the menubar or full screen.

Allowing the user to toggle the window view would improve the desktop experience. Here's a really rough implementation via plugin:

module.exports = {
  preload(config, account) {
    fs.readFile('config.json', (err, data) => {
      if(err) { console.log(err) };
    })
  },
  keymaps:{
    'resize-window'(event, account, config) {
      event.preventDefault();
      // read the file to get the normal_window state
      fs.readFile('config.json', "utf8", (err, data) => {
        var configData = JSON.parse(data);

        // set the boolean and rewrite config.
        configData.normal_window = !configData.normal_window;
        fs.writeFile('config.json', JSON.stringify(configData, null, 2), function(err) {
          console.log(configData)
          if(err) { return console.log(err) }
        })
      })
    }
  }
}

I'm not really experienced with Node or Electron, so I'm not sure how to relaunch the application window to reload the config file. This would save time going in and out of config.json to reset the window state.

bennettscience avatar Mar 10 '18 20:03 bennettscience