is there any way I can open multiple terminals on the xfce4 window automatically every time I start xfce4? - shell

I'm doing some experiments and while I do it I have to turn a board off and on frequently (a program doesn't get killed properly probably with unclosed socket .. I installed signal handler and it worked and now it doesn't..) . Every time I turn on the board, I start vnc window (it starts xfce4 ) and have to open terminals in specific location. Is there any setup method through which the terminals are open automatically in specific locations? Or further with specific number of tabs? (I know how to give xwindow location and size : xwininfo -all. and use -geometry 1000x1000+300+300 for example).

From what I understand, you could add commands to the application autostart menu in Settings > Session and startup and give the command the working directory as an option as follows:
xfce4-terminal --default-working-directory="/home/$USER/Desktop"
The different options available are:
OPTIONS
Option Summary
Here is a summary of all the options, grouped by type. Explanations are in the following sections.
General Options
-h, --help; -V, --version; --disable-server; --color-table; --default-display=display;
--default-working-directory=directory
Window or Tab Separators
--tab; --window
Tab Options
-x, --execute; -e, --command=command; -T, --title=title; --dynamic-title-mode=mode;
--initial-title=title; --working-directory=directory; -H, --hold; --active-tab;
--color-text=color; --color-bg=color
Window Options
--display=display; --drop-down; --geometry=geometry; --role=role; --startup-id=string; -I,
--icon=icon; --fullscreen; --maximize; --minimize; --show-menubar, --hide-menubar;
--show-borders, --hide-borders; --show-toolbar, --hide-toolbar; --show-scrollbar,
--hide-scrollbar; --font=font; --zoom=zoom
Refer to the man page for more settings related to tabs and windows.
man xfce4-terminal

Related

bash behaviour of pressing <tab> twice for filename completion

As an example, say that I type part of a name:
$ vi partn <= here I press <tab><tab>
partname partnook partnum <= these are the results
This is standard behaviour in bash and that is fine, but I've been working a lot on PowerShell lately where the default behaviour is that if you press tab, it cycles through the names, completing each name and then pressing tab again will go to the next file, so if I pressed tab one time, I see vi ./partname, then press tab again, I see vi ./partnook, then tab again I see vi ./partnum. I tend to prefer this behaviour as it's less typing (you just hit tab to cycle through until you get the filename or command that you want).
Everything is customisable in Linux of course, so can someone advise how I might change the default bash behaviour to follow the above by default?
To persistently make tab-completion not require two Tab keypresses whenever there are multiple matching completions and to instead cycle through them, in-line:
Option A: If you either already have:
an /etc/inputrc file (applies system-wide, modification requires sudo)
and/or a ~/.inputrc file (user-specific)
and/or
you're planning to customize the Readline library extensively and/or want to make customizations effective for scripts too when they call read -e:
Add line:
"\C-i": menu-complete
to either file, depending on whether you want the setting to be effective for all users or the current user (create the file, if necessary).
Note: Alternatively, you can simply turn off the need to press Tab twice and exhibit the standard behavior instantly, which means showing a multi-column list of all possible completions, and then redisplaying the input line, to allow you to type additional characters to either fully complete the argument or to type enough of it so that the next Tab keypress unambiguously completes:
set show-all-if-ambiguous on
Option B: Alternatively, you may add Readline commands to your user-specific initialization file (~/.bash_profile on macOS, ~/.bashrc on Linux and other Unix-like platforms), by passing them as a single argument to the bind builtin:
bind '"\C-i": menu-complete'
If you prefer the show-all-matches behavior:
bind 'set show-all-if-ambiguous on'
Note that bind commands in ~/.bash_profile / ~/.bashrc take precedence over equivalent commands in either /etc/inputrc or ~/.inputrc.
As implied above, configuring Readline this way will not take effect in scripts that call read -e in order to activate Readline support for reading user input.

How can I see a preview of a tmux session/window from outside of tmux?

