-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #459 from pktiuk/open_dir_plugin
Add new plugin for opening current directory using right mouse button
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from gi.repository import Gtk | ||
|
||
from terminatorlib.config import Config | ||
from terminatorlib.terminal import Terminal | ||
import terminatorlib.plugin as plugin | ||
|
||
AVAILABLE = ['CurrDirOpen'] | ||
|
||
|
||
class CurrDirOpen(plugin.MenuItem): | ||
capabilities = ['terminal_menu'] | ||
config = None | ||
|
||
def __init__(self): | ||
self.cwd = "" | ||
self.terminal = None | ||
|
||
def _on_menu_item_add_tag_activate(self, menu_item_add_tag): | ||
self.terminal.open_url("file://" + self.cwd) | ||
|
||
def callback(self, menuitems, menu, terminal): | ||
self.cwd = terminal.get_cwd() | ||
self.terminal = terminal | ||
|
||
menuitem = Gtk.ImageMenuItem("Open current directory") | ||
image = Gtk.Image() | ||
image.set_from_icon_name('folder', Gtk.IconSize.MENU) | ||
menuitem.set_image(image) | ||
menuitem.set_always_show_image(True) | ||
menuitem.connect("activate", self._on_menu_item_add_tag_activate) | ||
|
||
menuitems.append(menuitem) |