First, thanks for mentioning the "Lock Keys" extension. I was not aware of it and as you stated, it is nicely done.
It looks like most of the gnome-shell extensions use "gjs" which is the javascript bindings for the Gnome libraries. This piqued my interest because I have programmed Gtk/Gdk in C and also have done "some" javascript programming.
Anyway I came up with the following code that pops up a Gtk window displaying a message that stays on the screen for 5 secs. Notice that it can be styled using css. Just save the code somewhere and make the file executable. Of course the gjs package needs to be installed.
I don't know if this is anything like what you are looking for but hopefully it will be of some use.
Code:
#!/usr/bin/gjs
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const GLib = imports.gi.GLib;
class MessagePopup {
constructor() {
this.application = new Gtk.Application({
application_id: 'org.example.popup',
});
this.application.connect('activate', this._onActivate.bind(this));
this.application.connect('startup', this._onStartup.bind(this));
}
_onActivate() {
this._window.present();
}
_onStartup() {
this._createWidgets();
}
_createWidgets() {
this._window = new Gtk.Window({
application: this.application,
window_position: Gtk.WindowPosition.CENTER,
skip_taskbar_hint: true, // don't show in taskbar
default_height: 25,
default_width: 500
});
var msg;
if( !ARGV[0] ) {
msg='Usage: executable "message enclosed in quotes"';
}
else {
msg= ARGV[0];
}
this.label = new Gtk.Label({
label: msg
});
var css = new Gtk.CssProvider();
css.load_from_data(" * { font-size: 16px; font-weight: bold; color: white; background-color: black }");
this.label.get_style_context().add_provider(css, 0);
this._window.add (this.label);
this._window.set_decorated(false); // no title bar
this._window.show_all();
GLib.timeout_add( 0, 5000, () => this.application.quit() ); // close after 5 sec.
}
};
let app = new MessagePopup();
app.application.run (ARGV);
https://packages.ubuntu.com/focal/gjs
https://gitlab.gnome.org/GNOME/gjs/-...ster/README.md
Bookmarks