Sponsored Content
Top Forums UNIX for Advanced & Expert Users unix command : how to insert text at the cursor location via command line? Post 302482858 by xib.be on Wednesday 22nd of December 2010 05:45:00 PM
Old 12-22-2010
unix command : how to insert text at the cursor location via command line?

Hi,
Well my title isn't very clear I think. So to understand my goal:
I have a script "test1"
Code:
#!/bin/bash
xvkbd -text blabla

with xbindkeys, I bind F5 key in order it runs my test1 script
So when I press F5, test1 runs.

I'm under Emacs/Vi and I press F5 in order to have "blabla" be written at the cursor location.
... but I dunno why when I use it through xbindkeys, "blabla" text isn't written when I press F5 but when I release it ... and I have to release the F5 key very fast else nothing is printed.
And what is more, in firefox it is printed at the same speed as I type... lol ... to much slow ... imagine If instead of "blabla" I have a complete sentence xD

Instead of xbindkeys , I tried gnome keybindings (in metacity) directly too ... but it was even worst concerning the timing Smilie

I didn't find a real command that would print a text at the cursor location.... instead of simulate the keyboard ... which doesn't seem to be a good idea :/

please , may someone know a such command or have a good idea ? ^^

Last edited by xib.be; 12-22-2010 at 08:54 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unix command to insert double quotes

Hi, I am looking for a unix command which inserts double quotes around all values in a text file. For example, Input: 1234 200 4686 3506056 9646 457 5647 5066762 5656 366 5869 5978459 Output: "1234" "200" "4686" "3506056" "9646" "457" "5647" "5066762" "5656" "366" "5869"... (2 Replies)
Discussion started by: berlin_germany
2 Replies

2. UNIX for Dummies Questions & Answers

Insert line break in vi's command mode

Hi, When working in vi, the CTRL+j command for merging lines is very convenient. Is there an equivalent for splitting them (inserting a line break)? I often find myself pressing "i" + "return" + "esc", which I find a bit lengthy. Thanks in advance! (3 Replies)
Discussion started by: Skogsmulle
3 Replies

3. Shell Programming and Scripting

assign a command line argument and a unix command to awk variables

Hi , I have a piece of code ...wherein I need to assign the following ... 1) A command line argument to a variable e.g origCount=ARGV 2) A unix command to a variable e.g result=`wc -l testFile.txt` in my awk shell script When I do this : print "origCount" origCount --> I get the... (0 Replies)
Discussion started by: sweta_doshi
0 Replies

4. UNIX for Dummies Questions & Answers

unix command to insert double quotes in a delimited file

Hi, I am looking for a unix command which inserts double quotes around all values in a delimited file. For example, Input File 153665031,abc,abc ,abc 131278839,def,def ,dec 179821481,efg,efg ,lmn ... (6 Replies)
Discussion started by: Bachu
6 Replies

5. Shell Programming and Scripting

Insert shell command into first line of output file

How can I insert the command executed on the shell into the first line of my output file? For example if I execute; zcat *.gz |grep “User5501” > users.out How can I make my users.out look like; zcat *.gz |grep “User5501” > users.out User5501 PA User5501 UA User5501 ZA... (3 Replies)
Discussion started by: lewk
3 Replies

6. Shell Programming and Scripting

SED - insert space at the beginning of line and multi replace command

hi I am trying to use SED to replace the line matching a pattern using the command sed 'pattern c\ new line ' <file1 >file 2 I got two questions 1. how do I insert a blank space at the beginning of new line? 2. how do I use this command to execute multiple command using the -e... (5 Replies)
Discussion started by: piynik
5 Replies

7. Shell Programming and Scripting

Insert text line to specific location CSV

In Perl. ***edited question below*** Hey all, I am teaching myself some simple CSV file manipulation and have become a little stuck. Say I have the following layout in the CSV file: age,name,locationIs it possible to INSERT data into the CSV into the correct age order. For example, if I had... (1 Reply)
Discussion started by: whyte_rhyno
1 Replies

8. Shell Programming and Scripting

Specify an entire UNIX command as a command line argument

I'm trying to write a bash script called YN that looks like the following YN "Specify a question" "doThis" "doThat" where "doThis" will be executed if the answer is "y", otherwise "doThat". For example YN "Do you want to list the file dog?" "ls -al dog" "" Here's my attempt... (3 Replies)
Discussion started by: LeoKSimon
3 Replies

9. UNIX for Dummies Questions & Answers

sed command to Insert a line before the last four lines of the file

By using sed command, How to insert a new line before the last four lines of the file. Old Line Old Line NEW LINE! Old Line Old Line Old Line Old Line (8 Replies)
Discussion started by: wridler
8 Replies

