2012-10-19 16:37:29 +00:00
|
|
|
#!/usr/bin/env gjs
|
|
|
|
|
2023-03-08 19:25:13 +00:00
|
|
|
imports.gi.versions.Gtk = '4.0';
|
2023-06-08 04:52:46 +00:00
|
|
|
const Gtk = imports.gi.Gtk;
|
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;
|
|
|
|
}
|
|
|
|
|
2023-03-08 19:25:13 +00:00
|
|
|
const application = new Gtk.Application({application_id: 'org.gnome.TestTitle'});
|
|
|
|
application.connect('activate', () => {
|
|
|
|
const win = new Gtk.Window({
|
|
|
|
application,
|
|
|
|
title: nextTitle(),
|
2018-02-21 11:40:55 +00:00
|
|
|
});
|
2012-10-19 16:37:29 +00:00
|
|
|
win.present();
|
|
|
|
|
2023-03-08 19:25:13 +00:00
|
|
|
setInterval(() => (win.title = nextTitle()), 5000);
|
|
|
|
});
|
|
|
|
application.run(null);
|