added vscode extensions

This commit is contained in:
tomit4 2021-11-05 11:26:45 -07:00
parent 7cde0829be
commit 26e2a50441
316 changed files with 37301 additions and 0 deletions

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Language="en-US" Id="glassit" Version="0.2.3" Publisher="s-nlf-fh"/>
<DisplayName>GlassIt-VSC</DisplayName>
<Description xml:space="preserve">VS Code Extension to set window to transparent on Windows and Linux platforms.</Description>
<Tags>keybindings</Tags>
<Categories>Themes,Other</Categories>
<GalleryFlags>Public</GalleryFlags>
<Badges><Badge Link="https://marketplace.visualstudio.com/items?itemName=s-nlf-fh.glassit" ImgUri="https://vsmarketplacebadge.apphb.com/version/s-nlf-fh.glassit.svg" Description="Latest Version" /><Badge Link="https://marketplace.visualstudio.com/items?itemName=s-nlf-fh.glassit" ImgUri="https://vsmarketplacebadge.apphb.com/installs/s-nlf-fh.glassit.svg" Description="Total Downloads" /><Badge Link="https://marketplace.visualstudio.com/items?itemName=s-nlf-fh.glassit" ImgUri="https://vsmarketplacebadge.apphb.com/rating/s-nlf-fh.glassit.svg" Description="Ratings" /></Badges>
<Properties>
<Property Id="Microsoft.VisualStudio.Code.Engine" Value="^1.40.0" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionDependencies" Value="" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value="" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionKind" Value="ui" />
<Property Id="Microsoft.VisualStudio.Code.LocalizedLanguages" Value="" />
<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="https://github.com/hikarin522/GlassIt-VSC.git" />
<Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="https://github.com/hikarin522/GlassIt-VSC.git" />
<Property Id="Microsoft.VisualStudio.Services.Links.GitHub" Value="https://github.com/hikarin522/GlassIt-VSC.git" />
<Property Id="Microsoft.VisualStudio.Services.Links.Support" Value="https://github.com/hikarin522/GlassIt-VSC/issues" />
<Property Id="Microsoft.VisualStudio.Services.GitHubFlavoredMarkdown" Value="true" />
</Properties>
<License>extension/LICENSE.txt</License>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Code"/>
</Installation>
<Dependencies/>
<Assets>
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="extension/package.json" Addressable="true" />
<Asset Type="Microsoft.VisualStudio.Services.Content.Details" Path="extension/README.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Content.Changelog" Path="extension/CHANGELOG.md" Addressable="true" /><Asset Type="Microsoft.VisualStudio.Services.Content.License" Path="extension/LICENSE.txt" Addressable="true" />
</Assets>
</PackageManifest>

View file

