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

Script only has effect when i3 is restarted

asked 2015-06-22 21:10:25 +0000

Pinyaka gravatar image

I have the following last line in my .i3/config file:

exec_always --no-startup-id /home/will/etc/will-laptop/scripts/office-monitor-setup.sh

The script (below) just executes some xrandr stuff, but the modified resolutions don't take effect the first time i3 is started. If I restart i3 or execute the script from a command line, it seems to run just fine. I've tried removing the path with no effect. I've tried running it as exec i3-msg 'exec office-monitor-setup.sh' with no effect. The i3 debugging output says that it's running the script and there's no error or anything. Any help?

office-monitor-setup.sh:

#!/bin/bash

Primary="HDMI1"
Secondary="VGA1"
Default="LVDS1"

if (xrandr | grep "$Primary connected"); then
    xrandr --output $Primary --primary --mode 1920x1080 --refresh 60
    xrandr --output $Default --off
    if (xrandr | grep "$Secondary connected"); then
        xrandr --output $Secondary --pos 1920x0 --mode 1600x1200  --refresh 60
    fi
fi

nitrogen --restore
edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2015-06-23 06:47:17 +0000

oberon gravatar image

updated 2015-06-23 06:47:41 +0000

Would it be possible that the script needs to be delayed to be effective? You could try running it after a leading exec sleep 5 && ...

edit flag offensive delete link more

Comments

That seems a bit kludgey, but it showed that the problem is with xrandr and not with i3.

Pinyaka gravatar imagePinyaka ( 2015-06-23 17:44:05 +0000 )edit

Question Tools

1 follower

Stats

Asked: 2015-06-22 21:10:25 +0000

Seen: 68 times

Last updated: Jun 23