While inside of tmux, I can press PREFIX w, which runs tmux choose-tree.
This brings up an interactive session/window/pane selector that also displays a
preview of the highlighted node.
From a normal shell outside of tmux, I can run tmux attach -t '$1:1' to attach
to any session or window by name or index (see man tmux section "Clients And
Sessions").
Is there command similar to tmux attach -t where I can pass in a session/window
name/index and see a preview of it, like to the one used in tmux choose-tree? Ideally this command would just show the lower portion of this
image:
The goal here is to pipe a list of tmux windows from all sessions to
fzf, and pass a separate command in fzf's
--preview flag to show a preview of the session/window currently highlighted
while fuzzy finding.
I have a draft working
here.
It populates a preview with the session/window index in a tmux-compliant format
and will switch to the selected session.
This can be partially implemented by means of this recent commit: https://github.com/tmux/tmux/commit/2628af573d98f7bdd4db02c7a80c860b867a45fb
I do so here: https://github.com/petobens/dotfiles/commit/c21c306660142d93d283186210ad9d301a2f5186 in order to get the following:

Xterm*selectToClipboard doesn't work when put in Xresources

I have a problem with my Xterm and I can't figure out what is wrong:
I need to enable the option *selectToClipboard in my Xterm to be able to copy text in the terminal.
To do so i firstly tried to "manually" start xterm with the option with the following command: xterm -xrm 'xterm*selectToClipboard: true' which work very well.
Then to enable the option each time xterm is started I put the following line xterm*selectToClipboard: true in my ~/.Xresources and I used the command xrdb -merge ~/.Xresources to update the settings but it doesn't work: Xterm starts but the option isn't enabled and I can't copy text from the terminal whereas all the other options in the Xresources are enabled and work fine.
Does anyone have an idea of what could cause this problem?
X resources are case-sensitive. The xterm manual documents this as
selectToClipboard (class SelectToClipboard)
Tells xterm whether to use the PRIMARY or CLIPBOARD for SELECT
tokens in the selection mechanism. The set-select action can
change this at runtime, allowing the user to work with programs
that handle only one of these mechanisms. The default is
"false", which tells it to use PRIMARY.
The feature was added to xterm in patch #209 (2006). It is not an optional feature. So (assuming you have typed the command-line as given), there are a few possibilities to check:
you could be running an older version of xterm. To check this, run
xterm -v
The -v version option of xterm will have it print a one-line message showing the patch-level along with the configuration for which it was compiled, e.g.,
XTerm(261)
The feature can be set/reset using an escape sequence, as noted in XTerm Control Sequences:
CSI ? Pm h
DEC Private Mode Set (DECSET).
...
Ps = 1 0 4 1 -> Use the CLIPBOARD selection. (This enables
the selectToClipboard resource).
Your shell initialization may have something which sends this sequence.
The xrdb -query is one way to check for resource-settings, but it is not infallible. A better tool would be appres, e.g.,
appres XTerm
appres UXTerm
depending on whether xterm is run with/without the UXTerm application defaults. In contrast to xrdb, appres shows resource settings after taking into account the "app-defaults" files. (It does not see resources applied only to an instance of xterm such as the -xrm option).
tmux has a feature which can interfere with selections (whether to primary or clipboard). That is called set-clipboard, and is commented upon here:
Enabling mouse in tmux conflicts with paste in X [duplicate]
Re: iTerm2 support for set-clipboard
Short answer:
just need to add the line bellow in your /etc/X11/app-defaults/XTerm file
*selectToClipboard: true
Long answer:
If you look at man pages xterm(1):
man xterm
FILES
The actual pathnames given may differ on your system.
...
/etc/X11/app-defaults/XTerm
the xterm default application resources.
/etc/X11/app-defaults/XTerm-color
the xterm color application resources. If your display supports color, use this
*customization: -color
in your .Xdefaults file to automatically use this resource file rather than /etc/X11/app-defaults/XTerm. If you do not do this, xterm uses its compiled-in default resource settings for colors.
...
I did not find any reference to a user configuration file to set XTerm application defaults, except for XTerm-color, so I don't think it exists.

Multiple tabs with tmux / tmuxinator and iTerm2

I would like to open all my useful stuff like here in iTerm2:
Not like this:
I'm using tmuxinator I've defined some tabs. I wonder if it's possible to get the former behaviour at all.
I just tried with tmux 1.8. Not totally obvious, but it works.
Here's what you do:
Open iTerm2 (latest, be sure to have at least tmux 1.8 installed).
In iTerm2, run command tmux <your tmuxinator profile>. Then detach ^b d.
In iTerm2, run command tmux -CC attach -t <your session>. You will see your tabs open in different windows.
Open menu Shell->Tmux->Dashboard
Select and hide all the windows.
Select all the hidden windows, and click Open in Tabs.
I'd like to know how to avoid the part about hiding and opening in tabs.
Just wanted to add some comments onto what justingordon mentioned (1).
This all works great. But I found how to streamline step 4-6 so it happens automatically.
Go to iTerm2's Preferences, under General, you will see a section titled tmux. There's an option that says When attaching, open unrecognized windows in. If you change the current selection from Windows to Tabs.
Two extra tips.
If you want you could select the option Automatically hide the tmux client session after connection. This will minimize the iTerm2 window in which you typed
tmux -CC attach
I also enabled the option Focus follows mouse. You can find this option under Preferences then Pointer. It should be the first option on the bottom left.
To use tmuxinator with iterm2 panes, use the following configuration:
attach: false
in combination with
on_project_exit:
- tmux -CC attach -t way
It looks like an issue in the documentations as told here
This is an example that I normally use:
# ~/.tmuxinator/way.yml
name: way
root: ~/learn/ruby/ruby-way/
attach: false
on_project_exit:
- tmux -CC attach -t way
# Runs before everything. Use it to start daemons etc.
on_project_start:
- export EDITOR="emacsclient --server-file=way -c"
- export VISUAL=$EDITOR
- emacs --daemon=way --title=RUBY-WAY
- $EDITOR &
windows:
- console:
- echo "A currar"
- testing:
- echo "A testear"
I hope that this helps.
Add this to your tmuxinator config:
attach: false
post: tmux -CC attach
https://github.com/tmuxinator/tmuxinator/pull/293

Working on multiple terminals

I am using ubuntu terminal for my project and at times I need more than 5 terminals to be open at the same time and kind of juggle between them to see outputs of multiple programs running simultaneously. I am having hard time toggling between the terminals. Is there something that will hold all terminals together in one window and make my life simpler? I read somewhere that konsole does that for me, but I cannot bring up konsole for some reason and I am getting an error : bash: konsole: command not found.
Any kind of info/help is greatly appreciated.
Use tmux (and eventually, tmuxinator). It may have a slight learning curve but it'll be worth it, once you have it mastered!
Here's what an example session looks like.
If you want to try Konsole, try installing it first. It's part of KDE if that helps.
http://konsole.kde.org/
Ubuntu comes with gnome iirc. It has gnome-terminal as jasonspiro pointed out.
Have you tried using multiple workspaces? I'm using ubuntu 11 and if I find that I have a terminal layout I like to keep intact I simply place all of those terminals on a 2nd workspace. This can me done by right clicking on the terminal and clicking "Move to another workspace".
Use gnome-terminal instead. http://packages.ubuntu.com/ubuntu-desktop indicates to me that it comes with Ubuntu. It lets you open multiple tabs. Press Ctrl+Shift+T or click the appropriate menu command to open a new tab.
First, consider switching to ubuntu classic desktop. In clasic desktop you can move and resize windows like in um, windows, and then have multiple terminals visible at once.
Second, consider creating new terminals in the one terminal window. This can be done with CTRLSHIFTT
Third, alhough not much more useful for your purposes than the previous suggestion, have a look at screen(1), which is old, featureful, and no longer maintained, or tmux(1), which is still maintained. Either one can be run from a terminal. Both are installable from Software Center or synaptic.
You can use gnome-terminal. The script below will open 3 tabs running the respective commands..
tab="--tab"
cmd01="bash -c 'command in 1st terminal';bash"
cmd02="bash -c 'command in 2nd terminal';bash"
cmd03="bash -c 'command in 3rd terminal';bash"
foo=""
foo+=($tab -e "$cmd01")
foo+=($tab -e "$cmd02")
foo+=($tab -e "$cmd03")
gnome-terminal "${foo[#]}"
exit 0

Resources