âÂÂCopy and Paste into Terminalâ Option in Firefox/Nautilus Context Menu for Highlighted Text
up vote
0
down vote
favorite
How do I add the option to the right click highlighted text and paste to terminal?
I want to short cut the action of highlighting commands from documents and web browser, right click and select copy, open terminal, right click and select paste and then repeat the action for each command.
When I right click in my file manager I get these options-
1.NEW FOLDER
2.NEW DOCUMENT+
3.RESTORE MISSING FILES...
4.OPEN IN TERMINAL
5.PASTE
6.PROPERTIES
When I right click in my web browser (blank space not selecting text or image) I get these options-
1.options to move back one page, refresh, bookmark
2.save page as...
3.save page to pocket
4.send page to device
5.view background img
6.select all
7.view page source
8.view page info
9.inspect element
10.screen shot
When I right click highlighted commands in my web browser I get these options-
1.copy
2.select all
3.search google for (highlight text)
4.view selected source
5.inspect element
(6th) option...............HERE
So I want to add a 6th option above (paste to terminal) or (paste to CL).
this option would after highlighting the command and right clicking and selecting the option,open a terminal and paste the command straight to terminal, leaving the term window open and the cursor at the end of command text so i can add text or press enter to execute the command. I would then have to use the mouse again to navigate back to the browser.
The things I have tried are-
1. I did multiple google searches, all i got were mostly options on how to copy/paste in term or right click and middle button options for opening term in current directory.
2.I tried and failed to follow a old guide for Nautilus-Actions-tools, and faild.
3.looked into system settings at mouse options. (there are 2).
my system info is.
Linux me-ProDesk-600-G2-DM 4.13.0-32-generic #35~16.04.1-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
I am using Firefox vs 58.0.1 (64bit) canonical-1.0
If in some way it helps in using a wireless keyboard with touchpad, logitech k400r
Sorry for a long post, I am trying to add as much detail as possible to get the best answer possible, also last time i tried to post a screen shot on this site it wouldn't let me, so i had to type out my examples, i will try to add screen shots again. I am new to linux so please talk to me like a dumb child.
p.s I just tried to upload screen shots but I am not allowed to yet so here is a google drive share link,
#
update. I've been reading a help/how to guide on nautilus conf action tool.
Understand and can follow most of it, I get stuck at the scripting and Parameters part. Below is a copy and paste :) of the first half of the guide. I am stuck on numbers 7 through 10...
1...In this example, we are going to create an action which displays some pretty informations about the current selection.
Checking for prerequisites
This action will require Zenity.
Zenity is a program which will allow you to create a graphical user interface from a command-line.
You should check that this program is installed on your system, by example by typing the following command in a terminal:
zenity
then press Return.
2...Creating the action
To create a new action, choose File ⸠New action ( Ctrl+N ).
A new action is inserted in the items list, and its properties are displayed in the tabs on the right pane.
The label of the currently edited action (this one) is added to the application name in the title bar.
3...In the Items list, the new action is displayed in italic characters.
Italics are used as a reminder that the item has not yet been saved.
As another reminder that there is some pending modifications, an asterisk (ë * û) comes to prefix the application name in the title bar.
4...Qualifying your new action
It merely consists of choosing how your action will be displayed in the file manager context menu.
Enter My first action in the Context label entry box.
The Context label entry box contains the label of the action as you want it to be displayed in the file manager context menu.
The label is a mandatory property of your action. If it happens to be empty, then your action will be considered as invalid by Nautilus-Actions: it will be displayed in red in Items list and will never be candidate to be displayed in the file manager context menus.
5...Enter This will execute an action with some parameters in the Tooltip entry box.
The Tooltip entry box contains the text you want to be displayed as a short help to your action.
6...Select in the Icon drop-down list.
The Icon selection defines the icon which will be associated with your action in file manager context menus and in the toolbar.
You have two ways of choosing the icon associated to your action:
Click on the Icon drop-down list to select an icon.
Click on Browse to search for an image in the filesystem.
7...Specifying the command to be executed
When you will select your action in the file manager context menu, this command will be executed, with arguments of your choice.
Click on the Command tab to show the page which will permit you to enter the command.
8...Enter zenity in the Path entry box.
The Path entry box defines the command which will be executed when you will select your action in the file manager context menu.
You have two ways of defining the command to be executed:
9...Enter it in the Path entry box.
Click on Browse to select the executable file on the filesystem.
If the command you enter does not have an absolute path, then it will be searched for in the PATH variable at execution time.
10...Enter --info --text='%c selected item(s): %U' in the Parameters entry box.
The Parameters contains the arguments which will be passed to your command when it will be executed. These arguments may embed parameters which will be expanded at runtime.
If both Path and Parameters are empty, then this action will be considered as invalid: it will be displayed in red in Items list and will never be candidate to be displayed in the file manager context menus.
11...Saving
To save all pending modifications, choose File ⸠Save ( Ctrl+S ).
Nautilus automatically takes into account your new action, and displays it in its context menu.
Note that the 3rd tab in the program allows you to choose how the action is executed.
3rd tab= Execution
-first option is called-Execution mode- it gives 4 options.
1.normal
2.in a terminal
3.embeded
4.display output
-second option is start up mode, 2 options
1.a check box to notify at start up
2.a text entry box labeled start window manager class
-third option isexecute as user with a text entry box.
command-line scripts nautilus firefox mouse
add a comment |Â
up vote
0
down vote
favorite
How do I add the option to the right click highlighted text and paste to terminal?
I want to short cut the action of highlighting commands from documents and web browser, right click and select copy, open terminal, right click and select paste and then repeat the action for each command.
When I right click in my file manager I get these options-
1.NEW FOLDER
2.NEW DOCUMENT+
3.RESTORE MISSING FILES...
4.OPEN IN TERMINAL
5.PASTE
6.PROPERTIES
When I right click in my web browser (blank space not selecting text or image) I get these options-
1.options to move back one page, refresh, bookmark
2.save page as...
3.save page to pocket
4.send page to device
5.view background img
6.select all
7.view page source
8.view page info
9.inspect element
10.screen shot
When I right click highlighted commands in my web browser I get these options-
1.copy
2.select all
3.search google for (highlight text)
4.view selected source
5.inspect element
(6th) option...............HERE
So I want to add a 6th option above (paste to terminal) or (paste to CL).
this option would after highlighting the command and right clicking and selecting the option,open a terminal and paste the command straight to terminal, leaving the term window open and the cursor at the end of command text so i can add text or press enter to execute the command. I would then have to use the mouse again to navigate back to the browser.
The things I have tried are-
1. I did multiple google searches, all i got were mostly options on how to copy/paste in term or right click and middle button options for opening term in current directory.
2.I tried and failed to follow a old guide for Nautilus-Actions-tools, and faild.
3.looked into system settings at mouse options. (there are 2).
my system info is.
Linux me-ProDesk-600-G2-DM 4.13.0-32-generic #35~16.04.1-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
I am using Firefox vs 58.0.1 (64bit) canonical-1.0
If in some way it helps in using a wireless keyboard with touchpad, logitech k400r
Sorry for a long post, I am trying to add as much detail as possible to get the best answer possible, also last time i tried to post a screen shot on this site it wouldn't let me, so i had to type out my examples, i will try to add screen shots again. I am new to linux so please talk to me like a dumb child.
p.s I just tried to upload screen shots but I am not allowed to yet so here is a google drive share link,
#
update. I've been reading a help/how to guide on nautilus conf action tool.
Understand and can follow most of it, I get stuck at the scripting and Parameters part. Below is a copy and paste :) of the first half of the guide. I am stuck on numbers 7 through 10...
1...In this example, we are going to create an action which displays some pretty informations about the current selection.
Checking for prerequisites
This action will require Zenity.
Zenity is a program which will allow you to create a graphical user interface from a command-line.
You should check that this program is installed on your system, by example by typing the following command in a terminal:
zenity
then press Return.
2...Creating the action
To create a new action, choose File ⸠New action ( Ctrl+N ).
A new action is inserted in the items list, and its properties are displayed in the tabs on the right pane.
The label of the currently edited action (this one) is added to the application name in the title bar.
3...In the Items list, the new action is displayed in italic characters.
Italics are used as a reminder that the item has not yet been saved.
As another reminder that there is some pending modifications, an asterisk (ë * û) comes to prefix the application name in the title bar.
4...Qualifying your new action
It merely consists of choosing how your action will be displayed in the file manager context menu.
Enter My first action in the Context label entry box.
The Context label entry box contains the label of the action as you want it to be displayed in the file manager context menu.
The label is a mandatory property of your action. If it happens to be empty, then your action will be considered as invalid by Nautilus-Actions: it will be displayed in red in Items list and will never be candidate to be displayed in the file manager context menus.
5...Enter This will execute an action with some parameters in the Tooltip entry box.
The Tooltip entry box contains the text you want to be displayed as a short help to your action.
6...Select in the Icon drop-down list.
The Icon selection defines the icon which will be associated with your action in file manager context menus and in the toolbar.
You have two ways of choosing the icon associated to your action:
Click on the Icon drop-down list to select an icon.
Click on Browse to search for an image in the filesystem.
7...Specifying the command to be executed
When you will select your action in the file manager context menu, this command will be executed, with arguments of your choice.
Click on the Command tab to show the page which will permit you to enter the command.
8...Enter zenity in the Path entry box.
The Path entry box defines the command which will be executed when you will select your action in the file manager context menu.
You have two ways of defining the command to be executed:
9...Enter it in the Path entry box.
Click on Browse to select the executable file on the filesystem.
If the command you enter does not have an absolute path, then it will be searched for in the PATH variable at execution time.
10...Enter --info --text='%c selected item(s): %U' in the Parameters entry box.
The Parameters contains the arguments which will be passed to your command when it will be executed. These arguments may embed parameters which will be expanded at runtime.
If both Path and Parameters are empty, then this action will be considered as invalid: it will be displayed in red in Items list and will never be candidate to be displayed in the file manager context menus.
11...Saving
To save all pending modifications, choose File ⸠Save ( Ctrl+S ).
Nautilus automatically takes into account your new action, and displays it in its context menu.
Note that the 3rd tab in the program allows you to choose how the action is executed.
3rd tab= Execution
-first option is called-Execution mode- it gives 4 options.
1.normal
2.in a terminal
3.embeded
4.display output
-second option is start up mode, 2 options
1.a check box to notify at start up
2.a text entry box labeled start window manager class
-third option isexecute as user with a text entry box.
command-line scripts nautilus firefox mouse
Get used to using shortcuts. After highlighting the text, press Ctrl+C to copy to the clipboard. A typical desktop shortcut for opening a new terminal is Ctrl+Alt+T. Then paste using Ctrl+Shift+V... or even simpler: just highlight, no need to copy, then open a new terminal using a global shortcut, and paste with Shift+Insert.
â egmont
Feb 9 at 23:01
it's not about being lazy or anything, its about being efficient in time and about finding a start point to learning linux.
â Ken Loving
Feb 9 at 23:31
@egmont Or even simpler: Highlight, open terminal, paste with middle click.
â dessert
Feb 10 at 8:17
@KenLoving Did I say anything about lazyness? I've posted my best idea which needs 0 investment and is almost as effective as any other solution (which potentially needs tons of prior investment) could be.
â egmont
Feb 10 at 9:16
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
How do I add the option to the right click highlighted text and paste to terminal?
I want to short cut the action of highlighting commands from documents and web browser, right click and select copy, open terminal, right click and select paste and then repeat the action for each command.
When I right click in my file manager I get these options-
1.NEW FOLDER
2.NEW DOCUMENT+
3.RESTORE MISSING FILES...
4.OPEN IN TERMINAL
5.PASTE
6.PROPERTIES
When I right click in my web browser (blank space not selecting text or image) I get these options-
1.options to move back one page, refresh, bookmark
2.save page as...
3.save page to pocket
4.send page to device
5.view background img
6.select all
7.view page source
8.view page info
9.inspect element
10.screen shot
When I right click highlighted commands in my web browser I get these options-
1.copy
2.select all
3.search google for (highlight text)
4.view selected source
5.inspect element
(6th) option...............HERE
So I want to add a 6th option above (paste to terminal) or (paste to CL).
this option would after highlighting the command and right clicking and selecting the option,open a terminal and paste the command straight to terminal, leaving the term window open and the cursor at the end of command text so i can add text or press enter to execute the command. I would then have to use the mouse again to navigate back to the browser.
The things I have tried are-
1. I did multiple google searches, all i got were mostly options on how to copy/paste in term or right click and middle button options for opening term in current directory.
2.I tried and failed to follow a old guide for Nautilus-Actions-tools, and faild.
3.looked into system settings at mouse options. (there are 2).
my system info is.
Linux me-ProDesk-600-G2-DM 4.13.0-32-generic #35~16.04.1-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
I am using Firefox vs 58.0.1 (64bit) canonical-1.0
If in some way it helps in using a wireless keyboard with touchpad, logitech k400r
Sorry for a long post, I am trying to add as much detail as possible to get the best answer possible, also last time i tried to post a screen shot on this site it wouldn't let me, so i had to type out my examples, i will try to add screen shots again. I am new to linux so please talk to me like a dumb child.
p.s I just tried to upload screen shots but I am not allowed to yet so here is a google drive share link,
#
update. I've been reading a help/how to guide on nautilus conf action tool.
Understand and can follow most of it, I get stuck at the scripting and Parameters part. Below is a copy and paste :) of the first half of the guide. I am stuck on numbers 7 through 10...
1...In this example, we are going to create an action which displays some pretty informations about the current selection.
Checking for prerequisites
This action will require Zenity.
Zenity is a program which will allow you to create a graphical user interface from a command-line.
You should check that this program is installed on your system, by example by typing the following command in a terminal:
zenity
then press Return.
2...Creating the action
To create a new action, choose File ⸠New action ( Ctrl+N ).
A new action is inserted in the items list, and its properties are displayed in the tabs on the right pane.
The label of the currently edited action (this one) is added to the application name in the title bar.
3...In the Items list, the new action is displayed in italic characters.
Italics are used as a reminder that the item has not yet been saved.
As another reminder that there is some pending modifications, an asterisk (ë * û) comes to prefix the application name in the title bar.
4...Qualifying your new action
It merely consists of choosing how your action will be displayed in the file manager context menu.
Enter My first action in the Context label entry box.
The Context label entry box contains the label of the action as you want it to be displayed in the file manager context menu.
The label is a mandatory property of your action. If it happens to be empty, then your action will be considered as invalid by Nautilus-Actions: it will be displayed in red in Items list and will never be candidate to be displayed in the file manager context menus.
5...Enter This will execute an action with some parameters in the Tooltip entry box.
The Tooltip entry box contains the text you want to be displayed as a short help to your action.
6...Select in the Icon drop-down list.
The Icon selection defines the icon which will be associated with your action in file manager context menus and in the toolbar.
You have two ways of choosing the icon associated to your action:
Click on the Icon drop-down list to select an icon.
Click on Browse to search for an image in the filesystem.
7...Specifying the command to be executed
When you will select your action in the file manager context menu, this command will be executed, with arguments of your choice.
Click on the Command tab to show the page which will permit you to enter the command.
8...Enter zenity in the Path entry box.
The Path entry box defines the command which will be executed when you will select your action in the file manager context menu.
You have two ways of defining the command to be executed:
9...Enter it in the Path entry box.
Click on Browse to select the executable file on the filesystem.
If the command you enter does not have an absolute path, then it will be searched for in the PATH variable at execution time.
10...Enter --info --text='%c selected item(s): %U' in the Parameters entry box.
The Parameters contains the arguments which will be passed to your command when it will be executed. These arguments may embed parameters which will be expanded at runtime.
If both Path and Parameters are empty, then this action will be considered as invalid: it will be displayed in red in Items list and will never be candidate to be displayed in the file manager context menus.
11...Saving
To save all pending modifications, choose File ⸠Save ( Ctrl+S ).
Nautilus automatically takes into account your new action, and displays it in its context menu.
Note that the 3rd tab in the program allows you to choose how the action is executed.
3rd tab= Execution
-first option is called-Execution mode- it gives 4 options.
1.normal
2.in a terminal
3.embeded
4.display output
-second option is start up mode, 2 options
1.a check box to notify at start up
2.a text entry box labeled start window manager class
-third option isexecute as user with a text entry box.
command-line scripts nautilus firefox mouse
How do I add the option to the right click highlighted text and paste to terminal?
I want to short cut the action of highlighting commands from documents and web browser, right click and select copy, open terminal, right click and select paste and then repeat the action for each command.
When I right click in my file manager I get these options-
1.NEW FOLDER
2.NEW DOCUMENT+
3.RESTORE MISSING FILES...
4.OPEN IN TERMINAL
5.PASTE
6.PROPERTIES
When I right click in my web browser (blank space not selecting text or image) I get these options-
1.options to move back one page, refresh, bookmark
2.save page as...
3.save page to pocket
4.send page to device
5.view background img
6.select all
7.view page source
8.view page info
9.inspect element
10.screen shot
When I right click highlighted commands in my web browser I get these options-
1.copy
2.select all
3.search google for (highlight text)
4.view selected source
5.inspect element
(6th) option...............HERE
So I want to add a 6th option above (paste to terminal) or (paste to CL).
this option would after highlighting the command and right clicking and selecting the option,open a terminal and paste the command straight to terminal, leaving the term window open and the cursor at the end of command text so i can add text or press enter to execute the command. I would then have to use the mouse again to navigate back to the browser.
The things I have tried are-
1. I did multiple google searches, all i got were mostly options on how to copy/paste in term or right click and middle button options for opening term in current directory.
2.I tried and failed to follow a old guide for Nautilus-Actions-tools, and faild.
3.looked into system settings at mouse options. (there are 2).
my system info is.
Linux me-ProDesk-600-G2-DM 4.13.0-32-generic #35~16.04.1-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
I am using Firefox vs 58.0.1 (64bit) canonical-1.0
If in some way it helps in using a wireless keyboard with touchpad, logitech k400r
Sorry for a long post, I am trying to add as much detail as possible to get the best answer possible, also last time i tried to post a screen shot on this site it wouldn't let me, so i had to type out my examples, i will try to add screen shots again. I am new to linux so please talk to me like a dumb child.
p.s I just tried to upload screen shots but I am not allowed to yet so here is a google drive share link,
#
update. I've been reading a help/how to guide on nautilus conf action tool.
Understand and can follow most of it, I get stuck at the scripting and Parameters part. Below is a copy and paste :) of the first half of the guide. I am stuck on numbers 7 through 10...
1...In this example, we are going to create an action which displays some pretty informations about the current selection.
Checking for prerequisites
This action will require Zenity.
Zenity is a program which will allow you to create a graphical user interface from a command-line.
You should check that this program is installed on your system, by example by typing the following command in a terminal:
zenity
then press Return.
2...Creating the action
To create a new action, choose File ⸠New action ( Ctrl+N ).
A new action is inserted in the items list, and its properties are displayed in the tabs on the right pane.
The label of the currently edited action (this one) is added to the application name in the title bar.
3...In the Items list, the new action is displayed in italic characters.
Italics are used as a reminder that the item has not yet been saved.
As another reminder that there is some pending modifications, an asterisk (ë * û) comes to prefix the application name in the title bar.
4...Qualifying your new action
It merely consists of choosing how your action will be displayed in the file manager context menu.
Enter My first action in the Context label entry box.
The Context label entry box contains the label of the action as you want it to be displayed in the file manager context menu.
The label is a mandatory property of your action. If it happens to be empty, then your action will be considered as invalid by Nautilus-Actions: it will be displayed in red in Items list and will never be candidate to be displayed in the file manager context menus.
5...Enter This will execute an action with some parameters in the Tooltip entry box.
The Tooltip entry box contains the text you want to be displayed as a short help to your action.
6...Select in the Icon drop-down list.
The Icon selection defines the icon which will be associated with your action in file manager context menus and in the toolbar.
You have two ways of choosing the icon associated to your action:
Click on the Icon drop-down list to select an icon.
Click on Browse to search for an image in the filesystem.
7...Specifying the command to be executed
When you will select your action in the file manager context menu, this command will be executed, with arguments of your choice.
Click on the Command tab to show the page which will permit you to enter the command.
8...Enter zenity in the Path entry box.
The Path entry box defines the command which will be executed when you will select your action in the file manager context menu.
You have two ways of defining the command to be executed:
9...Enter it in the Path entry box.
Click on Browse to select the executable file on the filesystem.
If the command you enter does not have an absolute path, then it will be searched for in the PATH variable at execution time.
10...Enter --info --text='%c selected item(s): %U' in the Parameters entry box.
The Parameters contains the arguments which will be passed to your command when it will be executed. These arguments may embed parameters which will be expanded at runtime.
If both Path and Parameters are empty, then this action will be considered as invalid: it will be displayed in red in Items list and will never be candidate to be displayed in the file manager context menus.
11...Saving
To save all pending modifications, choose File ⸠Save ( Ctrl+S ).
Nautilus automatically takes into account your new action, and displays it in its context menu.
Note that the 3rd tab in the program allows you to choose how the action is executed.
3rd tab= Execution
-first option is called-Execution mode- it gives 4 options.
1.normal
2.in a terminal
3.embeded
4.display output
-second option is start up mode, 2 options
1.a check box to notify at start up
2.a text entry box labeled start window manager class
-third option isexecute as user with a text entry box.
command-line scripts nautilus firefox mouse
command-line scripts nautilus firefox mouse
edited Feb 10 at 10:56
dessert
20k55795
20k55795
asked Feb 9 at 22:07
Ken Loving
286
286
Get used to using shortcuts. After highlighting the text, press Ctrl+C to copy to the clipboard. A typical desktop shortcut for opening a new terminal is Ctrl+Alt+T. Then paste using Ctrl+Shift+V... or even simpler: just highlight, no need to copy, then open a new terminal using a global shortcut, and paste with Shift+Insert.
â egmont
Feb 9 at 23:01
it's not about being lazy or anything, its about being efficient in time and about finding a start point to learning linux.
â Ken Loving
Feb 9 at 23:31
@egmont Or even simpler: Highlight, open terminal, paste with middle click.
â dessert
Feb 10 at 8:17
@KenLoving Did I say anything about lazyness? I've posted my best idea which needs 0 investment and is almost as effective as any other solution (which potentially needs tons of prior investment) could be.
â egmont
Feb 10 at 9:16
add a comment |Â
Get used to using shortcuts. After highlighting the text, press Ctrl+C to copy to the clipboard. A typical desktop shortcut for opening a new terminal is Ctrl+Alt+T. Then paste using Ctrl+Shift+V... or even simpler: just highlight, no need to copy, then open a new terminal using a global shortcut, and paste with Shift+Insert.
â egmont
Feb 9 at 23:01
it's not about being lazy or anything, its about being efficient in time and about finding a start point to learning linux.
â Ken Loving
Feb 9 at 23:31
@egmont Or even simpler: Highlight, open terminal, paste with middle click.
â dessert
Feb 10 at 8:17
@KenLoving Did I say anything about lazyness? I've posted my best idea which needs 0 investment and is almost as effective as any other solution (which potentially needs tons of prior investment) could be.
â egmont
Feb 10 at 9:16
Get used to using shortcuts. After highlighting the text, press Ctrl+C to copy to the clipboard. A typical desktop shortcut for opening a new terminal is Ctrl+Alt+T. Then paste using Ctrl+Shift+V... or even simpler: just highlight, no need to copy, then open a new terminal using a global shortcut, and paste with Shift+Insert.
â egmont
Feb 9 at 23:01
Get used to using shortcuts. After highlighting the text, press Ctrl+C to copy to the clipboard. A typical desktop shortcut for opening a new terminal is Ctrl+Alt+T. Then paste using Ctrl+Shift+V... or even simpler: just highlight, no need to copy, then open a new terminal using a global shortcut, and paste with Shift+Insert.
â egmont
Feb 9 at 23:01
it's not about being lazy or anything, its about being efficient in time and about finding a start point to learning linux.
â Ken Loving
Feb 9 at 23:31
it's not about being lazy or anything, its about being efficient in time and about finding a start point to learning linux.
â Ken Loving
Feb 9 at 23:31
@egmont Or even simpler: Highlight, open terminal, paste with middle click.
â dessert
Feb 10 at 8:17
@egmont Or even simpler: Highlight, open terminal, paste with middle click.
â dessert
Feb 10 at 8:17
@KenLoving Did I say anything about lazyness? I've posted my best idea which needs 0 investment and is almost as effective as any other solution (which potentially needs tons of prior investment) could be.
â egmont
Feb 10 at 9:16
@KenLoving Did I say anything about lazyness? I've posted my best idea which needs 0 investment and is almost as effective as any other solution (which potentially needs tons of prior investment) could be.
â egmont
Feb 10 at 9:16
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
I don't know anything about adding options to context menus but here's the part you may not find easily elsewhere (see below for where exactly):
How to insert the currently selected text (aka XA_PRIMARY) in a new terminal window automatically
Copy your
~/.bashrc
file, I use~/.bashrc_selection
as the new file here:cp ~/.bashrc ~/.bashrc_selection
Add these lines to the bottom of the new file and save it:
selection=$(xclip -o | sed ':a;N;$!ba;s/n/; /g')
bind $'"u200b":"1'"$selection"'5"'
perl -le 'require "sys/ioctl.ph"; ioctl(STDIN, &TIOCSTI, $_) for split "", join " ", @ARGV' -- $'u200b'Select the piece of text you want to insert in the new terminal. You don't have to press any keyboard key, just select the text with the mouse and don't select anything else before running the below command.
Run the following command to open the terminal:
xterm -e "bash --rcfile ~/.bashrc_selection"
This should work with other terminal emulators as well (the option to execute a command is usually
-e
), e.g.gnome-terminal -e "bash --rcfile ~/.bashrc_selection"
This also works for text with spaces and newlines. As newlines are interpreted by bash
I converted them to ;â£
(semicolon followed by space) with the sed
command, you're free to change that or perform further replacing.
All that is left now is to find out how to add a context menu entry in each of the programs you want to use this feature in and let it run the command from step 4. Here's what I found with a quick search on the site:
- How to run - from Firefox context menu - terminal commands selected in web pages?
- How do I customize the context menu in Nautilus?
- How can I add a custom item to the nautilus context menu, but NOT in a sub-menu?
A different and maybe better approach would be to add a custom keyboard shortcut which runs the command, this is explaned in How to change keyboard shortcuts?.
To write this post I used my answer to Main Terminal Window Displaying Commands Only and hence what others taught me on How to automatically insert a string after the prompt ÷ Unix.SE.
Looks like a good idea. For the first part, i.e., copying the text, you could use xdotool. Have xdotool right-click and copy to the text to the clipboard. All this can be joined in a script that you would run with a hotkey. The script runs xdotool to copy to the clipboard, then runs the command from above to open the terminal in a special way. Only works on xorg, not on wayland.
â vanadium
Mar 3 at 18:27
@vanadium Why bother copying to clipboard (and why with a right-click instead of simplyStrg+C
) if you can use the primary buffer directly, where marked text gets stored automatically without any more actions needed? I think I don't follow youâ¦
â dessert
Mar 3 at 19:08
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
I don't know anything about adding options to context menus but here's the part you may not find easily elsewhere (see below for where exactly):
How to insert the currently selected text (aka XA_PRIMARY) in a new terminal window automatically
Copy your
~/.bashrc
file, I use~/.bashrc_selection
as the new file here:cp ~/.bashrc ~/.bashrc_selection
Add these lines to the bottom of the new file and save it:
selection=$(xclip -o | sed ':a;N;$!ba;s/n/; /g')
bind $'"u200b":"1'"$selection"'5"'
perl -le 'require "sys/ioctl.ph"; ioctl(STDIN, &TIOCSTI, $_) for split "", join " ", @ARGV' -- $'u200b'Select the piece of text you want to insert in the new terminal. You don't have to press any keyboard key, just select the text with the mouse and don't select anything else before running the below command.
Run the following command to open the terminal:
xterm -e "bash --rcfile ~/.bashrc_selection"
This should work with other terminal emulators as well (the option to execute a command is usually
-e
), e.g.gnome-terminal -e "bash --rcfile ~/.bashrc_selection"
This also works for text with spaces and newlines. As newlines are interpreted by bash
I converted them to ;â£
(semicolon followed by space) with the sed
command, you're free to change that or perform further replacing.
All that is left now is to find out how to add a context menu entry in each of the programs you want to use this feature in and let it run the command from step 4. Here's what I found with a quick search on the site:
- How to run - from Firefox context menu - terminal commands selected in web pages?
- How do I customize the context menu in Nautilus?
- How can I add a custom item to the nautilus context menu, but NOT in a sub-menu?
A different and maybe better approach would be to add a custom keyboard shortcut which runs the command, this is explaned in How to change keyboard shortcuts?.
To write this post I used my answer to Main Terminal Window Displaying Commands Only and hence what others taught me on How to automatically insert a string after the prompt ÷ Unix.SE.
Looks like a good idea. For the first part, i.e., copying the text, you could use xdotool. Have xdotool right-click and copy to the text to the clipboard. All this can be joined in a script that you would run with a hotkey. The script runs xdotool to copy to the clipboard, then runs the command from above to open the terminal in a special way. Only works on xorg, not on wayland.
â vanadium
Mar 3 at 18:27
@vanadium Why bother copying to clipboard (and why with a right-click instead of simplyStrg+C
) if you can use the primary buffer directly, where marked text gets stored automatically without any more actions needed? I think I don't follow youâ¦
â dessert
Mar 3 at 19:08
add a comment |Â
up vote
2
down vote
I don't know anything about adding options to context menus but here's the part you may not find easily elsewhere (see below for where exactly):
How to insert the currently selected text (aka XA_PRIMARY) in a new terminal window automatically
Copy your
~/.bashrc
file, I use~/.bashrc_selection
as the new file here:cp ~/.bashrc ~/.bashrc_selection
Add these lines to the bottom of the new file and save it:
selection=$(xclip -o | sed ':a;N;$!ba;s/n/; /g')
bind $'"u200b":"1'"$selection"'5"'
perl -le 'require "sys/ioctl.ph"; ioctl(STDIN, &TIOCSTI, $_) for split "", join " ", @ARGV' -- $'u200b'Select the piece of text you want to insert in the new terminal. You don't have to press any keyboard key, just select the text with the mouse and don't select anything else before running the below command.
Run the following command to open the terminal:
xterm -e "bash --rcfile ~/.bashrc_selection"
This should work with other terminal emulators as well (the option to execute a command is usually
-e
), e.g.gnome-terminal -e "bash --rcfile ~/.bashrc_selection"
This also works for text with spaces and newlines. As newlines are interpreted by bash
I converted them to ;â£
(semicolon followed by space) with the sed
command, you're free to change that or perform further replacing.
All that is left now is to find out how to add a context menu entry in each of the programs you want to use this feature in and let it run the command from step 4. Here's what I found with a quick search on the site:
- How to run - from Firefox context menu - terminal commands selected in web pages?
- How do I customize the context menu in Nautilus?
- How can I add a custom item to the nautilus context menu, but NOT in a sub-menu?
A different and maybe better approach would be to add a custom keyboard shortcut which runs the command, this is explaned in How to change keyboard shortcuts?.
To write this post I used my answer to Main Terminal Window Displaying Commands Only and hence what others taught me on How to automatically insert a string after the prompt ÷ Unix.SE.
Looks like a good idea. For the first part, i.e., copying the text, you could use xdotool. Have xdotool right-click and copy to the text to the clipboard. All this can be joined in a script that you would run with a hotkey. The script runs xdotool to copy to the clipboard, then runs the command from above to open the terminal in a special way. Only works on xorg, not on wayland.
â vanadium
Mar 3 at 18:27
@vanadium Why bother copying to clipboard (and why with a right-click instead of simplyStrg+C
) if you can use the primary buffer directly, where marked text gets stored automatically without any more actions needed? I think I don't follow youâ¦
â dessert
Mar 3 at 19:08
add a comment |Â
up vote
2
down vote
up vote
2
down vote
I don't know anything about adding options to context menus but here's the part you may not find easily elsewhere (see below for where exactly):
How to insert the currently selected text (aka XA_PRIMARY) in a new terminal window automatically
Copy your
~/.bashrc
file, I use~/.bashrc_selection
as the new file here:cp ~/.bashrc ~/.bashrc_selection
Add these lines to the bottom of the new file and save it:
selection=$(xclip -o | sed ':a;N;$!ba;s/n/; /g')
bind $'"u200b":"1'"$selection"'5"'
perl -le 'require "sys/ioctl.ph"; ioctl(STDIN, &TIOCSTI, $_) for split "", join " ", @ARGV' -- $'u200b'Select the piece of text you want to insert in the new terminal. You don't have to press any keyboard key, just select the text with the mouse and don't select anything else before running the below command.
Run the following command to open the terminal:
xterm -e "bash --rcfile ~/.bashrc_selection"
This should work with other terminal emulators as well (the option to execute a command is usually
-e
), e.g.gnome-terminal -e "bash --rcfile ~/.bashrc_selection"
This also works for text with spaces and newlines. As newlines are interpreted by bash
I converted them to ;â£
(semicolon followed by space) with the sed
command, you're free to change that or perform further replacing.
All that is left now is to find out how to add a context menu entry in each of the programs you want to use this feature in and let it run the command from step 4. Here's what I found with a quick search on the site:
- How to run - from Firefox context menu - terminal commands selected in web pages?
- How do I customize the context menu in Nautilus?
- How can I add a custom item to the nautilus context menu, but NOT in a sub-menu?
A different and maybe better approach would be to add a custom keyboard shortcut which runs the command, this is explaned in How to change keyboard shortcuts?.
To write this post I used my answer to Main Terminal Window Displaying Commands Only and hence what others taught me on How to automatically insert a string after the prompt ÷ Unix.SE.
I don't know anything about adding options to context menus but here's the part you may not find easily elsewhere (see below for where exactly):
How to insert the currently selected text (aka XA_PRIMARY) in a new terminal window automatically
Copy your
~/.bashrc
file, I use~/.bashrc_selection
as the new file here:cp ~/.bashrc ~/.bashrc_selection
Add these lines to the bottom of the new file and save it:
selection=$(xclip -o | sed ':a;N;$!ba;s/n/; /g')
bind $'"u200b":"1'"$selection"'5"'
perl -le 'require "sys/ioctl.ph"; ioctl(STDIN, &TIOCSTI, $_) for split "", join " ", @ARGV' -- $'u200b'Select the piece of text you want to insert in the new terminal. You don't have to press any keyboard key, just select the text with the mouse and don't select anything else before running the below command.
Run the following command to open the terminal:
xterm -e "bash --rcfile ~/.bashrc_selection"
This should work with other terminal emulators as well (the option to execute a command is usually
-e
), e.g.gnome-terminal -e "bash --rcfile ~/.bashrc_selection"
This also works for text with spaces and newlines. As newlines are interpreted by bash
I converted them to ;â£
(semicolon followed by space) with the sed
command, you're free to change that or perform further replacing.
All that is left now is to find out how to add a context menu entry in each of the programs you want to use this feature in and let it run the command from step 4. Here's what I found with a quick search on the site:
- How to run - from Firefox context menu - terminal commands selected in web pages?
- How do I customize the context menu in Nautilus?
- How can I add a custom item to the nautilus context menu, but NOT in a sub-menu?
A different and maybe better approach would be to add a custom keyboard shortcut which runs the command, this is explaned in How to change keyboard shortcuts?.
To write this post I used my answer to Main Terminal Window Displaying Commands Only and hence what others taught me on How to automatically insert a string after the prompt ÷ Unix.SE.
edited Feb 10 at 12:24
answered Feb 10 at 10:26
dessert
20k55795
20k55795
Looks like a good idea. For the first part, i.e., copying the text, you could use xdotool. Have xdotool right-click and copy to the text to the clipboard. All this can be joined in a script that you would run with a hotkey. The script runs xdotool to copy to the clipboard, then runs the command from above to open the terminal in a special way. Only works on xorg, not on wayland.
â vanadium
Mar 3 at 18:27
@vanadium Why bother copying to clipboard (and why with a right-click instead of simplyStrg+C
) if you can use the primary buffer directly, where marked text gets stored automatically without any more actions needed? I think I don't follow youâ¦
â dessert
Mar 3 at 19:08
add a comment |Â
Looks like a good idea. For the first part, i.e., copying the text, you could use xdotool. Have xdotool right-click and copy to the text to the clipboard. All this can be joined in a script that you would run with a hotkey. The script runs xdotool to copy to the clipboard, then runs the command from above to open the terminal in a special way. Only works on xorg, not on wayland.
â vanadium
Mar 3 at 18:27
@vanadium Why bother copying to clipboard (and why with a right-click instead of simplyStrg+C
) if you can use the primary buffer directly, where marked text gets stored automatically without any more actions needed? I think I don't follow youâ¦
â dessert
Mar 3 at 19:08
Looks like a good idea. For the first part, i.e., copying the text, you could use xdotool. Have xdotool right-click and copy to the text to the clipboard. All this can be joined in a script that you would run with a hotkey. The script runs xdotool to copy to the clipboard, then runs the command from above to open the terminal in a special way. Only works on xorg, not on wayland.
â vanadium
Mar 3 at 18:27
Looks like a good idea. For the first part, i.e., copying the text, you could use xdotool. Have xdotool right-click and copy to the text to the clipboard. All this can be joined in a script that you would run with a hotkey. The script runs xdotool to copy to the clipboard, then runs the command from above to open the terminal in a special way. Only works on xorg, not on wayland.
â vanadium
Mar 3 at 18:27
@vanadium Why bother copying to clipboard (and why with a right-click instead of simply
Strg+C
) if you can use the primary buffer directly, where marked text gets stored automatically without any more actions needed? I think I don't follow youâ¦â dessert
Mar 3 at 19:08
@vanadium Why bother copying to clipboard (and why with a right-click instead of simply
Strg+C
) if you can use the primary buffer directly, where marked text gets stored automatically without any more actions needed? I think I don't follow youâ¦â dessert
Mar 3 at 19:08
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1004692%2fcopy-and-paste-into-terminal-option-in-firefox-nautilus-context-menu-for-highl%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Get used to using shortcuts. After highlighting the text, press Ctrl+C to copy to the clipboard. A typical desktop shortcut for opening a new terminal is Ctrl+Alt+T. Then paste using Ctrl+Shift+V... or even simpler: just highlight, no need to copy, then open a new terminal using a global shortcut, and paste with Shift+Insert.
â egmont
Feb 9 at 23:01
it's not about being lazy or anything, its about being efficient in time and about finding a start point to learning linux.
â Ken Loving
Feb 9 at 23:31
@egmont Or even simpler: Highlight, open terminal, paste with middle click.
â dessert
Feb 10 at 8:17
@KenLoving Did I say anything about lazyness? I've posted my best idea which needs 0 investment and is almost as effective as any other solution (which potentially needs tons of prior investment) could be.
â egmont
Feb 10 at 9:16