How to Set Startup Applications in AwesomeWM

Spread the love

One of the coolest features that desktop environments and window managers have is the ability to schedule certain programs to open as soon as you log in. Set this up and your Linux session will be ready to use at the get-go.

So how do you make programs start automatically at login with the Awesome window manager?

Backing up rc.lua

Before you add the auto-start code to AwesomeWM’s configuration file, you might want to create a backup. You can do this by entering these commands.

sudo mkdir /etc/awesomebackup
sudo cp /etc/xdg/awesome/rc.lua /etc/awesomebackup

This will create a backup directory and make an exact copy of the rc.lua file before any edits are made to it. That way if you have any issues with the edits you’ve made, you can quickly restore it and then start all over. Alternatively, if you’ve decided you no longer want applications to start automatically, you can restore your backup file and have everything back to normal.

Editing rc.lua

In order to get auto-start working correctly, you’ll need to edit AwesomeWM’s main configuration file. Do this by opening a terminal and entering the following:

sudo nano /etc/xdg/awesome/rc.lua

This will open up Awesome’s configuration file inside the nano text editor. From there you’ll need to paste the following code to the very bottom of the rc.lua file.

-- Autorun programs
autorun = true
autorunApps =
{
   "swiftfox",
   "mutt",
   "consonance",
   "linux-fetion",
   "weechat-curses",
}
if autorun then
   for app = 1, #autorunApps do
       awful.util.spawn(autorunApps[app])
   end
end

In order for this specific code to work, you’ll need to replace the word “program” with whatever you plan to have auto-start. It should also be noted that you can remove or add as many of the “program” lines as you want.

When you’ve replaced “program” with the name of the program(s) you want starting with when you log into AwesomeWM, you’ll need to save the rc.lua file. Press “Ctrl + O” to write out the file.

After the file is saved, just log out of AwesomeWM and then log back in. All of the programs you set to automatically open via rc.lua should open within a few seconds.

Undoing auto-start

Have you tried using auto-start in AwesomeWm and decided that’s just not something you want? That’s fine! Not everyone likes programs opening automatically. Fortunately there’s a very simple way to make your AwesomeWM session go back to normal. Just enter these commands into a terminal:

cd /etc/xdg/awesome/
sudo rm rc.lua
sudo cp /etc/awesomebackup/rc.lua /etc/xdg/awesome/

Conclusion

Perhaps one of the most well-known window managers currently available for Linux is AwesomeWM. It’s an incredible, lightweight tiling window manager. It’s coded with the Lua programming language.

Auto-starting isn’t a new thing, but I’d argue that it’s an important feature. Without it, how would you load your Dropbox sync, start up your browser, etc., without having to repeatedly click on things right after you log in?

Do you like auto-starting programs, scripts, etc., when you log into your Linux session? Why or why not? Tell us in the comments!

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe


Derrik Diener

Derrik Diener is a freelance technology blogger.

Comments (1)