add screen.title property. misc.
This commit is contained in:
parent
5bdfc18daf
commit
02176938c9
|
@ -21,6 +21,8 @@ var blessed = require('blessed');
|
||||||
// Create a screen object.
|
// Create a screen object.
|
||||||
var screen = blessed.screen();
|
var screen = blessed.screen();
|
||||||
|
|
||||||
|
screen.title = 'my window title';
|
||||||
|
|
||||||
// Create a box perfectly centered horizontally and vertically.
|
// Create a box perfectly centered horizontally and vertically.
|
||||||
var box = blessed.box({
|
var box = blessed.box({
|
||||||
top: 'center',
|
top: 'center',
|
||||||
|
@ -194,6 +196,7 @@ The screen on which every other node renders.
|
||||||
- **grabKeys** - whether the focused element grabs all keypresses.
|
- **grabKeys** - whether the focused element grabs all keypresses.
|
||||||
- **lockKeys** - prevent keypresses from being received by any element.
|
- **lockKeys** - prevent keypresses from being received by any element.
|
||||||
- **hover** - the currently hovered element. only set if mouse events are bound.
|
- **hover** - the currently hovered element. only set if mouse events are bound.
|
||||||
|
- **title** - set or get window title.
|
||||||
|
|
||||||
##### Events:
|
##### Events:
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ if (~argv.indexOf('-h') || ~argv.indexOf('--help')) {
|
||||||
console.log('-s - Show seconds.');
|
console.log('-s - Show seconds.');
|
||||||
console.log('-n - No leading zero on hours.');
|
console.log('-n - No leading zero on hours.');
|
||||||
console.log('-d - Show date box.');
|
console.log('-d - Show date box.');
|
||||||
|
console.log('--skinny - Skinny text.');
|
||||||
return process.exit(0);
|
return process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +65,8 @@ var date = blessed.box({
|
||||||
date.hide();
|
date.hide();
|
||||||
|
|
||||||
var wid = ~argv.indexOf('--skinny') ? 1 : 2;
|
var wid = ~argv.indexOf('--skinny') ? 1 : 2;
|
||||||
var bch = ' ';
|
// var bch = ' ';
|
||||||
|
var bch = '│';
|
||||||
var inverse = true;
|
var inverse = true;
|
||||||
|
|
||||||
// var bch = '*';
|
// var bch = '*';
|
||||||
|
@ -1030,7 +1032,7 @@ function updateTime() {
|
||||||
|
|
||||||
if (~argv.indexOf('-d')) {
|
if (~argv.indexOf('-d')) {
|
||||||
date.show();
|
date.show();
|
||||||
date.setContent(d.toISOString());
|
date.setContent(d.toISOString().replace(/\.\d+/, ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
screen.render();
|
screen.render();
|
||||||
|
|
|
@ -1708,6 +1708,8 @@ Program.prototype.setG = function(val) {
|
||||||
// OSC Ps ; Pt BEL
|
// OSC Ps ; Pt BEL
|
||||||
// Set Text Parameters.
|
// Set Text Parameters.
|
||||||
Program.prototype.setTitle = function(title) {
|
Program.prototype.setTitle = function(title) {
|
||||||
|
this._title = title;
|
||||||
|
|
||||||
if (this.term('screen')) {
|
if (this.term('screen')) {
|
||||||
// Tmux pane
|
// Tmux pane
|
||||||
// if (process.env.TMUX) {
|
// if (process.env.TMUX) {
|
||||||
|
@ -1715,9 +1717,18 @@ Program.prototype.setTitle = function(title) {
|
||||||
// }
|
// }
|
||||||
return this._write('\x1bk' + title + '\x1b\\');
|
return this._write('\x1bk' + title + '\x1b\\');
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._write('\x1b]0;' + title + '\x07');
|
return this._write('\x1b]0;' + title + '\x07');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Program.prototype.__defineGetter__('title', function() {
|
||||||
|
return this._title;
|
||||||
|
});
|
||||||
|
|
||||||
|
Program.prototype.__defineSetter__('title', function(title) {
|
||||||
|
return this.setTitle(title);
|
||||||
|
});
|
||||||
|
|
||||||
// OSC Ps ; Pt ST
|
// OSC Ps ; Pt ST
|
||||||
// OSC Ps ; Pt BEL
|
// OSC Ps ; Pt BEL
|
||||||
// Reset colors
|
// Reset colors
|
||||||
|
|
|
@ -402,6 +402,14 @@ Screen.prototype.__proto__ = Node.prototype;
|
||||||
|
|
||||||
Screen.prototype.type = 'screen';
|
Screen.prototype.type = 'screen';
|
||||||
|
|
||||||
|
Screen.prototype.__defineGetter__('title', function() {
|
||||||
|
return this.program.title;
|
||||||
|
});
|
||||||
|
|
||||||
|
Screen.prototype.__defineSetter__('title', function(title) {
|
||||||
|
return this.program.title = title;
|
||||||
|
});
|
||||||
|
|
||||||
Screen.prototype.enter = function() {
|
Screen.prototype.enter = function() {
|
||||||
if (this.program.isAlt) return;
|
if (this.program.isAlt) return;
|
||||||
this.program.alternateBuffer();
|
this.program.alternateBuffer();
|
||||||
|
@ -4754,8 +4762,8 @@ Form.prototype.reset = function() {
|
||||||
case 'dir-manager':
|
case 'dir-manager':
|
||||||
el.refresh(el.options.cwd);
|
el.refresh(el.options.cwd);
|
||||||
return;
|
return;
|
||||||
case 'passbox':
|
case 'terminal':
|
||||||
el.clearInput();
|
el.write('');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
el.children.forEach(fn);
|
el.children.forEach(fn);
|
||||||
|
|
Loading…
Reference in New Issue