0

I'm using xfce, and want to create a shortcut Super + t for starting up terminal with tmux. What command should I put it to execute upon shortcut? I tried st tmux attach , however it fails when there isn't any tmux session running(instead, the terminal appears for a fraction of a second and doesn't even let me see what the problem is).

Normal st tmux causes, which is .

For some time, I used the following in my .bashrc:

# get into tmux at start
[ -z "$TMUX" ] && { tmux attach || exec tmux new-session; }

But I removed it, as it was inconvienent when I wanted to run the terminal without tmux. And to add to that, I couldn't use bash at all when my partition was full. Couldn't even login!

1

How I worked around it:

I created a script start-tmux.sh, which contains the following:

#!/bin/bash
# if not inside tmux, then start it.

if [ -z "$TMUX" ]; then
    tmux attach || exec tmux new-session
else
    echo "already in tmux!"
fi

And I execute command st start-tmux.sh upon hitting Super + t

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.