Commit ea78e468 authored by Sergio Costas's avatar Sergio Costas

Added a gnome shell extension to allow to use it with Wayland

parent 6fc44350
[D-BUS Service]
Name=com.rastersoft.terminus
Exec=@DBUS_PREFIX@/bin/terminus
Exec=@DBUS_PREFIX@/bin/terminus --guake
......@@ -92,6 +92,11 @@
<default><![CDATA['<Shift><Ctrl>F12']]></default>
<summary>Show Guake-style terminal</summary>
<description></description>
</key>
<key type="as" name="guake-mode-gnome-shell">
<default><![CDATA[['<Shift><Ctrl>F10']]]></default>
<summary>A copy of guake-mode in the format needed by gnome shell</summary>
<description></description>
</key>
</schema>
</schemalist>
......@@ -207,6 +207,10 @@ namespace Terminus {
return (v+1);
}
public void disable_keybind() {
bindkey.unset_bindkey();
}
public void show_guake() {
main_root.show_hide_global(0);
}
......
const Main = imports.ui.main;
const Shell = imports.gi.Shell;
const Meta = imports.gi.Meta;
const Gio = imports.gi.Gio;
const Lang = imports.lang;
const ExtensionUtils = imports.misc.extensionUtils;
const MyIface = '<node>\
<interface name="com.rastersoft.terminus">\
<method name="SwapGuake" />\
<method name="DisableKeybind" />\
<method name="DoPing" >\
<arg name="n" direction="in" type="i"/>\
<arg name="response" direction="out" type="i"/>\
</method>\
</interface>\
</node>';
const MyProxy = Gio.DBusProxy.makeProxyWrapper(MyIface);
const GioSSS = Gio.SettingsSchemaSource;
const TerminusClass = new Lang.Class({
Name: 'Terminus.Launcher',
_init: function() {
this._settings = new Gio.Settings({schema: 'org.rastersoft.terminus.keybindings'});
this._settingsChanged(null,"guake-mode"); // copy the guake-mode key to guake-mode-gnome-shell key
this._settingsChangedConnect = this._settings.connect('changed',Lang.bind(this,this._settingsChanged));
let mode = Shell.ActionMode ? Shell.ActionMode.NORMAL : Shell.KeyBindingMode.ALL;
let flags = Meta.KeyBindingFlags.NONE;
this.instance = null;
Main.wm.addKeybinding("guake-mode-gnome-shell",
this._settings,
flags,
mode,
Lang.bind(this, this.launch_function)
);
},
destroy: function() {
Main.wm.removeKeybinding("guake-mode");
},
launch_function: function() {
if (this.instance === null) {
this.instance = new MyProxy(Gio.DBus.session, 'com.rastersoft.terminus','/com/rastersoft/terminus');
this.instance.DisableKeybindSync();
}
this.instance.SwapGuakeSync();
},
_settingsChanged: function(st,name) {
if (name == "guake-mode") {
var new_key = this._settings.get_string("guake-mode");
this._settings.set_strv("guake-mode-gnome-shell",new Array(new_key));
}
}
});
function init() {
}
let terminusObject;
function enable() {
terminusObject = new TerminusClass();
}
function disable() {
}
{"uuid": "showTerminusQuakeWindow@rastersoft.com",
"name": "Show Terminus Quake Mode",
"shell-version": ["3.22"],
"description": "Allows to show the Quake-like terminal from Terminus by pressing the defined hotkey. Useful when using Wayland, since there Terminus can't create hotkeys and must rely on the desktop."}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment