You are not logged in.

#201 2012-05-31 18:59:11

Šaran
Member
From: Bosnia
Registered: 2011-09-03
Posts: 407

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

I'm running rtorrent as daemon in detached session via rc.d script from the wiki.
Now I'd like to run few other apps in the same session (mail, fm, etc.). How to accomplish this?

Offline

#202 2012-05-31 19:04:22

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,535
Website

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#203 2012-05-31 19:18:03

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,617

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

I use two custom .tmux.conf files to launch tmux with two windows and four windows.  I did the same with screen, but screen started all the windows in the directory from which I ran the command.  I tried "set -g default-path ..." but that doesn't affect the first window.  Plus, I would rather it start in PWD.  Any suggestions?

Four-window conf:

$ alias
...
alias tmux4='tmux -f ~/.tmux4 attach
...
$ cat .tmux4
set -g default-path /home/testing/bin

unbind C-b
set -g prefix ^A

new -n bash
splitw -h -p 50 -t 0
splitw -v -p 50 -t 0
splitw -v -p 50 -t 1
selectp -t 0

Last edited by alphaniner (2012-05-31 19:20:25)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#204 2012-05-31 19:26:58

Šaran
Member
From: Bosnia
Registered: 2011-09-03
Posts: 407

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

@jasonwryan, I tried it already. With session info in .tmux.conf 'tmux a' will show rtorrent session if daemon is started, and if not, it will show session defined in config. I want to have everything in session started by daemon.

EDIT: Solved, I made bash script as explained here, only without line which creates new detached session.

Last edited by Šaran (2012-05-31 19:41:16)

Offline

#205 2012-07-13 18:14:27

wavelander
Member
From: India
Registered: 2012-02-12
Posts: 20
Website

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Hey I've just installed tmux 5 days ago or so..and its amazing.
But for the past 2 days.. I've been having problems configuring my tmux to run 256-color setups.
I've been trying to setup vim colorschemes (over at http://bytefluent.com/vivify/ )  but because of the 8-bit color output its not possible. Something messes up the color output to an 8-bit output.

The output of tput colors is : xterm-256
I have already : set -g default-terminal "screen-256color" ## in my ~/.tmux.conf
and : set t_Co=256 ## in my ~/.vimrc

I don't seem to have a ~/.profile
export TERM="xterm-256color"
alias tmux="tmux -2" ## in ~/.bashrc did not help either.

thanks.

Offline

#206 2012-07-13 18:27:42

archtaku
Member
Registered: 2010-07-02
Posts: 84

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Well you should never be setting TERM manually, anyway.

In a new, non-tmux terminal, what is the value of TERM?

Offline

#207 2012-07-14 03:08:34

wavelander
Member
From: India
Registered: 2012-02-12
Posts: 20
Website

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Okay I found that the value of TERM in a non-tmux terminal was "xterm" so I did an  "export" there.
It works fine ONLY when I run tmux after opening a terminal by command.

If I run tmux automatically on startup ( after editing my .bashrc) it doesn't support 256 colors. 8-bit again.

I think its some problem with my .tmux.conf.

Last edited by wavelander (2012-07-14 03:25:14)

Offline

#208 2012-07-14 03:30:38

archtaku
Member
Registered: 2010-07-02
Posts: 84

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Export what? I told you not to mess with the TERM variable.

Are you setting TERM anywhere in any of your shell rc files? If so, then you need to comment out (or better yet, delete) any lines where you are exporting TERM. Then logout and log back in to make sure that your login session isn't polluted with that. You should almost never set TERM manually.

Have you exited all tmux windows and started a new tmux server since adding the default-terminal parameter? The .tmux.conf is only read when the server starts. If you have any other sessions (attached or not) when you exit a session, the server continues to run, so tmux won't read the config file when you open a new terminal and start a new tmux session. Either exit all tmux sessions and start a new one or run tmux source ~/.tmux.conf to reload the config.

Offline

#209 2012-08-03 17:47:32

archtaku
Member
Registered: 2010-07-02
Posts: 84

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Wrote this to make it easier to login to a bunch of servers and run the same command on all of them at once.

ClusterSSH is cool but when I VPN into work, a lot of hosts are firewalled from the VPN. Trying to X11 forward 10 or 12 xterms, or hack something together with dynamic SSH forwarding and send the clusterssh command over a tunnel was more trouble than it was worth.

This script uses the tiled pane layout and the synchronize-panes window option to send the same keystrokes to every pane at once.

#!/bin/sh
#
# Script Name: tssh
# Description: Emulates clusterssh natively in tmux
# Usage:       tssh host1 host2 host3 ...
#

################################# FUNCTIONS ##################################

function cur_win () {
  echo `tmux list-windows -F '#I:#{window_active}' | grep '1$' | cut -f1 -d:`
}

function build_target_arg () {
  while getopts 't:' option; do
    case $option in
      t) target_window=$OPTARG;;
    esac
  done

  if test -n target_window; then
    echo " -t :${target_window}"
  fi
}

function cur_pane () {
  target_arg=$(build_target_arg $@)
  echo $(tmux list-panes -F '#P:#{pane_active}'${target_arg} | grep '1$' | cut -f1 -d:)
}

########################### MAIN SCRIPT EXECUTION ############################

if [ -z "$TMUX" ]; then
  echo Must be run from within an active tmux session 1>&2  
  exit 1
fi

# find index of starting window
win_init=$(cur_win)

tmux set-window-option -t $win_init quiet on

# create new tmux window
tmux new-window -n tssh

# get index of new window
win_new=$(cur_win)

# get initial pane number for cleanup later
initial_pane=$(cur_pane -t $win_new)

for host in $@; do
  tmux split-window "/usr/bin/ssh $host"
  tmux select-layout tiled
done


# cleanup
tmux kill-pane -t $initial_pane
tmux select-layout tiled
tmux set-window-option -t $win_new synchronize-panes on

tmux set-window-option -t $win_init quiet off

Offline

#210 2012-12-01 13:25:48

sime
Member
Registered: 2007-12-14
Posts: 96

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Put this bad boy in .tmux.conf:

bind S command-prompt -p 'SSH to:' "new-window -n %1 'ssh %1'"

Offline

Board footer

Powered by FluxBB