The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

workspaces away after unplugging monitor

asked 2013-01-01 23:01:28 +0000

i3-tiler gravatar image

Hey guys,

i3 is running on my notebook and an external TFT is connected via VGA. If I unplug the VGA cable and put it back again everything works fine (means the workspaces on the TFT are still there). Sometimes I need to unplug the VGA cable and then work for a while. When I then come back later and reconnect the cable (after 1h for example) I can't get back the workspaces on the external monitor (TFT) anymore, the screen just stays black.

I'm not sure if I missunderstand something here but actually that should work without problems. Do you guys maybe have an idea what there could be the reason...

edit retag flag offensive close merge delete

5 answers

Sort by ยป oldest newest most voted

answered 2013-03-10 04:13:06 +0000

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

Hi, These are the aliases I use, and they work pretty well. YMMV:

_vga=$( xrandr  | sed -n 's/^\(VGA.\).*/\1/pg')
alias laptop='xrandr --output LVDS1 --auto --output $_vga --off'
alias monitor='xrandr --output LVDS1 --off --output $_vga --auto'
alias dual='xrandr --output LVDS1 --auto --left-of $_vga --output $_vga --auto'

The reason for $_vga is that sometimes external monitor is VGA1 and sometimes it's VGA2.

edit flag offensive delete link more


I don't know on what it depends but with _some_ monitors I just need to switch between virtual consoles like Michael suggested above and all workspaces were like before unplugging the notebook.

i3-tiler gravatar imagei3-tiler ( 2013-03-10 10:59:43 +0000 )edit

answered 2013-01-03 23:35:01 +0000

i3-tiler gravatar image

xrandr was also my thought. Today I could test this scenario again. Unfortunately xrandr didn't make it, although xrandr shows that VGA1 is connected. I have no idea how to trigger that the monitor is getting recognized...

edit flag offensive delete link more


Please post comments like that as a comment in the future, not as an answer. Also, try switching to the first virtual console (Ctrl-Alt-F1), then back to X11 (Ctrl-Alt-F7 usually)

Michael gravatar imageMichael ( 2013-01-03 23:41:38 +0000 )edit

I recognized answering is not the right option (directly after I applied it) :( Thanks for your hint, I'll give it a try.

i3-tiler gravatar imagei3-tiler ( 2013-01-04 10:51:31 +0000 )edit

I tried it with switching between the virtual consoles but it didn't work... :(

i3-tiler gravatar imagei3-tiler ( 2013-01-07 21:58:10 +0000 )edit

answered 2013-01-02 17:06:40 +0000

Zucca gravatar image

updated 2013-01-02 17:55:49 +0000

You might try using xrandr like this:

xrandr --output VGA1 --auto --left-of LVDS1

VGA1 being your external TFT and LVDS1 your netbooks monitor. To see which are correct values just run xrandr alone without arguments. After you find the correct xrandr command you might like to bind it to a keypress. I think there is no automatic way to do this... Unless you constantly poll xrandr for connected monitors... which isn't very pretty. :(

For autodetecting, here might lie an answer sooner or later:

edit flag offensive delete link more

answered 2013-01-08 12:43:44 +0000

Cloud gravatar image

updated 2013-01-08 12:47:08 +0000

Have you tried to in-place restart i3? (In my config is: Mod1+Shift+r, check your config file for it.

That is, do an in-place restart after you reconnect the VGA monitor.



edit flag offensive delete link more


That should not be necessary when you use xrandr to properly configure the monitors.

Michael gravatar imageMichael ( 2013-01-08 17:32:14 +0000 )edit

I use xrandrd in the setup script of i3 (I called it First it checks if the external monitor is connected (e.g., xrandr | grep "VGA1 connected"), then depending on that it either sets up two screens or one.

Cloud gravatar imageCloud ( 2013-01-09 08:49:24 +0000 )edit

I use xrandr in my setup too. Pretty much like you described. Restarting in place I also tried but that did not work. At the moment I have no further ideas...

i3-tiler gravatar imagei3-tiler ( 2013-01-09 22:10:26 +0000 )edit

note that for the script to be executed all the times i3 restarts you need to use the exec_always command in the config. My script for setting up monitors can be found here:

Cloud gravatar imageCloud ( 2013-01-10 10:56:44 +0000 )edit

answered 2013-06-18 12:16:58 +0000

kynan gravatar image

I use disper (, a very handy command line utility for switching display configurations. It is a wrapper around nvidia-xconfig but can fall back on xrandr if you don't use the nVIDIA binary driver / don't have nVIDIA hardware.

On top of that there's auto-disper (, which you can bind to a key and it will detect your display configuration and automatically switch to a pre-configured profile.

P.S.: I had to cripple the post because my karma is insufficient to publish links.

edit flag offensive delete link more

Question Tools


Asked: 2013-01-01 23:01:28 +0000

Seen: 1,378 times

Last updated: Jun 18 '13