Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Tabby
提交
d104f5e7
T
Tabby
项目概览
后端镜像
/
Tabby
通知
33
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tabby
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d104f5e7
编写于
10月 05, 2018
作者:
E
Eugene Pankov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reimplemented Windows vibrancy using windows-swca and windows-blurbehind (#383)
上级
5b5d145b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
10 deletion
+46
-10
app/lib/window.ts
app/lib/window.ts
+34
-10
app/package.json
app/package.json
+2
-0
app/webpack.main.config.js
app/webpack.main.config.js
+2
-0
app/yarn.lock
app/yarn.lock
+8
-0
未找到文件。
app/lib/window.ts
浏览文件 @
d104f5e7
...
...
@@ -3,12 +3,21 @@ import { BrowserWindow, app, ipcMain, Rectangle } from 'electron'
import
ElectronConfig
=
require
(
'
electron-config
'
)
import
*
as
yaml
from
'
js-yaml
'
import
*
as
fs
from
'
fs
'
import
*
as
os
from
'
os
'
import
*
as
path
from
'
path
'
let
electronVibrancy
:
any
if
(
process
.
platform
!==
'
linux
'
)
{
let
SetWindowCompositionAttribute
:
any
let
AccentState
:
any
let
DwmEnableBlurBehindWindow
:
any
if
(
process
.
platform
===
'
darwin
'
)
{
electronVibrancy
=
require
(
'
electron-vibrancy
'
)
}
if
(
process
.
platform
===
'
win32
'
)
{
SetWindowCompositionAttribute
=
require
(
'
windows-swca
'
).
SetWindowCompositionAttribute
AccentState
=
require
(
'
windows-swca
'
).
AccentState
DwmEnableBlurBehindWindow
=
require
(
'
windows-blurbehind
'
).
DwmEnableBlurBehindWindow
}
export
class
Window
{
ready
:
Promise
<
void
>
...
...
@@ -42,6 +51,7 @@ export class Window {
webPreferences
:
{
webSecurity
:
false
},
frame
:
false
,
show
:
false
,
backgroundColor
:
'
#00000000
'
}
Object
.
assign
(
options
,
this
.
windowBounds
)
...
...
@@ -53,10 +63,6 @@ export class Window {
}
}
if
(
process
.
platform
===
'
win32
'
&&
(
configData
.
appearance
||
{}).
vibrancy
)
{
options
.
transparent
=
true
}
if
(
process
.
platform
===
'
linux
'
)
{
options
.
backgroundColor
=
'
#131d27
'
}
...
...
@@ -95,11 +101,29 @@ export class Window {
}
setVibrancy
(
enabled
:
boolean
)
{
if
(
enabled
&&
!
this
.
vibrancyViewID
)
{
this
.
vibrancyViewID
=
electronVibrancy
.
SetVibrancy
(
this
.
window
,
0
)
}
else
if
(
!
enabled
&&
this
.
vibrancyViewID
)
{
electronVibrancy
.
RemoveView
(
this
.
window
,
this
.
vibrancyViewID
)
this
.
vibrancyViewID
=
null
if
(
process
.
platform
===
'
win32
'
)
{
if
(
parseFloat
(
os
.
release
())
>=
10
)
{
let
attribValue
=
AccentState
.
ACCENT_DISABLED
let
color
=
0x00000000
if
(
enabled
)
{
if
(
parseInt
(
os
.
release
().
split
(
'
.
'
)[
2
])
>=
17063
)
{
attribValue
=
AccentState
.
ACCENT_ENABLE_FLUENT
color
=
0x01000000
// using a small alpha because acrylic bugs out at full transparency.
}
else
{
attribValue
=
AccentState
.
ACCENT_ENABLE_BLURBEHIND
}
}
SetWindowCompositionAttribute
(
this
.
window
,
attribValue
,
color
)
}
else
{
DwmEnableBlurBehindWindow
(
this
.
window
,
enabled
)
}
}
else
if
(
process
.
platform
===
'
darwin
'
)
{
if
(
enabled
&&
!
this
.
vibrancyViewID
)
{
this
.
vibrancyViewID
=
electronVibrancy
.
SetVibrancy
(
this
.
window
,
0
)
}
else
if
(
!
enabled
&&
this
.
vibrancyViewID
)
{
electronVibrancy
.
RemoveView
(
this
.
window
,
this
.
vibrancyViewID
)
this
.
vibrancyViewID
=
null
}
}
}
...
...
app/package.json
浏览文件 @
d104f5e7
...
...
@@ -31,6 +31,8 @@
"ngx-toastr"
:
"^8.7.3"
,
"path"
:
"0.12.7"
,
"rxjs"
:
"^6.1.0"
,
"windows-blurbehind"
:
"^1.0.0"
,
"windows-swca"
:
"^1.1.1"
,
"yargs"
:
"^12.0.1"
,
"zone.js"
:
"~0.8.26"
},
...
...
app/webpack.main.config.js
浏览文件 @
d104f5e7
...
...
@@ -41,6 +41,8 @@ module.exports = {
mz
:
'
commonjs mz
'
,
path
:
'
commonjs path
'
,
yargs
:
'
commonjs yargs
'
,
'
windows-swca
'
:
'
commonjs windows-swca
'
,
'
windows-blurbehind
'
:
'
commonjs windows-blurbehind
'
,
},
plugins
:
[
new
webpack
.
optimize
.
ModuleConcatenationPlugin
(),
...
...
app/yarn.lock
浏览文件 @
d104f5e7
...
...
@@ -532,6 +532,14 @@ which@^1.2.9:
dependencies:
isexe "^2.0.0"
windows-blurbehind@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/windows-blurbehind/-/windows-blurbehind-1.0.0.tgz#050efb988704c44335bdc3efefd757f6e463b8ac"
windows-swca@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/windows-swca/-/windows-swca-1.1.1.tgz#0b3530278c67d408baac71c3a6aeb16d55318bf8"
wrap-ansi@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录