Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

681 plugin submission plugin utility key binding mouseless keyboard url open #682

Conversation

vssdeo
Copy link
Contributor

@vssdeo vssdeo commented Nov 19, 2022

Please Read: #681 for the changes.

2) plugin_util  file to assist this and other plugins with key-press Helper function
3) adding Key Binding Help Functions in above (2) to config and preferences->keybinding to have a consistent behavior
…eyboard-URL-Open gnome-terminator#681

Merge remote-tracking branch 'upstream/master' into 450-mouseless-URL-opening-or-yanking
1) Mouse less/free opening / yanking feature
2) plugin_util  file to assist this and other plugins with key-press Helper function
3) adding Key Binding Help Functions in above (2) to config and preferences->keybinding to have a consistent behavior
…inding Feature: Mouseless / Mousefree / Keyboard URL opening or yanking gnome-terminator#681

- there was a bug wherein the duplicate keybindings from plugins were not throwing the error "Duplicate Key Bindings Are Not Allowed", now while checking they are merged and then final list of keybindings are checked.
…inding Feature: Mouseless / Mousefree / Keyboard URL opening or yanking gnome-terminator#681

-convert control keys keyval to standard lowercase, else signals are missing
…Binding Feature: Mouseless / Mousefree / Keyboard URL opening or yanking gnome-terminator#681

- removed plugin_util
- added key unbind feature
- updated plugin helper
- updated plugin helper - to have config as part of constructor
- updated MouseFreeURLHandler for plugin.py, unload
- removed circular dependency between plugin.py and config.py due to KeyBindUtil due to merging of plugin_util.py
…inding Feature: Mouseless / Mousefree / Keyboard URL opening or yanking gnome-terminator#681

- renamed api interfacted for better clarity
- removed double checking of short-cut binding for plugins in keybindings
@mattrose
Copy link
Member

Is this done now? Can I pull it down and test it out?

@vssdeo
Copy link
Contributor Author

vssdeo commented Nov 29, 2022

Yes it’s already there for testing and comments / changes

@vssdeo
Copy link
Contributor Author

vssdeo commented Nov 29, 2022

While you are testing, do try, may be playing with two plugins in parallel, it may show / throw more errors or conditions etc. I haven’t included this in PR and this sits in my branch.

https://github.com/vssdeo/terminator/tree/new-selecting-text-with-keyboard-shift-up-shift-down

@mattrose
Copy link
Member

mattrose commented Dec 3, 2022

I had to throw the signal patch into the branch, and make a few more adjustments to terminatorlib/terminator.py to get it to work properly on any subsequent window but the 1st one. (I had to move the copy_other_signals method call from create_layout to new_window.)

I still would rather have the window get the signals from the plugin. Getting it from the first window feels ... random somehow. I tried messing with the plugin.py code to get it to load the signals from there, but have so far been unsuccessful.

@vssdeo
Copy link
Contributor Author

vssdeo commented Dec 3, 2022

I think I tried with re-loading plugins, can’t recall. Will try once back.

There are use cases for both methods, like fork copying all structures for parent or the other where a new instance should be a new fresh start as per configs. Let me get back home in a day or two and try.

@vssdeo
Copy link
Contributor Author

vssdeo commented Dec 5, 2022

Hi @mattrose, I had done this to play around with reloading before, this was not final though, just to experiment. Calling the loaded module func was calling plugin __init__ again and worked on new window. I still need to check further with import mechanism and any side effects.

diff --git a/terminatorlib/plugin.py b/terminatorlib/plugin.py
index 8ab8ddf8..9b900e1e 100644
--- a/terminatorlib/plugin.py
+++ b/terminatorlib/plugin.py
@@ -73,7 +73,7 @@ class PluginRegistry(borg.Borg):
         """Load all plugins present in the plugins/ directory in our module"""
         if self.done:
             dbg('Already loaded')
-            return
+            #return
 
         config = Config()
 
@@ -93,9 +93,11 @@ class PluginRegistry(borg.Borg):
                     try:
                         module = __import__(plugin[:-3], None, None, [''])
                         for item in getattr(module, 'AVAILABLE'):
+                            func = getattr(module, item)
                             if item not in list(self.available_plugins.keys()):
-                                func = getattr(module, item)
                                 self.available_plugins[item] = func
+                            else:
+                                func()
 
                             if item not in config['enabled_plugins']:
                                 dbg('plugin %s not enabled, skipping' % item)

@mattrose
Copy link
Member

mattrose commented Dec 5, 2022

Oh, that's way better, thanks. It makes much more sense than trying to pass signals around the backend.

@vssdeo
Copy link
Contributor Author

vssdeo commented Dec 6, 2022

great ! so will you be making the change @mattrose along with your other changes ?

@mattrose
Copy link
Member

mattrose commented Dec 6, 2022

Sure, I can pull this together. I'll work something up as soon as I can. Do you mind if I rebase the commit and split it up so that the plugin itself is separate from the supporting code for it? I might even do the plugin as a separate PR.

Once that's done you should also be able to pull in the other plugin that you've been working on as a separate PR as well.

@vssdeo
Copy link
Contributor Author

vssdeo commented Dec 6, 2022

Sure @mattrose you are the boss, makes sense.

You mean the other mouse free selection :) yes hope other folks find it of any use.

Anyways so let me know if anything from my side is needed !

vssdeo added 2 commits July 28, 2023 20:08
…sion-Plugin-Utility-KeyBinding-Mouseless-Keyboard-URL-Open
…ng approach below

- reloading of plugins was creating duplicate objects of plugins
- have attempted to have a clean unloading where pluings can clean themselves if needed
- tab-change event is being reused for plugin to detect window change for search in that terminal
- force re-loading option has been added but called only on new terminal creation when plugins are reinit so plugins have all terminals and window object access
@vssdeo vssdeo closed this Aug 9, 2023
@vssdeo vssdeo deleted the 681-Plugin-Submission-Plugin-Utility-KeyBinding-Mouseless-Keyboard-URL-Open branch August 9, 2023 10:16
@vssdeo
Copy link
Contributor Author

vssdeo commented Aug 9, 2023

closing this as this code is decoupled into diff components

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants