Certain special hardware configurations require a few special commands to run whenever you start Xubuntu, and it’s easy to automate these. Generally, these should work regardless of how you run them. Unfortunately, there are some situations where you might find that it works fine if you run them individually but not automatically. The program has to do with the way Xubuntu interacts with the X11 graphical user interface, but you should find that it’s a easy fix.
Assume, for instance, that you’re running a pair of commands each time Xubuntu starts to configure your mouse. Both of these commands work if you run them inside of the terminal or perhaps by holding down the Super or Windows key and pushing R to open the Xfce4 Application Finder. In either case, these work fine. Sometimes if you attempt to run them at startup with the “Sessions and Startup” app, only one of these two will actually take effect. Reconfiguring xset and then setting a checkbox in Xubuntu might be all you need to get it working.
Running xset or xinput Commands at Startup
Make sure that the hardware configuration commands you’re working with run just fine in the terminal before proceeding. Occasionally, the problem is the result of a typographical error rather than any strangeness in Xubuntu. If you’re completely sure that you have everything configured properly, then open the Sessions and Startup program again. Navigate to the “Application Autostart” tab, and then either select Add to double-click on an entry to edit it. Assume you’re working with a mouse configuration command like xset m 2 16, try sleeping it for several seconds. You’ll still want to make sure that the xset command itself is correct, and you’ll probably want to reevaluate your reasons for setting this manually. Some of the advanced settings users put through with xset can instead be more easily accomplished through the tools that Xubuntu itself uses.
Users who have worked with bash scripts before are probably already familiar with how to do this, but those who aren’t can delay the command from executing, which gives it time to run only after Xubuntu loads a bunch of Xfce4 defaults. Using the above command, you can sleep it for 10 seconds by changing it to:
bash -c ‘sleep 10 && xset m 2 16’
When you start Xubuntu, the installed desktop interface attempts to load a number of what it considers rational defaults. For most hardware, these are correct, but they can override some custom settings that get carried out before they do. This can ultimately result in the types of conflicts you might have been seeing. By delaying execution, that code runs the specific command only after Xubuntu is done. You might find you need to change the 10 in that command to an even longer delay. It depends on how long Xubuntu takes to boot your machine, and a little bit of experimentation could be involved. You shouldn’t ever have to set the command to sleep for more than 20 seconds. If you do, then more than likely something is making Xubuntu boot very slowly. In these cases, you might have too many processes launching on startup.
Perhaps you have too many packages installed that you’re no longer using. Ironically, you might find it easiest to rectify this situation by installing the Synaptic package manager if you haven’t already. Use sudo apt-get install synaptic and then run the program once it’s installed. You might find some programs that you’re no longer using and therefore you can get rid of. This can aid startup performance. Any other performance tweaks you might attempt could also help to reduce the amount of time needed to delay the xset command. In our example images, Xubuntu was running a custom theme from xfce-look, and if this is the case on your system, you might want to see how heavy the theme is. Some custom Xubuntu themes take a while to load and might degrade overall performance over time anyway.
Whenever you power your machine off, you might want to make sure that the “Save Session” checkbox is checked to make sure that Xubuntu saves your your settings, which might have to alleviate this issue as well. Reboot the machine after doing this only after you’ve gotten the xset command to stick and see if it now starts everything up correctly. If it does so, then you shouldn’t have any further problems.
Keep in mind that while you’d need to replace the code between the two ampersands and the single quote, you could also use this if you find that Xubuntu is overriding a xinput command used to configure your mouse or keyboard. Technically, you could put any code there you want Xubuntu to execute when it boots, but it’s default settings won’t replace most other types of commands. These defaults only point to basic input devices, and they won’t get applied when you switch back and forth between virtual consoles.
Some users say that the bash delay code should be hidden inside of an executable shell script, but this generally isn’t necessary. The Sessions and Startup program can run run anything that you throw at it. Other users suggest that these commands should be mapped to a keyboard shortcut using the Xfce4 keyboard shortcut tools that come with Xubuntu. While setting it up this way won’t cause any harm, this too is technically unnecessary. Simply using the Sessions and Startup app with an appropriate bash delay should work in the overwhelming majority of situations.
Check your xset command to ensure that you’re not using -bc compatibility option settings for the server. Xubuntu will always override these, since the type of legacy hardware they’re designed to support doesn’t quite mesh with the Xfce desktop interface that Xubuntu uses.