Skip to content
forked from rlamana/ventus

A window manager written in Javascript, HTML5 and CSS3. This fork, Adventus, implements GTK-compatible CSS classes to window elements, and other improvements such as compatibility with Framlr for Electron. If its the desire of the original author, this fork can cease by being merged upstream.

License

Notifications You must be signed in to change notification settings

Floflis/Adventus

 
 

Repository files navigation

Adventus WM Build Status Join the chat at https://gitter.im/rlamana/Ventus

A window manager written in Javascript, HTML5 and CSS3.

This fork, Adventus, implements GTK-compatible CSS classes to window elements, and other improvements such as compatibility with Framlr for Electron.

If its the desire of the original author, this fork can cease by being merged upstream.

Live Demo! (https://floflis.github.io/Adventus/examples/simple/) | Video Demo

Desktop Demo! (https://floflis.github.io/Adventus/examples/desktop/)

This project started as an experiment and even though it was stable enough it was never meant to be mantained over time. However, feel free to fork and send PRs!

Version 0.3.0 migrates code to webpack and ES6 and is available in branch: https://github.com/rlamana/Ventus/tree/v0.3.0.

Creating a new window manager

var wm = new Ventus.WindowManager();

Creating a new empty window

var window = wm.createWindow({
	title: 'A new window',
	x: 50,
	y: 50,
	width: 400,
	height: 250
});

window.open();

Creating a new empty window without animations and staying inside of the space

var window = wm.createWindow({
	title: 'A new window',
	x: 50,
	y: 50,
	width: 400,
	height: 250

	animations: false,
	stayinspace: true,
});

window.open();

Creating a new window wrapping a DOM Element

Using a query
wm.createWindow.fromQuery('#element .selector', {
	title: 'My App',
	width: 330,
	height: 400,
	x: 670,
	y: 60
});
Using a reference
wm.createWindow.fromElement(domElement, {
	title: 'My App',
	width: 500,
	height: 500,
	x: 0,
	y: 0
});

Listening to events

Defining handlers in constructor
var window = wm.createWindow({
	title: 'A new window',
	events: {
		open: function() {
			console.log('The window was open');
		},
		
		closed: function() {
			console.log('The window was closed');
		},
	}
});
Using the 'signals' property
var window = wm.createWindow({
	title: 'A new window'
});

window.signals.on('open', function() {
	console.log('The window was open');
});

Destroying a window

When a window is closed the content is not destroyed by default. This way windows can be open again keeping the wrapped DOM element. To completely destroy the window, the method 'destroy' needs to be called:

var window = wm.createWindow({
	title: 'A new window',
	events: {
		closed: function() {
			this.destroy();
		}
	}
});

About

A window manager written in Javascript, HTML5 and CSS3. This fork, Adventus, implements GTK-compatible CSS classes to window elements, and other improvements such as compatibility with Framlr for Electron. If its the desire of the original author, this fork can cease by being merged upstream.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 76.2%
  • Less 23.8%