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