Xfce Forum

Sub domains
 

You are not logged in.

#1 2019-07-29 17:04:14

pwr
Member
Registered: 2019-07-29
Posts: 2

Run script attached to shortcut key in xfce4-terminal

Hello all,

First time here, so hello !
I have been using XFCE for many years (>8 years in Fedora) never was unable to find a solution until now.
I recently changed from Fedora to Manjaro and with that lost some tools I had running, I hope you can help me find a way to set it up again.

Now my (2) problem(s), maybe it's 1 problem I had this running for a couple of years and I basically forgot how I did this in the past:
In the past I was able to launch a script within the xfce4-terminal which I could activate with a shortcut key (e.g. ALT-G).

the script "run.sh":

#!/bin/bash
echo running script
grep -R "my little pony" .

Now if I was in the xfce4-terminal

[pwr@pony some_dir]$

and I pressed ALT-G the script run.sh would run in the xfce4-terminal using the active directory (some_dir) AND the output would also be printed in the same xfce4-terminal.

[pwr@pony some_dir]$ running script
*
*
*
[pwr@pony some_dir]$

I was able to attach a shortcut key (ALT-G) to the script through Settings->Keyboard->Shortcuts, this works fine, the script will run but it leaves me with 2 problems:
1. the script doesn't run in the active directory (some_dir)
2. the script doesn't output the results in the terminal window.

Again: I had this running for a couple of years so I basically forgot how I did this (maybe did a print/copy "run.sh<CR>" on the command line or so), anyway any help or suggestions are welcome.

uname -a :
Linux pony 4.19.60-1-MANJARO #1 SMP PREEMPT Sun Jul 21 12:17:26 UTC 2019 x86_64 GNU/Linux
xfce4-terminal -V:
xfce4-terminal 0.8.8 (Xfce 4.13)

Copyright (c) 2003-2019
    The Xfce development team. All rights reserved.

Written by Benedikt Meurer <benny@xfce.org>,
Nick Schermer <nick@xfce.org>
and Igor Zakharov <f2404@yandex.ru>.

Please report bugs to <https://bugzilla.xfce.org/>.

Thanks, Rob

Last edited by pwr (2019-07-29 19:35:40)

Offline

#2 2019-07-29 18:23:50

Misko_2083
Member
Registered: 2015-10-13
Posts: 191
Website

Re: Run script attached to shortcut key in xfce4-terminal

Hi Rob,
edit your home/your_username/.bashrc
and bind a key combo Control+g for example

.bashrc is a hidden file you may have to press Ctrl+h to show it in thunar file manager.

Insert next line near the begining of .bashrc:

bind -x '"\C-g":/path_to/script.sh'

replace the path and your scriptname.

Edit: Almost forgot. You have to reopen the terminal after saving .bashrc for this to work.

Last edited by Misko_2083 (2019-07-29 18:25:26)


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#3 2019-07-29 19:48:01

pwr
Member
Registered: 2019-07-29
Posts: 2

Re: Run script attached to shortcut key in xfce4-terminal

Oh joy, it works great. Been struggling with this for a week now. Thanks!

Offline

Board footer

Powered by FluxBB