execute command on X11 startup

using X11 startup file – it work with any window manager

  • Create a .desktop file in ~/.config/autostart directory
  • Execute a single command with a parameter when X11 start

    cat > ~/.config/autostart/start_script.desktop <<EOF
    [Desktop Entry]
    Name=start_script
    Type=Application
    Exec=setxkbmap pt
    EOF
    

    Execute multiple commands when X11 start

    cat > ~/.config/autostart/start_script.desktop <<EOF
    [Desktop Entry]
    Name=start_script
    Type=Application
    Exec=sh -c "setxkbmap pt; xterm &"
    EOF
    

    using Openbox startup file – work only with openbox

    All lines in ~/.config/openbox/autostart file will be executed on openbox startup

    echo 'tilda' >> ~/.config/openbox/autostart
    

    Leave a comment