Open brunoais opened 6 years ago
in the docs/reference folder? please have a look at the examples as well. you can also use python to describe methods with doc https://docs.python.org/3/tutorial/controlflow.html#documentation-strings
@info-cppsp I've looked there. Unfortunately, none of those explain how to bind keyboard modifiers and a mouse action to some code.
now all this is deep inside caja. I don't think there is a way to use extensions to override this.
>>> dir(Caja)
['Column', 'ColumnClass', 'ColumnDetails', 'ColumnProvider', 'ColumnProviderIface', 'File', 'FileInfo', 'FileInfoIface', 'InfoProvider', 'InfoProviderIface', 'LocationWidgetProvider', 'LocationWidgetProviderIface', 'Menu', 'MenuClass', 'MenuItem', 'MenuItemClass', 'MenuItemDetails', 'MenuPrivate', 'MenuProvider', 'MenuProviderIface', 'OperationHandle', 'OperationResult', 'PropertyPage', 'PropertyPageClass', 'PropertyPageDetails', 'PropertyPageProvider', 'PropertyPageProviderIface', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__file__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__loader__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__package__', '__path__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__spec__', '__str__', '__subclasshook__', '__weakref__', '_namespace', '_version', 'file_info_create', 'file_info_create_for_uri', 'file_info_list_copy', 'file_info_list_free', 'file_info_lookup', 'file_info_lookup_for_uri', 'info_provider_update_complete_invoke', 'module_initialize', 'module_list_types', 'module_shutdown']
What looks useful here is the menu.
see the open-terminal.py in the examples.
You could probably add a new context menu that launches a program for you as an administrator, based on the file's extension.
(like you could write that .txt files should be opened with gksudo -u root pluma).
However I have read that because of privilege escalation you may not be able to use sudo or alike commands in os.system('%s &' % terminal)
calls. I don't remember anymore, please check.
Maybe have a look at caja-extensions/gksu - that is the open as admin menu Maybe you have access to the default menus in caja from python in which case you could override the default context menu 'Open'. Still, that would be a right click and a left, not a double click...
The context menu option to start with gksu
already exists. I just wanted to add a keyboard shortcut at the time of the double click for opening, so it is opened with gksu
as if I had used the context option to open as super user.
to add shortcut: caja/src/file-manager/fm-directory-view.c fm_directory_view_class_init() at the end of this function there are signal bindings for deleting files. One could add a shortcut here - and add it for the other views as well.
yes, I get what you are trying to do, but I still don't think it is possible with extensions...
I see.... In that case, I guess I won't be able to do it unless I help developing caja. I'm quite full on time so I'm unsure I can. Unless it is to add an extension point that allows doing just this.
Any documents on how to contribute to caja with the intention of adding extension points?
On Tue, Mar 6, 2018 at 1:36 PM, info-cppsp notifications@github.com wrote:
to add shortcut: caja/src/file-manager/fm-directory-view.c fm_directory_view_class_init() at the end of this function there are signal bindings for deleting files. One could add a shortcut here - and add it for the other views as well.
yes, I get what you are trying to do, but I still don't think it is possible with extensions...
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mate-desktop/python-caja/issues/29#issuecomment-370782964, or mute the thread https://github.com/notifications/unsubscribe-auth/AAnB68Z22CpesK3F66oENZUxoodcJSSZks5tbpDagaJpZM4SVsWJ .
http://wiki.mate-desktop.org/applications:caja This may help.
@monsta @lukefromdc Could you help with this issue please?
All my experience is with C and I really don't know much about Python
that's, ok, the actual question is: can the default double-click action (on a file) in caja be redefined? so that it would open the file as administrator, with the default application, if Ctrl and Shift are currently pressed. can this be done with an extension?
Right click on a file, then click "properties" in the menu that opens, then select "open with" and you will get a list of applications with radio buttons. Whichever one is the active radio button will be the one that double-clicking files of that type opens them with
@lukefromdc I want a different action for when Ctrl+Shift
combo is pressed than when both are not pressed
I do not know how to do something like that, maybe someone else here does. @monsta?
You can add a list view column, a property page tab, and a context menu item. I recall there also was an ability to add a toolbar button, but it got lost at some point. I think that's all.
Note that there's a preference setting (in Caja, not here) to open folders with single click instead of double one, so I'd be careful with changing anything that could be related.
In that case.... Nothing I can do except going to caja and add code for such feature, right?
Where can I find the documentation of the python API?
I want to make an extension in python to: When:
Ctrl
andShift
are currently pressed -- (if so) Executegksudo -u root
+ {start command} -- (else) Execute defaultcaja already has a right click command to "start as administrator" (root) but I'd like a step further and have a keyboard shortcut.