10. Shell Programming and Scripting

Insert character at specific location in a each line of the file

Hi All, I am trying to write a shell script where it should insert character 'I' in 180th position of each line(except first and last line) of the file. Below is the script for file in /home/test/bharat/*.RET do # Process file echo "File Name=" $file #l_fileName="${file##*/}" ... (19 Replies)
Discussion started by: bharath561989
19 Replies
XBindKeys(1)						      General Commands Manual						      XBindKeys(1)

NAME
xbindkeys - a grabbing keys program for X SYNOPSIS
xbindkeys [ options ] DESCRIPTION
XbindKeys is a program that grab keys and mouse button events in X and starts associated shell command. COMMAND LINE OPTIONS
Available command line options are as follows: -d, --defaults Print a default rc file -f, --file Use an alternative rc file -h, --help Short help on options plus version/author info. -X, --display Set X display to use -v, --verbose More information on xbindkeys when it run -k, --key Identify one key pressed (useful to fill the configuration file) -mk, --multikey Identify multi key pressed (useful to fill the configuration file) -g, --geometry size and position of window with -k|-mk option -n, --nodaemon don't start as daemon If guile support have not been disabled: -dg, --defaults-guile Print a default guile configuration file -fg, --file-guile Use an alternative guile configuration file XBINDKEYSRC
XBindKeys uses a configuration files. This file is $HOME/.xbindkeysrc, used only for one user. All whitespace is ignored in the files except for within the commands names double quotes. The configuration file consists of commands names in double quotes, and associated keys in the next line. Comments are started with a pound (#) and extend to the end of the line. You can see a default file with the --defaults option or create a default $HOME/.xbindkeysrc with 'xbindkeys --defaults > $HOME/.xbindkeysrc'. KEYSYMS
The program expects combinations of keysyms to be used by using plus(+) characters to combine them together. The format of a command line is: "command to start &" associated key To specify an associated key, you can use 'xbindkeys --key' or 'xbindkeys --multikey' and put one of the two lines in the configuration file. A list of keys is in /usr/include/X11/keysym.h and in /usr/include/X11/keysymdef.h. The XK_ is not needed. List of modifiers: Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock), Mod3 (CapsLock), Mod4, Mod5 (Scroll). The release modifier is not a standard X modifier, but you can use it if you want to catch release events instead of press events. By defaults, xbindkeys does not pay attention with the modifiers NumLock, CapsLock and ScrollLock. Add the lines above in the configura- tion file, if you want to pay attention to them. keystate_numlock = enable keystate_capslock = enable keystate_scrolllock= enable EXAMPLES
# control+shift+d starts an xterm (it's a comment) "xterm" control+shift + q # Menu key starts xbindkeys_show "xbindkeys_show" Menu # Control + mouse button 1 starts an xterm "xterm" Control + b:1 # Control+Shift+a release event starts rxvt "rxvt" release+control+shift + a # Control + mouse button 2 release event starts rxvt "rxvt" Control + b:2 + Release SCHEME CONFIGURATION STYLE
If the guile support have not been disabled, you can use an alternate configuration file written in scheme. xbindkeys read first the scheme configuration file, and if this file doesn't exist, it read the standard configuration file. For more details, please see here http://www.gnu.org/software/guile/guile.html Note: The guile configuration file is the prefered way if you have a non trivial configuration like for example double click, timed click or keys combinations. The defaults is ~/.xbindkeysrc.scm Use xbindkeys --defaults-guile for more details. And xbindkeys --defaults-guile > ~/.xbindkeysrc.scm to use this method. NOTE
xbindkeys reload its configuration file each time it has changed. But if you want to force it reloading its configuration file, you can send a HUP signal: killall -HUP xbindkeys When HUP signal is send to xbindkeys, changes in $HOME/.xbindkeysrc takes effect only after moving mouse. BUGS
If you find a bug, please send a mail to <hocwp@free.fr> HOMEPAGE
http://hocwp.free.fr/xbindkeys AUTHOR
Philippe Brochard <hocwp@free.fr> Marcello Mathias Herreshoff for the guile support <marcello@hummer.stanford.edu> FILES
$HOME/.xbindkeysrc The users configuration file. $HOME/.xbindkeysrc.scm The users configuration file in scheme style (if guile support have not been disabled). SEE ALSO
xbindkeys_show Utility for showing the actual keybinding with xbindkeys xmodmap(1x) Utility for modifying keymap & button mappings in X. xev(1x) Print contents of X events. /usr/include/X11/keysymdef.h X11 KeySym definitions. 3rd Berkeley Distribution Wed Apr 18 2007 XBindKeys(1)
All times are GMT -4. The time now is 10:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy