Bug 128772 - Automated Input : inserting a command sequence by a hotkey
Summary: Automated Input : inserting a command sequence by a hotkey
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 1.6.2
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-07 18:59 UTC by Marc Schoechlin
Modified: 2007-07-10 02:19 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Schoechlin 2006-06-07 18:59:20 UTC
Version:           1.6.2 (using KDE 3.5.2, Kubuntu Package 4:3.5.2-0ubuntu18 dapper)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.15-23-k7

I´m a sysop and i´m maintaining a huge number of unix-systems.

Putting a ".bashrc" on any of these systems is not a good option for me:
- multiple users are sharing accounts for database-instances, services,...
  (other users don´t like my profile-settings)
- updating ".bashrc" on hundred of systems is not that cool

Therefore a automated insert of a ascii-sequence (which contains
basic shellcommands to setup my shellsession) would be cool thing.
A implementation like that would be nice:

- Write commands for different system-types to different textfiles
  (i.e. one for Aix, Solaris, Fedora and Debian)
- Open a konsole-dialog and select the new menu item 
  "Settings" -> "Automated Input" -> "New"
- A dialog occures which allows to define the following settings:
  * The name of the input-profile
  * The location of the textfile
  * A insert-intervall in fractions of seconds
    (This defines a artifical delay after entering a newline.
     Sometimes this is needed on remote systems)
  * A hotkey which eases calling this profile
  * A regular-expression for the window-title (optional)

In my idea the usage of automated input method so look like that:

* Calling over a menu item
  (right click to the screen -> "Automated Input" -> "<Name of input-profile>"
* Using a hotkey
  (most efficent)
* Calling on change of tab-title by evaluating a regular expression
  (optinal)

Thanks for wring this great application.
Comment 1 Robert Knight 2007-07-09 00:07:08 UTC
Konsole has for a long time had so called 'keytabs' which specify how combinations key presses map to the characters which are sent to the terminal.  In KDE 4 there is a tool provided to create, edit and test key bindings from within Konsole.

This means that you can create shortcuts which can emit any character sequence to the terminal when pressed.  

Back to your original comments, you said that updating bashrc on many systems was hard for you.  Does this mean that you work with a different user account on each system?!
Comment 2 Marc Schoechlin 2007-07-09 07:49:48 UTC
>In KDE 4 there is a tool provided to create, edit and test key bindings from >within Konsole. 
>This means that you can create shortcuts which can emit any character >sequence to the terminal when pressed.   

If that means that i can define a sequence of i.e. 20 shell commands
(aliases, environment variables, ...) for one hotekey which can be inserted
by pressing the hotkey  -this could be solution...
 
>Back to your original comments, you said that updating bashrc on many systems >was hard for you.  Does this mean that you work with a different user account >on each system?! 

It seems that my description was detailed enough. If you maintain around 300 systems which run different operating-systems, many counries simply add the admins ssh-key to the root´s file "/root/.ssh/authorized_keys" :

- therefore i share the settings of the root-users with other admins
- software like IBM DB2 uses different accounts for every instance user
  -> i often login as root and execute a "su -" to change to other users

My current solution using xterm and fluxbox ;-)

- add the follfowing configuration to .Xresources
  ---
  XTerm*.Translations: #override \
    Ctrl<Key>X: insert-selection(SECONDARY)
  ---
- load the content of a file to the secondary clipboard buffer
  $ cat my-universal-unix-profile | xsel -i -s
- Login to a system as root, change the user with "su - <user>"
  and hit STRG+X

The hotkeys inserts the follwing profile:
---
[ "$BASH_VERSION" = "" ] && bash
uname -a|egrep " s96..0..*|s96.*pz[0-9]" && export PS1="\[\033\]\[[0;33;40m\]\u@\h:\$ "

alias DATE="date \"+%Y-%m-%d_%H-%M-%S\""; alias bps="/usr/ucb/ps"; alias ggrep="/usr/local/bin/grep"
alias gdiff="/usr/local/bin/diff"; uname |grep -i Linux || export TERM=vt220
stty erase ^?
export EXINIT="set autoindent showmode showmatch ignorecase flash notimeout"
type -p less >/dev/null 2>&1 && export PAGER=less
lspath(){
  CURR="`/usr/*bin/nslookup $(uname -n) 2>/dev/null|awk '/'$(uname -n)'/{print $2}'`"
  if ( echo $1|egrep "^/" >/dev/null 2>&1); then
    echo -e "\n '${LOGNAME}@${CURR}:$1\n"
  else
    echo -e "\n '${LOGNAME}@${CURR}:${PWD}/$1\n"
  fi
}
uname |grep -i Linux || alias screen="SHELL=/usr/bin/bash TERM=vt100 screen"; alias less="less -n"
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
export PATH=$PATH:/application/shared/install/client/bin
type less && export PAGER="less"
type vim  && alias vi="vim" && alias view="vim -R"
alias l="ls -la"; alias ll="ls -l" ; alias lf="ls -Fa"; alias sl="ls"; alias lt="ls -latr"; alias cdp="cd -P"
---
Comment 3 Robert Knight 2007-07-09 21:15:56 UTC
The key binding editor is not designed to facilitate easy input of sequences that complex.  Is it possible to put the script in a central location and fetch / source it as needed?
Comment 4 Marc Schoechlin 2007-07-09 23:41:40 UTC
Not really :-)

I think an automated input of the content of a textfile by hotkey would not be complex to implement, but very helpful for users with many boxes to maintain (i.e admins of large sites) :-)

I thought about implementing this by myself, but the overhead for a first working compile of konsole frighten me off :-)
Locating the right svn-url, finding out how cmake works and resolving dependencies - no problem for people which are used to hack kde-applications, but a lot of overhead for externals.
Comment 5 Robert Knight 2007-07-10 02:19:29 UTC
> but the overhead for a first working compile of konsole frighten me off :-)

> Locating the right svn-url, 
> finding out how cmake works and 
> resolving dependencies

Fortunately everything you need to know is documented in one place:

http://techbase.kde.org/Getting_Started/Build/KDE4

Judging by the number of new contributors we have, especially people who have not previously written much C++ code for free software projects, I think that setting up a KDE 4 environment can be done without too much difficulty.    

Back to the bug report.  Whether such a feature is worthwhile having in Konsole is still something I am not sure of.  This is the only bug report for automated input that I can recall seeing.  Features that are in high demand tend to have several related bug reports, many comments and a reasonable vote total.  I am curious as to how other sysadmins solve this problem.