////////////////////////////////////////////////////////////////////////////////////////// // ) ( // // ( /( ( ( ) ( ( ( ( )\ ) ( ( // // )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( // // ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ // // | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) // // | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< // // |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ // // |__/ // // Copyright (c) 2021 Simon Schneegans // // Released under the GPLv3 or later. See LICENSE file for details. // ////////////////////////////////////////////////////////////////////////////////////////// 'use strict'; const {Gtk} = imports.gi; const ExtensionUtils = imports.misc.extensionUtils; const Me = imports.misc.extensionUtils.getCurrentExtension(); // This method can be used to write a message to GNOME Shell's log. This is enhances // the standard log() functionality by prepending the extension's name and the location // where the message was logged. As the extensions name is part of the location, you // can more effectively watch the log output of GNOME Shell: // journalctl -f -o cat | grep -E 'particle-effects|' // This method is based on a similar script from the Fly-Pie GNOME Shell extension which // os published under the MIT License (https://github.com/Schneegans/Fly-Pie). function debug(message) { const stack = new Error().stack.split('\n'); // Remove debug() function call from stack. stack.shift(); // Find the index of the extension directory (e.g. particles@schneegans.github.com) in // the stack entry. We do not want to print the entire absolute file path. const extensionRoot = stack[0].indexOf(Me.metadata.uuid); log('[' + stack[0].slice(extensionRoot) + '] ' + message); } // This method simply returns true if we are currently using GTK4. function gtk4() { return Gtk.get_major_version() == 4; }