You are not logged in.

#1 2013-03-15 09:43:24

dr-peppa
Member
Registered: 2013-03-15
Posts: 4

Irssi in tmux, making use of nicklist.

Hello everyone,

I'm trying to figure out how I could accomplish the following task.

I'm running E17 as a WM and am starting it by typing

 $ startx 

after loging in.

This calls my ".xinitrc" file that looks like this:

.xinitrc:
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

# exec gnome-session
# exec startkde
# exec startxfce4
# ...or the Window Manager of your choice

[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources

urxvt -e bash -c "tmux attach -d -t marsession" & 
exec enlightenment_start

As you can see, I want to have an urxvt-Terminal running tmux from the startup of X11 (i.e. E17). I also want the tmux-session to be initialized with some default windows from the start. (such as window1=mutt, window2=irssi, window3=...)
Therefore my .tmux.conf contains the following lines:

.tmux.conf:
.....
# session initialization
new -s marsession mutt
neww -d -t 2
neww -d -t 3 irssi
neww -d -t 5 
neww -d -t 6 
selectw -t 1
.......

As you can see there is irssi launched in window3. I want to run this instance of irssi with the plugin nicklist.pl.
I have already copied the plugin to ~/.irssi/plugins and loaded the plugin into irssi. So far everything is working quite well.

My Question is now: How can I invoke the following script (provided by the wiki) to automatically detect the running tmux-irssi-session/window, cut the irssi-window in two panes and start "/nicklist fifo".

The code-snippet from the wiki:

#!/bin/bash

T3=$(pidof irssi)

irssi_nickpane() {
    tmux setw main-pane-width $(( $(tput cols) - 21));
    tmux splitw -v "cat ~/.irssi/nicklistfifo";
    tmux selectl main-vertical;
    tmux selectw -t irssi;
    tmux selectp -t 0;
}

irssi_repair() {
    tmux selectw -t irssi
    (( $(tmux lsp | wc -l) > 1 )) && tmux killp -a -t 0
    irssi_nickpane
}

if [ -z "$T3" ]; then
    tmux new-session -d -s main;
    tmux new-window -t main -n irssi irssi;
    irssi_nickpane ;
fi
    tmux attach-session -d -t main;
    irssi_repair ;
exit 0

Again. After "startx" I want to see tmux in a Terminal with irssi on window3, split up into two panes (a big one for irssi and a small one for the list with nicknames) and .nicklistfifo already updated and cat-ed into the smaller pane.

I have tried to add the script to my .bashrc, but that led to tmux starting before X11 started, i.e. in the console. Then I tried (after asking in the #archlinux-channel) saving the script as executable an sourcing it in my .xinitrc but nothing happened.

Does anyone have an idea what exactly I could do?

Thank you in advance.

Greetings.

dp

Offline

#2 2013-03-29 06:27:53

komrad_toast
Member
From: New York
Registered: 2012-08-24
Posts: 34

Re: Irssi in tmux, making use of nicklist.

You could always run irssi inside a screen session inside tmux. Not the most elegant solution (dealing with nested modifier keys and all), but it will work.

Offline

Board footer

Powered by FluxBB