The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

How to set $TERMINAL with tmux

asked 2015-08-20 13:29:56 +0000

degill gravatar image

updated 2015-08-20 13:31:09 +0000

Hey there,

I tried to change the behaviour of i3-sensible-terminal to open my terminal of choice with tmux. In my case I tried to set $TERMINAL = "xfce4-terminal -e tmux"

But the script of i3-sensible-terminal calls "command -v $TERMINAL" which prints

/usr/bin/xfce4-terminal

/usr/bin/tmux

which indicates it thinks that $TERMINAL are actually two commands and not one thus only opening xfce4-terminal

So how can I set it to use "xfce4-terminal -e tmux" as one command?

Thanks :)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-08-20 15:46:13 +0000

i3convert gravatar image

updated 2015-08-21 04:18:39 +0000

  1. Why do you run i3-sensible-terminal instead of just running xfce4-terminal -e tmux? Do you expect that xfce4-terminal would not be available?
  2. Another option would be to write your own script that would run the entire command. Create, say, /home/your_user_name/bin/myterminal.sh that looks as follows:

    #!/bin/bash
    xfce4-terminal -e tmux
    

    and set TERMINAL=/home/your_user_name/bin/myterminal.sh. The problem with this is that this won't check whether xfce4-terminal is available. The script i3-sensible-terminal will only check if /home/your_user_name/bin/myterminal.sh if available.

  3. If you run i3-sensible-terminal from your config file, your setting of the variable $TERMINAL may not be available. In this case you could still run exec --no-startup-id bash -c "TERMINAL=/home/your_user_name/bin/myterminal.sh i3-sensible-terminal" to provide the right value of $TERMINAL.

The bottom line is the first answer. You probably just want to run your command instead of i3-sensible terminal.

edit flag offensive delete link more

Comments

Thanks i3convert. That does work. I just hoped I could get around without making a script for that (I have ton of them now). But thanks :)

degill gravatar imagedegill ( 2015-08-20 20:59:44 +0000 )edit

I am sorry. I jumped the gun. Your idea works, but not everywhere. When I issue "i3-sensible-terminal" it correctly executes my script and thus starting xfce4-terminal with tmux. But if I let i3 start a terminal for me (e.g. when I have a error in my i3/config) then my script is *not* executed :-/

degill gravatar imagedegill ( 2015-08-20 22:03:33 +0000 )edit

I don't understand your comment. What do you mean by "when I have a error in my i3/config"? Perhaps you should fix it :) More seriously, probably you are complaining some variable not being set when the script is running. I'm extending my answer.

i3convert gravatar imagei3convert ( 2015-08-21 04:05:09 +0000 )edit
1

Finally, why don't you just run `xfce4-terminal -e tmux` when it's needed instead of `i3-sensible-terminal`?

i3convert gravatar imagei3convert ( 2015-08-21 04:06:41 +0000 )edit

What I meant with "when I have an error" is: If, just as an example, I have an error in my i3config, then i3 pops up a i3-nagbar where I can hit "edit config" and i3 opens my prefered terminal, which is determined by i3-sensible-terminal :)

degill gravatar imagedegill ( 2015-08-24 16:10:40 +0000 )edit

Question Tools

1 follower

Stats

Asked: 2015-08-20 13:29:56 +0000

Seen: 252 times

Last updated: Aug 21