gnome-shell/tests/interactive/test-title.js
Giovanni Campagna 687e1eabed Overview: Resize the window title labels on content change
Reposition the window overlay when the title changes, using the current
transformed size of the window clone.
Includes a test that changes title to a string of random length every 3 seconds.

Based on a patch by Alex Hultman <alexhultman@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=620874
2012-10-27 18:18:48 +02:00

35 lines
601 B
JavaScript
Executable File

#!/usr/bin/env gjs
const Gtk = imports.gi.Gtk;
const Mainloop = imports.mainloop;
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() });
win.connect('destroy', Gtk.main_quit);
win.present();
Mainloop.timeout_add(5000, function() {
win.title = nextTitle();
return true;
});
Gtk.main();
}
main();