新增不强制win7开启透明效果即可使用
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
const { mainHandle } = require('../../common/ipc')
|
||||
|
||||
mainHandle('getEnvParams', async(event, options) => {
|
||||
return global.envParams
|
||||
})
|
||||
|
||||
@@ -10,3 +10,4 @@ require('./showSaveDialog')
|
||||
require('./clearCache')
|
||||
require('./getCacheSize')
|
||||
require('./setIgnoreMouseEvent')
|
||||
require('./getEnvParams')
|
||||
|
||||
+5
-2
@@ -15,11 +15,14 @@ app.on('second-instance', (event, argv, cwd) => {
|
||||
}
|
||||
})
|
||||
|
||||
const { getWindowSizeInfo, parseEnv } = require('./utils')
|
||||
|
||||
global.envParams = parseEnv()
|
||||
|
||||
require('../common/error')
|
||||
require('./events')
|
||||
const autoUpdate = require('./utils/autoUpdate')
|
||||
const { isLinux, isMac } = require('../common/utils')
|
||||
const { getWindowSizeInfo } = require('./utils')
|
||||
|
||||
const isDev = process.env.NODE_ENV !== 'production'
|
||||
|
||||
@@ -50,7 +53,7 @@ function createWindow() {
|
||||
useContentSize: true,
|
||||
width: windowSizeInfo.width,
|
||||
frame: false,
|
||||
transparent: !isLinux,
|
||||
transparent: !isLinux && !global.envParams.nt,
|
||||
enableRemoteModule: false,
|
||||
// icon: path.join(global.__static, isWin ? 'icons/256x256.ico' : 'icons/512x512.png'),
|
||||
resizable: false,
|
||||
|
||||
@@ -6,3 +6,20 @@ exports.getWindowSizeInfo = () => {
|
||||
const { windowSizeId = 1 } = electronStore.get('setting') || {}
|
||||
return windowSizeList.find(i => i.id === windowSizeId) || windowSizeList[0]
|
||||
}
|
||||
|
||||
exports.parseEnv = () => {
|
||||
const params = {}
|
||||
const rx = /^-\w+/
|
||||
for (let param of process.argv) {
|
||||
if (!rx.test(param)) continue
|
||||
param = param.substring(1)
|
||||
let index = param.indexOf('=')
|
||||
if (index < 0) {
|
||||
params[param] = true
|
||||
} else {
|
||||
params[param.substring(0, index)] = param.substring(index + 1)
|
||||
}
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
|
||||
+21
-10
@@ -1,5 +1,5 @@
|
||||
<template lang="pug">
|
||||
#container(v-if="isProd && !isLinux" :class="theme" @mouseenter="enableIgnoreMouseEvents" @mouseleave="dieableIgnoreMouseEvents")
|
||||
#container(v-if="isProd && !isNt" :class="theme" @mouseenter="enableIgnoreMouseEvents" @mouseleave="dieableIgnoreMouseEvents")
|
||||
core-aside#left
|
||||
#right
|
||||
core-toolbar#toolbar
|
||||
@@ -20,7 +20,7 @@
|
||||
<script>
|
||||
import dnscache from 'dnscache'
|
||||
import { mapMutations, mapGetters, mapActions } from 'vuex'
|
||||
import { rendererOn, rendererSend } from '../common/ipc'
|
||||
import { rendererOn, rendererSend, rendererInvoke } from '../common/ipc'
|
||||
import { isLinux } from '../common/utils'
|
||||
import music from './utils/music'
|
||||
import { throttle, openUrl } from './utils'
|
||||
@@ -35,12 +35,15 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
isProd: process.env.NODE_ENV === 'production',
|
||||
isLinux,
|
||||
isNt: false,
|
||||
globalObj: {
|
||||
apiSource: 'test',
|
||||
proxy: {},
|
||||
},
|
||||
updateTimeout: null,
|
||||
envParams: {
|
||||
nt: false,
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -66,7 +69,7 @@ export default {
|
||||
}, 1000)
|
||||
},
|
||||
mounted() {
|
||||
document.body.classList.add(this.isLinux ? 'noTransparent' : 'transparent')
|
||||
document.body.classList.add(this.isNt ? 'noTransparent' : 'transparent')
|
||||
this.init()
|
||||
},
|
||||
watch: {
|
||||
@@ -109,11 +112,19 @@ export default {
|
||||
...mapMutations('download', ['updateDownloadList']),
|
||||
...mapMutations(['setSetting']),
|
||||
init() {
|
||||
rendererInvoke('getEnvParams').then(envParams => {
|
||||
this.envParams = envParams
|
||||
this.isNt = isLinux || this.envParams.nt
|
||||
if (this.isNt) {
|
||||
document.body.classList.remove('transparent')
|
||||
document.body.classList.add('noTransparent')
|
||||
}
|
||||
if (this.isProd && !this.isNt) {
|
||||
document.body.addEventListener('mouseenter', this.dieableIgnoreMouseEvents)
|
||||
document.body.addEventListener('mouseleave', this.enableIgnoreMouseEvents)
|
||||
}
|
||||
})
|
||||
document.body.addEventListener('click', this.handleBodyClick, true)
|
||||
if (this.isProd && !isLinux) {
|
||||
document.body.addEventListener('mouseenter', this.dieableIgnoreMouseEvents)
|
||||
document.body.addEventListener('mouseleave', this.enableIgnoreMouseEvents)
|
||||
}
|
||||
rendererOn('update-available', (e, info) => {
|
||||
// this.showUpdateModal(true)
|
||||
// console.log(info)
|
||||
@@ -173,12 +184,12 @@ export default {
|
||||
music.init()
|
||||
},
|
||||
enableIgnoreMouseEvents() {
|
||||
if (isLinux) return
|
||||
if (!this.isNt) return
|
||||
rendererSend('setIgnoreMouseEvents', false)
|
||||
// console.log('content enable')
|
||||
},
|
||||
dieableIgnoreMouseEvents() {
|
||||
if (isLinux) return
|
||||
if (!this.isNt) return
|
||||
// console.log('content disable')
|
||||
rendererSend('setIgnoreMouseEvents', true)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user