2012-10-19 16:37:29 +00:00
|
|
|
#!/usr/bin/env gjs
|
|
|
|
|
2017-02-15 00:46:52 +00:00
|
|
|
imports.gi.versions.Gtk = '3.0';
|
|
|
|
|
2019-08-19 18:50:33 +00:00
|
|
|
const { GLib, Gtk } = imports.gi;
|
2012-10-19 16:37:29 +00:00
|
|
|
|
|
|
|
function nextTitle() {
|
|
|
|
let length = Math.random() * 20;
|
|
|
|
let str = '';
|
|
|
|
|
|
|
|
for (let i = 0; i < length; i++) {
|
|
|
|
// 97 == 'a'
|
|
|
|
str += String.fromCharCode(97 + Math.random() * 26);
|
|
|
|
}
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
function main() {
|
|
|
|
Gtk.init(null);
|
|
|
|
|
|
|
|
let win = new Gtk.Window({ title: nextTitle() });
|
2018-02-21 11:40:55 +00:00
|
|
|
win.connect('destroy', () => {
|
|
|
|
Gtk.main_quit();
|
|
|
|
});
|
2012-10-19 16:37:29 +00:00
|
|
|
win.present();
|
|
|
|
|
2019-08-19 18:50:33 +00:00
|
|
|
GLib.timeout_add(GLib.PRIORITY_DEFAULT, 5000, function() {
|
2012-10-19 16:37:29 +00:00
|
|
|
win.title = nextTitle();
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
|
|
|
|
Gtk.main();
|
|
|
|
}
|
|
|
|
|
|
|
|
main();
|
|
|
|
|