Skip to content

Commit

Permalink
Fix Quick Open
Browse files Browse the repository at this point in the history
closes #1121
  • Loading branch information
gsemet committed Jan 24, 2018
1 parent 69ae4fe commit 1367a6b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
11 changes: 8 additions & 3 deletions guake/guake_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ def execute_command_by_uuid(self, tab_uuid, command):
else:
terminals = self.notebook.get_terminals_for_tab(tab_index)
for current_vte in terminals:
current_vte.feed_child(command)
current_vte.feed_child(command, len(command))

# TODO this is dead: 2eae380b1a91a24f6c1eb68c13dac33db98a6ea2 and
# 3f8c344519c9228deb9ca5f181cbdd5ef1d6acc0
Expand Down Expand Up @@ -1555,7 +1555,7 @@ def on_drag_data_received(self, widget, context, x, y, selection, target, timest
else:
text = str.join("", (shell_quote(path) + " " for path in pathlist))

box.terminal.feed_child(text)
box.terminal.feed_child(text, len(command))
return True

# -- tab related functions --
Expand Down Expand Up @@ -1630,7 +1630,7 @@ def get_current_dir(self):
active_terminal = self.notebook.get_current_terminal()
directory = os.path.expanduser('~')
if active_terminal:
active_pid = active_terminal.get_pid()
active_pid = active_terminal.pid
if active_pid:
cwd = os.readlink("/proc/{0}/cwd".format(active_pid.child_pid))
if os.path.exists(cwd):
Expand Down Expand Up @@ -1673,6 +1673,11 @@ def spawn_sync_pid(self, directory=None, terminal=None):
pid = terminal.spawn_sync(
Vte.PtyFlags.DEFAULT, wd, argv, [], GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None, None
)
if isinstance(pid, tuple):
# Return a tuple in 2.91
# https://lazka.github.io/pgi-docs/Vte-2.91/classes/Terminal.html#Vte.Terminal.spawn_sync
pid = pid[1]
assert isinstance(pid, int)
return pid

def update_proxy_vars(self, terminal=None):
Expand Down
2 changes: 1 addition & 1 deletion guake/guake_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_running_fg_processes_tab(self, index):
for terminal in self.get_terminals_for_tab(index):

fdpty = terminal.get_pty().get_fd()
term_pid = terminal.get_pid()
term_pid = terminal.pid
try:
fgpid = posix.tcgetpgrp(fdpty)
log.debug("found running pid: %s", fgpid)
Expand Down
15 changes: 10 additions & 5 deletions guake/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def __init__(self, settings):
self.connect('button-press-event', self.button_press)
self.matched_value = ''
self.font_scale_index = 0
self.pid = None
self._pid = None
self.custom_bgcolor = None
self.custom_fgcolor = None
self.found_link = None
Expand All @@ -219,8 +219,13 @@ def __init__(self, settings):
def get_uuid(self):
return self.uuid

def get_pid(self):
return self.pid
@property
def pid(self):
return self._pid

@pid.setter
def pid(self, pid):
self._pid = pid

def configure_terminal(self):
"""Sets all customized properties on the terminal
Expand Down Expand Up @@ -341,7 +346,7 @@ def button_press(self, terminal, event):
logging.debug("Executing it in current tab")
if resolved_cmdline[-1] != '\n':
resolved_cmdline += '\n'
self.feed_child(resolved_cmdline)
self.feed_child(resolved_cmdline, len(resolved_cmdline))
else:
logging.debug("Executing it independently")
subprocess.call(resolved_cmdline, shell=True)
Expand Down Expand Up @@ -409,7 +414,7 @@ def decrease_font_size(self):
self.font_scale -= 1

def kill(self):
pid = self.get_pid()
pid = self.pid
threading.Thread(target=self.delete_shell, args=(pid, )).start()
# start_new_thread(self.delete_shell, (pid,))

Expand Down
3 changes: 3 additions & 0 deletions releasenotes/notes/bugfix-654583b5646cf905.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fixes:
- |
Quick Open functionnality is restored #1121

0 comments on commit 1367a6b

Please sign in to comment.