@ -0,0 +1,42 @@
# Change Log
## [0.2.3]
- Add minimize, maximize command (#21)
## [0.2.2]
- bugfix
## [0.2.1]
- Merge pull request [#18](https://github.com/hikarin522/GlassIt-VSC/issues/18)
## [0.2.0]
- Add Linux suport 
## [0.1.6]
- fix: error log output encoding
- fix: powershell option execution policy
- fix: powershell option noProfile
## [0.1.5]
## [0.1.4]
- Fix to work only on windows
## [0.1.3]
- update
## [0.1.2]
- Fixed problem not working with PowerSell 2.0
## [0.1.1]
- Optimisation
## [0.1.0]
- Changed not to use 'SetTransparency.exe'
- Delete 'glassit.path' from option
## [0.0.2]
- Bug fixes
## [0.0.1]
- Initial release

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 hikarin522
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,42 @@
# GlassIt-VSC
[![Version](https://vsmarketplacebadge.apphb.com/version/s-nlf-fh.glassit.svg)](https://marketplace.visualstudio.com/items?itemName=s-nlf-fh.glassit)
[![Installs](https://vsmarketplacebadge.apphb.com/installs/s-nlf-fh.glassit.svg)](https://marketplace.visualstudio.com/items?itemName=s-nlf-fh.glassit)
[![Ratings](https://vsmarketplacebadge.apphb.com/rating/s-nlf-fh.glassit.svg)](https://marketplace.visualstudio.com/items?itemName=s-nlf-fh.glassit)
VS Code Extension to set window to transparent on Windows and Linux platforms.
This extension is the VS Code version of [GlassIt](https://packagecontrol.io/packages/GlassIt) of Sublime Text plugin.
## Features
* With this extension, you can change the window transparency by key pressing.
## Requirements
### Windows
- Windows 7 or higher
### Linux
- Xorg display server
- [xprop](https://www.x.org/releases/X11R7.5/doc/man/man1/xprop.1.html) package.
## Usage
Change the transparency level by:
* Press "ctrl+alt+z" to increase the transparency, "ctrl+alt+c" to decrease.
## Extension Settings
* `glassit.alpha` (`integer`): Transparency level [1-255].
* `glassit.step` (`integer`): Increment of alpha.
## LINK
* [https://marketplace.visualstudio.com/items?itemName=s-nlf-fh.glassit](https://marketplace.visualstudio.com/items?itemName=s-nlf-fh.glassit)
* [https://github.com/hikarin522/GlassIt-VSC](https://github.com/hikarin522/GlassIt-VSC)
* [https://packagecontrol.io/packages/GlassIt](https://packagecontrol.io/packages/GlassIt)
* [https://github.com/ivellioscolin/sublime-plugin-glassit](https://github.com/ivellioscolin/sublime-plugin-glassit)
## Changelog
See CHANGELOG.md

View file

@ -0,0 +1,98 @@
using System;
using System.Runtime.InteropServices;
using System.Diagnostics;
using Windows;
namespace GlassIt
{
public static class SetTransParency
{
public static bool SetTransparency(int pid, byte alpha)
{
Process mainproc = Process.GetProcessById(pid);
foreach (Process proc in Process.GetProcessesByName(mainproc.ProcessName))
{
if (proc.StartInfo.FileName != mainproc.StartInfo.FileName)
{
continue;
}
IntPtr hMainWnd = proc.MainWindowHandle;
if (hMainWnd == IntPtr.Zero)
{
continue;
}
uint tid = User32.GetWindowThreadProcessId(hMainWnd, out pid);
bool result = User32.EnumThreadWindows(tid, delegate(IntPtr hWnd, IntPtr lParam) {
if (!User32.IsWindowVisible(hWnd))
{
return true;
}
WS windowLong = User32.GetWindowLong(hWnd, GWL.EXSTYLE);
User32.SetWindowLong(hWnd, GWL.EXSTYLE, windowLong | WS.EX_LAYERED);
return User32.SetLayeredWindowAttributes(hWnd, 0, alpha, LWA.ALPHA);
}, IntPtr.Zero);
if (!result)
{
return false;
}
}
return true;
}
}
}
namespace Windows
{
internal static class User32
{
public delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
[DllImport("user32.dll")]
public static extern bool EnumThreadWindows(uint dwThreadId, EnumWindowsProc lpEnumFunc, IntPtr lParam);
[DllImport("user32.dll")]
public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out int lpdwProcessId);
[DllImport("user32.dll")]
public static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern WS GetWindowLong(IntPtr hWnd, GWL nIndex);
[DllImport("user32.dll")]
public static extern int SetWindowLong(IntPtr hWnd, GWL nIndex, WS dwNewLong);
[DllImport("user32.dll")]
public static extern bool SetLayeredWindowAttributes(IntPtr hWnd, uint crKey, byte bAlpha, LWA dwFlags);
}
internal enum GWL: int
{
EXSTYLE = -20,
HINSTANCE = -6,
HWNDPARENT = -8,
ID = -12,
STYLE = -16,
USERDATA = -21,
WNDPROC = -4,
}
[Flags]
internal enum WS: int
{
EX_LAYERED = 0x80000,
}
internal enum LWA: int
{
COLORKEY = 1,
ALPHA = 2,
}
}

View file

@ -0,0 +1,126 @@
const { workspace, window, commands } = require('vscode');
const shell = require('node-powershell');
function activate(context) {
if (process.platform == 'win32') {
const path = context.asAbsolutePath('./SetTransparency.cs');
const ps = new shell({
executionPolicy: 'RemoteSigned',
noProfile: true,
});
context.subscriptions.push(ps);
ps.addCommand('[Console]::OutputEncoding = [Text.Encoding]::UTF8');
ps.addCommand(`Add-Type -Path '${path}'`);
function setAlpha(alpha) {
if (alpha < 1) {
alpha = 1;
} else if (alpha > 255) {
alpha = 255;
}
ps.addCommand(`[GlassIt.SetTransParency]::SetTransParency(${process.pid}, ${alpha})`);
ps.invoke().then(res => {
console.log(res);
console.log(`GlassIt: set alpha ${alpha}`);
config().update('alpha', alpha, true);
}).catch(err => {
console.error(err);
window.showErrorMessage(`GlassIt Error: ${err}`);
});
}
} else if (process.platform == 'linux'){
const cp = require('child_process');
// Checking the weather xprop has installed
try {
cp.spawnSync('which xprop').toString();
} catch (error){
console.error(`GlassIt Error: Please install xprop package to use GlassIt.`);
return;
}
// Retrieving the process ids of VS code
const processIds = cp.execSync('pgrep \'code\'').toString().split('\n');
processIds.pop();
// Retrieving all window ids
const allWindowIdsOutput = cp.execSync(
`xprop -root | grep '_NET_CLIENT_LIST(WINDOW)'`
).toString();
const allWindowIds = allWindowIdsOutput.match(/0x[\da-f]+/ig);
const codeWindowIds = [];
for(const windowId of allWindowIds){
// Checking the weather the window has a associated process
const hasProcessId = cp.execSync(`xprop -id ${windowId} _NET_WM_PID`).toString();
if(!(hasProcessId.search('not found')+1)){
// Extract process id from the result
const winProcessId = hasProcessId.replace(/([a-zA-Z_\(\)\s\=])/g,'');
if(processIds.includes(winProcessId)){
codeWindowIds.push(windowId);
}
}
}
function setAlpha(alpha){
if (alpha < 1) {
alpha = 1;
} else if (alpha > 255) {
alpha = 255;
}
for(const codeWindowId of codeWindowIds){
cp.exec(`xprop -id ${codeWindowId} -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY $(printf 0x%x $((0xffffffff * ${alpha} / 255)))`, function(error,stdout, stderr){
if (error) {
console.error(`GlassIt error: ${error}`);
return;
}
console.log(stdout.toString());
console.log(`GlassIt: set alpha ${alpha}`);
config().update('alpha', alpha, true);
});
}
}
} else {
return;
}
console.log('Congratulations, your extension "GlassIt VSC" is now active!');
const config = () => workspace.getConfiguration('glassit');
context.subscriptions.push(commands.registerCommand('glassit.increase', () => {
const alpha = config().get('alpha') - config().get('step');
setAlpha(alpha);
}));
context.subscriptions.push(commands.registerCommand('glassit.decrease', () => {
const alpha = config().get('alpha') + config().get('step');
setAlpha(alpha);
}));
context.subscriptions.push(commands.registerCommand('glassit.maximize', () => {
setAlpha(1);
}));
context.subscriptions.push(commands.registerCommand('glassit.minimize', () => {
setAlpha(255);
}));
const alpha = config().get('alpha');
setAlpha(alpha);
}
exports.activate = activate;
function deactivate() {
}
exports.deactivate = deactivate;

View file

@ -0,0 +1,107 @@
{
"name": "glassit",
"displayName": "GlassIt-VSC",
"description": "VS Code Extension to set window to transparent on Windows and Linux platforms.",
"version": "0.2.3",
"publisher": "s-nlf-fh",
"license": "MIT",
"engines": {
"vscode": "^1.40.0"
},
"extensionKind": [
"ui"
],
"categories": [
"Themes",
"Other"
],
"repository": {
"type": "git",
"url": "https://github.com/hikarin522/GlassIt-VSC.git"
},
"badges": [
{
"url": "https://vsmarketplacebadge.apphb.com/version/s-nlf-fh.glassit.svg",
"description": "Latest Version",
"href": "https://marketplace.visualstudio.com/items?itemName=s-nlf-fh.glassit"
},
{
"url": "https://vsmarketplacebadge.apphb.com/installs/s-nlf-fh.glassit.svg",
"description": "Total Downloads",
"href": "https://marketplace.visualstudio.com/items?itemName=s-nlf-fh.glassit"
},
{
"url": "https://vsmarketplacebadge.apphb.com/rating/s-nlf-fh.glassit.svg",
"description": "Ratings",
"href": "https://marketplace.visualstudio.com/items?itemName=s-nlf-fh.glassit"
}
],
"bugs": {
"url": "https://github.com/hikarin522/GlassIt-VSC/issues",
"email": "hikarin522@outlook.jp"
},
"activationEvents": [
"*"
],
"main": "./extension",
"contributes": {
"configuration": {
"title": "GlassIt VSC configuration",
"properties": {
"glassit.alpha": {
"type": "integer",
"default": 220,
"description": "Transparency level [1-255]"
},
"glassit.step": {
"type": "integer",
"default": 5,
"description": "Increment of alpha"
}
}
},
"commands": [
{
"command": "glassit.increase",
"title": "GlassIt: Increase the transparency"
},
{
"command": "glassit.decrease",
"title": "GlassIt: Decrease the transparency"
},
{
"command": "glassit.maximize",
"title": "GlassIt: Maximize the transparency"
},
{
"command": "glassit.minimize",
"title": "GlassIt: Minimize the transparency"
}
],
"keybindings": [
{
"command": "glassit.increase",
"key": "ctrl+alt+z"
},
{
"command": "glassit.decrease",
"key": "ctrl+alt+c"
},
{
"command": "glassit.minimize",
"key": "ctrl+alt+x"
}
]
},
"scripts": {},
"devDependencies": {},
"dependencies": {
"node-powershell": "^4.0.0"
},
"__metadata": {
"id": "7f4f553c-204c-42fe-9b4d-7a3f11f7335b",
"publisherId": "f39c25eb-2c51-4821-97b3-8718f85c8e5f",
"publisherDisplayName": "hikarin522",
"installedTimestamp": 1630901124378
}
}