6

My goal make i3 start one browser per monitor on a dual monitor setup.

I can't find how to start a browser and move it to the target monitor.

I've dig through the doc and tried in ~/.i3/config

exec --no-startup-id i3-msg 'workspace 1 ; move workspace to output HDMI1 ; exec chromium --new-window "http://url/1" ; workspace 2 ; move workspace to output HDMI2 ; exec chromium --new-window "http://url/2"'

But both windows appear on 1st monitor leaving the second one blank.

What did I miss ?

Xorg is configured as follow:

Section "Monitor"
  Identifier "HDMI1"
  Option     "Primary" "true"
EndSection

Section "Monitor"
  Identifier "HDMI2"
  Option     "LeftOf" "HDMI1"
EndSection

EDIT:

I've added to ~/.i3/config

workspace 1 output HDMI1
workspace 2 output HDMI2

I've tried

exec --no-startup-id i3-msg 'workspace 1; exec xeyes'
exec --no-startup-id i3-msg 'workspace 2; exec xclock'

or

exec --no-startup-id i3-msg 'workspace 1; exec xeyes; workspace 2; exec xeyes'

Always the same result, both apps start on last selected workspace.

2
  • There you can find the explanation about why what you are trying fails : faq.i3wm.org/question/3447/… Are you planning to open always the same websites on startup ? Commented May 17, 2017 at 9:05
  • @daftaupe, yes always the same page on the same screen.
    – Nelstaar
    Commented May 19, 2017 at 7:53

3 Answers 3

5
+50

You could assign specific class names to your Chromium instances and tie them to workspaces. So with 2 monitors config:

workspace 1 output HDMI1
workspace 2 output HDMI2

for_window [class="^chromium-no-1$"] move workspace number 1
for_window [class="^chromium-no-2$"] move workspace number 2

You'll need to start 2 browser instances with specific class values:

$ chromium-browser --class=chromium-no-1
$ chromium-browser --class=chromium-no-2
2
  • 1
    On ArchLinux, the command workspace 1 output HDMI-0 just gives me a new workspace with the name 1 output HDMI-0
    – msrd0
    Commented May 18, 2017 at 19:36
  • @anlar Bullseye!
    – Nelstaar
    Commented May 19, 2017 at 8:50
1

I am using i3wm with ArchLinux on a dual monitor setup quite successfull. When I start i3, I get one workspace on each monitor. To move a workspace on a different monitor, I've added the following to my ~/.i3/config:

bindsym $mod+Mod1+Up    move workspace to output up
bindsym $mod+Mod1+Down  move workspace to output down
bindsym $mod+Mod1+Left  move workspace to output left
bindsym $mod+Mod1+Right move workspace to output right

This allows me to move workspaces to a different output. But to have two browsers on different workspaces (and unless otherwise configured one workspace contains only one screen) you can just move the browser to the workspace on the other screen, or just on the other screen with default $mod+Left/Right.

Here are all bindsym's related to positioning windows that I use:

# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+odiaeresis move right

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10

# move workspace to another output/monitor
bindsym $mod+Mod1+Up    move workspace to output up
bindsym $mod+Mod1+Down  move workspace to output down
bindsym $mod+Mod1+Left  move workspace to output left
bindsym $mod+Mod1+Right move workspace to output right
1

Here is my final kiosk setup for the record.

In ~/.xinitrc I appended:

# disable screen saver
xset s off
xset -dpms

# start window-manager
i3

In ~/.i3/config I appended:

# Setting workspace to monitors
workspace 1 output HDMI1
workspace 2 output HDMI2

# tie each browser to each monitor
for_window [class="^chromium-left$"] move workspace number 1
for_window [class="^chromium-right$"] move workspace number 2

exec ./start-browsers.sh

And to start browsers

./start-browsers.sh

#!/bin/bash

left_url="http://whatever/url/for/left/monitor"
right_url="http://whatever/url/for/right/monitor"

tmpdir1=$(mktemp --directory)
tmpdir2=$(mktemp --directory)

left_target="chromium --new-window $left_url \
--user-data-dir=$tmpdir1 \
--class=chromium-left \
--no-first-run \
--disable-restore-session-state \
--no-default-browser-check \
--disable-java \
--disable-translate \
--disable-infobars \
--disable-suggestions-service \
--disable-save-password-bubble \
--start-fullscreen"
right_target="chromium --new-window $right_url \
--disable-java --user-data-dir=$tmpdir2 \
--class=chromium-right \
--no-first-run \
--disable-restore-session-state \
--no-default-browser-check \
--disable-translate \
--disable-infobars \
--disable-suggestions-service \
--disable-save-password-bubble \
--start-fullscreen"

# start app for left screen
i3-msg 'workspace 1'
$left_target &

# start app for right screen
i3-msg 'workspace 2'
$right_target &

# hide mouse pointer
unclutter &
1
  • unclutter is a tools to hide steady mouse pointer.
    – Nelstaar
    Commented May 19, 2017 at 8:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .