custom commands not working

Bug #1781706 reported by Kondencuotas Pienas
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Terminator
New
Undecided
Unassigned

Bug Description

Custom commands from the custom commands menu are not working.

1. add new custom command to command menu
2. navigate to commands menu and click on a newly added command
3. nothing happens

expected: command printed to the terminal alongside its output.

It used to work fine with earlier versions of Kali linux, but is not working with the new kali version i downloaded from here: https://images.offensive-security.com/virtual-images/kali-linux-2018.2-vbox-i386.ova

Config file:
root@kali:~# cat /root/.config/terminator/config
[global_config]
  enabled_plugins = CustomCommandsMenu, LaunchpadCodeURLHandler, APTURLHandler, LaunchpadBugURLHandler
[keybindings]
[layouts]
  [[default]]
    [[[child1]]]
      parent = window0
      type = Terminal
    [[[window0]]]
      parent = ""
      type = Window
[plugins]
  [[CustomCommandsMenu]]
    [[[id]]]
      command = id
      enabled = True
      name = id
      position = 0
[profiles]
  [[default]]
    cursor_color = "#aaaaaa"

Some additional details you may find useful:
https://pastebin.com/W4D21E02

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :
Revision history for this message
Andreas Steinwachs (steinwachs) wrote :

I'm on Terminator 1.91-1 and Ubuntu Linux 18.10 (cosmic) and had the same issue.

To fix this, I followed the advice in the bug report linked by Edmont. However, I also cleaned up all the .pyc files and __pycache__ and forced a complete recompile. Finally, note that the linked solution contained a typo (it is "custom_commands.py", NOT "customer_commands.py"! ;)) and did not seem to work for everyone. I am assuming that it was due to different file locations, the typo, and potentially a lack of properly cleaning up the Python byte code files.

Here's the complete procedure as it worked for me:

1) Find out where your terminator files are and cd to that directory:
which terminator
    // Output: /usr/bin/terminator -> ../share/terminator/terminator
    // So the terminator root directory is /usr/share/terminator in this case

2) cd /usr/share/terminator

3) Change custom_commands.py as indicated by others

sudo nano terminatorlib/plugins/custom_commands.py

Change line 130 of terminatorlib/plugins/custom_commands.py

from:

terminal.vte.feed_child(command, len(command))

to:

terminal.vte.feed_child(command)

4) sudo pyclean . // To be on the safe side. Alternatively, use: sudo py3clean .
5) sudo python -m compileall . // Re-compile the whole lot
6) restart terminator // <-- This is necessary!

Custom commands should now work. To test, select and run a custom command from the commands menu.

Revision history for this message
Andreas Steinwachs (steinwachs) wrote :

* Apologies for my typo in your first name, Egmont.

Revision history for this message
Haim Daniel (hdaniel) wrote :

Ran into the same issue on Ubuntu 20.04, terminal 1.91-4

follow the steps from @steinwach and on step 3)

sudo vi terminatorlib/plugins/custom_commands.py +130

Change line 130 of terminatorlib/plugins/custom_commands.py

from:

terminal.vte.feed_child(command, len(command))

to:

terminal.vte.feed_child(command.encode())

follow the steps from step 4)

Hope it helps

Revision history for this message
Mikaël L. (mlachal) wrote :

I had the same issue on Mint 20 and this fix worked.
I just had to replace step 5) by
sudo python3 -m compileall .

Revision history for this message
Eduardo Silva (edsilva-ubuntu) wrote :

Hi, thank you all for your contribution, I had similar issue while using:

Ubuntu 20.04.2 LTS (GNU/Linux 5.8.0-43-generic x86_64)
terminator/focal,focal,now 1.91-4ubuntu1 all [installed]

Here is a summary of what I did based on your notes

sudo bash
cd /usr/share/terminator/terminatorlib/plugins
cp custom_commands.py custom_commands.py.bak.$(date +%Y-%m-%d_%H%M)
vi custom_commands.py +130

   Change line 130 of terminatorlib/plugins/custom_commands.py
   from:
   terminal.vte.feed_child(command, len(command))
   to:
   terminal.vte.feed_child(command.encode())

py3clean .
python3 -m compileall .

Then quit all instances of terminator and started again.

Eduardo Silva

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.