How to use the electron.remote.getCurrentWindow function in electron

To help you get started, we’ve selected a few electron examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kura52 / sushi-browser / src / render / MenuOperation.js View on Github external
windowResizeForSplit(){
    const win = remote.getCurrentWindow()

    if(win._isFullScreen){
      if(isDarwin){
        win.setFullScreen(!win._isFullScreen)
      }
      else{
        ipc.send('toggle-fullscreen')
      }
    }
    else if(win.isMaximized()){
      // win.unmaximize()
      if(win.nativeWindow.hidePanel) return
      win.nativeWindow.showWindow(9)
    }
  }
}
github MoeFE / GoogleTranslate / src / renderer / views / Translate.tsx View on Github external
import { State, Getter, Mutation } from 'vuex-class';
import startCase from 'lodash/startCase';
import styled, { css } from 'vue-emotion';
import anime from 'animejs';
import * as tjs from 'translation.js';
import Layout, { Main } from 'components/Layout';
import Header from 'components/Header';
import Icon, { IconProps } from 'components/Icon';
import Language from 'components/Language';
import Progress, { Spin } from 'components/Progress';
import * as Tools from '@/utils';
import { IState, ILang } from '@/store';

const isDevelopment = process.env.NODE_ENV !== 'production';
const { app, Menu, MenuItem, Notification } = remote;
const window = remote.getCurrentWindow();
const notice = new Notification({
  title: 'Google ηΏ»θ―‘',
  body: 'Google ηΏ»θ―‘ε·²ζ˜―ζœ€ζ–°η‰ˆζœ¬',
});
const errMsg: {
  [index: string]: string;
} = {
  NETWORK_ERROR: 'η½‘η»œηΉεΏ™οΌŒθ―·η¨εŽε†θ―•',
  API_SERVER_ERROR: '当前翻译ζŽ₯口不可用',
  UNSUPPORTED_LANG: 'ε½“ε‰εΌ•ζ“ŽδΈζ”―ζŒηΏ»θ―‘θ―₯语种',
  NETWORK_TIMEOUT: 'ηΏ»θ―‘ζŽ₯口袅既',
};

// #region stylesheet
const header = css`
  .icon-fixed {
github felixrieseberg / introducing-electron-editor / src / renderer.js View on Github external
const fs = require('fs')
const os = require('os')
const path = require('path')
const { remote, ipcRenderer } = require('electron')
const loader = require('monaco-loader')

const rendererWindow = remote.getCurrentWindow()
let monaco = null
let editor = null
let currentUrl = null

async function openFile(filePath) {
  const extension = path.extname(filePath)
  const filetypes = {
    '.js': 'javascript',
    '.css': 'css'
  }
  const filetype = filetypes[extension] || 'text'

  currentUrl = filePath

  if (monaco && editor) {
    try {
github SmithersAssistant / smithers / src / components / layout / Tabs.js View on Github external
click () {
        removeOtherTabs(id)
      }
    }, {
      label: 'Close Tabs To The Left',
      enabled: canCloseToTheLeft,
      click () {
        removeTabsToTheLeft(id)
      }
    }, {
      label: 'Close Tabs To The Right',
      enabled: canCloseToTheRight,
      click () {
        removeTabsToTheRight(id)
      }
    }]).popup(remote.getCurrentWindow())
  }
github web-pal / chronos-timetracker / app / renderer / sagas / initialize.js View on Github external
function* issueWindow(url) {
  let win = null;
  try {
    win = yield eff.call(
      windowsManagerSagas.forkNewWindow,
      {
        url,
        showOnReady: false,
        BrowserWindow: remote.BrowserWindow,
        options: {
          backgroundColor: 'white',
          show: false,
          modal: true,
          parent: remote.getCurrentWindow(),
          useContentSize: true,
          center: true,
          title: 'Issue window',
          webPreferences: {
            webSecurity: false,
            nodeIntegration: false,
            preload: getPreload('issueFormPreload'),
            devTools: (
              config.issueWindowDevTools
              || process.env.DEBUG_PROD === 'true'
            ),
          },
        },
      },
    );
    while (true) {
github MarshallOfSound / Google-Play-Music-Desktop-Player-UNOFFICIAL- / src / renderer / generic / core / webviewLoader.js View on Github external
setTimeout(() => {
      webview.focus();
      webview.addEventListener('did-navigate', savePage);
      webview.addEventListener('did-navigate-in-page', savePage);

      const focusWebview = () => {
        document.querySelector('webview::shadow object').focus();
      };
      window.addEventListener('beforeunload', () => {
        remote.getCurrentWindow().removeListener('focus', focusWebview);
      });
      remote.getCurrentWindow().on('focus', focusWebview);
    }, 700);
  });
github vitrine-app / vitrine / sources / client / app / features / homescreen / InvisibleTaskBar.tsx View on Github external
public constructor() {
    super();
    this.currentWindow = remote.getCurrentWindow();
  }
github matthinc / HomeAssistantElectron / index.html View on Github external
window.onload =() => {
                var frame = document.getElementById('content_frame')
                frame.src = remote.getCurrentWindow().url

                //Remove HTML titlebar on Windows/Linux
                var titlebar = document.getElementById('titlebar')
                if (remote.getCurrentWindow().os != 'darwin') {
                    titlebar.parentNode.removeChild(titlebar)
                }
            }
github dzt / easy-proxy / static / app.js View on Github external
ipcRenderer.on('refreshMain', function(event) {
  remote.getCurrentWindow().reload();
});
github elyukai / optolith-client / src / App / Utilities / IOUtils.ts View on Github external
IO (async () => remote.dialog.showSaveDialog (
                      remote .getCurrentWindow (),
                      options
                    )
                    .then (res => then (guard (!res .canceled))  (normalize (res .filePath))))