All Projects → NyaomiDEV → Glasstron

NyaomiDEV / Glasstron

Licence: Apache-2.0 license
The go-to solution to Electron composition effects, such as blurry windows.

Programming Languages

javascript
184084 projects - #8 most used programming language
C++
36643 projects - #6 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to Glasstron

Translucenttb
A lightweight utility that makes the Windows taskbar translucent/transparent.
Stars: ✭ 8,816 (+3527.98%)
Mutual labels:  blur, acrylic
flutter acrylic
Flutter library for window acrylic, mica & transparency effects (Windows, macOS & Linux). 💙
Stars: ✭ 261 (+7.41%)
Mutual labels:  blur, acrylic
Win32-Acrylic-Effect
Demonstrates implementation of the Windows 10 Acrylic Effect on C++ Win32 Apps using DWM Private APIs and Direct Composition
Stars: ✭ 104 (-57.2%)
Mutual labels:  blur, acrylic
Glasscord
[BUGFIXES ONLY, SUPPORT WILL DROP MAR 1, 2021] Injecting composition effects into Electron applications!
Stars: ✭ 737 (+203.29%)
Mutual labels:  composition, blur
Supriya
A Python API for SuperCollider
Stars: ✭ 167 (-31.28%)
Mutual labels:  composition
Composer
Composer is a new programming model for composing cloud functions built on Apache OpenWhisk.
Stars: ✭ 131 (-46.09%)
Mutual labels:  composition
Mecca
Animated music editor in Clojurescript/re-frame
Stars: ✭ 125 (-48.56%)
Mutual labels:  composition
Puresharp
Puresharp is a Framework that provides the essential APIs (AOP, IOC, etc...) to productively build high quality (.NET 4.5.2+ & .NET Core 2.1+) applications through reliability, scalability and performance without no compromise
Stars: ✭ 120 (-50.62%)
Mutual labels:  composition
Gwion
🎵 strongly-timed musical programming language
Stars: ✭ 235 (-3.29%)
Mutual labels:  composition
Nstack
Type-safe, composable microservices for data analytics
Stars: ✭ 219 (-9.88%)
Mutual labels:  composition
Helio Workstation
One music sequencer for all major platforms, desktop and mobile
Stars: ✭ 2,257 (+828.81%)
Mutual labels:  composition
Functional Promises
Write code like a story w/ a powerful Fluent (function chaining) API
Stars: ✭ 141 (-41.98%)
Mutual labels:  composition
Swift Composable Navigator
An open source library for building deep-linkable SwiftUI applications with composition, testing and ergonomics in mind
Stars: ✭ 196 (-19.34%)
Mutual labels:  composition
Common Tags
🔖 Useful template literal tags for dealing with strings in ES2015+
Stars: ✭ 1,761 (+624.69%)
Mutual labels:  composition
Sheet Router
fast, modular client-side router
Stars: ✭ 219 (-9.88%)
Mutual labels:  composition
Typed
The TypeScript Standard Library
Stars: ✭ 124 (-48.97%)
Mutual labels:  composition
Metasync
Asynchronous Programming Library for JavaScript & Node.js
Stars: ✭ 164 (-32.51%)
Mutual labels:  composition
Swift Gen
🎱 Composable, transformable, controllable randomness.
Stars: ✭ 208 (-14.4%)
Mutual labels:  composition
Layerjs
layerJS: Javascript UI composition framework
Stars: ✭ 1,825 (+651.03%)
Mutual labels:  composition
Umbrella
"A collection of functional programming libraries that can be composed together. Unlike a framework, thi.ng is a suite of instruments and you (the user) must be the composer of. Geared towards versatility, not any specific type of music." — @loganpowell via Twitter
Stars: ✭ 2,186 (+799.59%)
Mutual labels:  composition

This project is EOL. Please use other equivalent modules for your newer apps.

Glasstron

A simple and reliable API to achieve blur and transparency across platforms (Windows/Linux/MacOS), so you don't have to panic with Electron bugs and messy code! Plus, it's really simple!

npm version indev version ko-fi patreon paypal

Quickstart

$ npm install glasstron
- OR -
$ yarn add glasstron
const glasstron = require('glasstron');
const electron = require('electron');
electron.app.commandLine.appendSwitch("enable-transparent-visuals");
electron.app.on('ready', () => {
	setTimeout(
		spawnWindow,
		process.platform == "linux" ? 1000 : 0
		// Electron has a bug on linux where it
		// won't initialize properly when using
		// transparency. To work around that, it
		// is necessary to delay the window
		// spawn function.
	);
});

function spawnWindow(){
	win = new glasstron.BrowserWindow({
		width: 800,
		height: 600,
		// ...
	});
	win.blurType = "acrylic";
	//              ^~~~~~~
	// Windows 10 1803+; for older versions you
	// might want to use 'blurbehind'
	win.setBlur(true);
	// ...
	return win;
}

// ...

NOTICE for projects using Webpack and similar: Glasstron uses __dirname internally, so you have to define it as an external module, or else it won't work on Windows.

Why Glasstron?

The problem

Let's face it: achieving composition effects on Electron is painful. For reference, here's quick summary of the amount of problems that arise when trying to blur the background of a window while keeping cross-compatibility.

  • On Windows: There are plenty of Node bindings, but this means having to recompile them everytime a new Electron version comes out (and there's a chance you relied on unmaintained bindings, so you'll have to switch to a new project). Plus, you lose Aero Snap features if you aren't careful enough.
  • On macOS: Achieving transparency and vibrancy on a window means that the backgroundColor window option must be set to transparent. Then, you must not call win.setBackgroundColor() or else it all breaks. (Tested on Electron 7.1.11 -- I hope this changed with more recent versions of it)
  • On Linux: there's literally nothing to request blurriness. No bindings at all. Nothing.

The solution

Glasstron takes care of those problems and it also aims to support composition effects on Linux. Its ease of use is a distinct feature, so it can be adopted in both new and running projects. It supports Electron 7.1+ without any problem (that's a bold claim, if I am wrong please open an issue).

Design and features

Glasstron provides a custom version of Electron's BrowserWindow export that's capable to deal with the common problems discussed earlier on its own. This means that it's simple to adopt and it doesn't break existing code as every call to broken methods is wrapped so nothing bad happens.

It also replaces the functionality of win.setBackgroundColor(): since there's no way to set a background color without breaking vibrancy materials on macOS, it will set the background color as injected CSS on the :root CSS selector. It can be overridden by CSS stylesheets, so be careful! (this was intended).

Note that Glasstron cannot do all the hard work (as with it prototype pollution will occur). Please look inside src/hacks.js to see common problems Glasstron used to solve automagically up until version 0.0.3.

I want to contribute to this madness!

Did you find a bug? File it in the issues section! Do you know how to fix stuff? Make a pull request! Or perhaps you want to send me a hug and a coffee? You can do so here!

Awesome applications using Glasstron

Projects related to Glasstron

  • Blur my Shell is used by Glasstron to request blurring of windows to the GNOME Shell.

License

Glasstron is licensed under the Apache 2.0 License

Copyright 2020-2022 Naomi Calabretta

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].