Ubuntu – Ubuntu 14.04 + gnome 3.10 + gnome-shell restart

gnomescripts

Is there a way to ask gnome-shell to run a shell script every time it starts?

(Like after a Alt+F2 then r, not on Login)

NB: If you think it's about the start-up list, it's not : do a Alt+F2 then r and tell me if the apps in start-up list are launched: They're not (at least not on my setup).

Unfortunately, through a shell script it's not working yet :

#!/bin/bash
 gnome-shell --replace
 sleep 10
## reset screen config
 xrandr --output HDMI1 --mode 1920x1080 --pos 0x0 --rotate normal --output VIRTUAL1 --off --output DP1 --off --output eDP1 --off --output VGA1 --off

## reset keyboard
setxkbmap fr

the xrandr command is working as expected on startup

if i type in terminal sh rgnome.sh, gnome is restarted, but the next commands don't seem to get executed (and if i close the terminal it kills gnome); i'm not versed in shell scripting, so i may be doing something obvious very wrong

Best Answer

You can create a shell script available within your path, maybe call it r.sh.

That script should call the gnome-shell --replace command, and then the commands you use to fix your display config.

You might need to wait a couple of seconds before running those commands in order to wait for the replace to succeed.

EDIT:

The script might be something along the lines of this:

#!/bin/bash
gnome-shell --replace
sleep 2
fix-your-display-commands
Related Question