-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextension.js
54 lines (46 loc) · 1.56 KB
/
extension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const vscode = require('vscode')
const shell = require('node-powershell')
function activate(context) {
const path = context.asAbsolutePath('./ToggleBorder.cs')
const ps = new shell({
executionPolicy: 'ByPass',
noProfile: true
})
context.subscriptions.push(ps)
ps.addCommand(`Add-Type -Path '${path}'`)
function toggleBorder(visible, borderType) {
let bordertype = 0;
switch (borderType){
case 'bordersizable': bordertype = 1; break;
case 'bordersimple': bordertype = 2; break;
}
ps.addCommand(`[CBS]::ToggleBorder(${process.pid}, ${visible}, ${bordertype})`)
ps.invoke().then(res => {
// console.log(res)
console.log(`Borderless: set visible ${visible}`)
//config.update('borderless', visible, true)
}).catch(err => {
console.log(err)
// vscode.window.showErrorMessage(`Borderless Error: ${err}`)
})
}
context.subscriptions.push(vscode.commands.registerCommand('borderless.on', () => {
// vscode.window.showInformationMessage('Title Bars enabled.')
toggleBorder(0,'any')
}))
context.subscriptions.push(vscode.commands.registerCommand('borderless.off', () => {
const config = vscode.workspace.getConfiguration('borderless')
const enabled = config.get('autoenable')
const bordertype = config.get('bordertype')
toggleBorder(1,bordertype)
}))
const config = vscode.workspace.getConfiguration('borderless')
const enabled = config.get('autoenable')
const bordertype = config.get('bordertype')
if (enabled){
toggleBorder(1, bordertype)
}
}
exports.activate = activate
function deactivate() {}
exports.deactivate = deactivate