How to have all floating windows always on top in awesome-wm

3 min read 21-10-2024
How to have all floating windows always on top in awesome-wm

If you're using Awesome Window Manager (Awesome WM), you may want to keep your floating windows visible at all times by ensuring they stay on top of all other windows. This is especially useful for applications like chat clients, media players, or any tool you want to keep accessible while working on other tasks. In this article, we will walk you through the steps to set floating windows to always be on top.

Understanding the Problem

The default behavior of floating windows in Awesome WM is that they can be obscured by other windows. This can sometimes disrupt your workflow if you need constant access to certain applications. Therefore, you may want to modify their settings so that they always stay on top of other windows.

Original Code for the Problem

To achieve this, we can modify the Awesome WM configuration file, typically found at ~/.config/awesome/rc.lua. You can set certain rules for your applications to always float and remain on top. Here’s how you can do this:

awful.rules.rules = {
    ...
    { rule = { class = "YourFloatingAppClass" },
      properties = { floating = true, above = true } },
    ...
}

Step-by-Step Guide to Keep Floating Windows Always on Top

  1. Open Your Configuration File: Open your rc.lua file using a text editor of your choice. You can do this by running:

    nano ~/.config/awesome/rc.lua
    
  2. Locate the Rules Section: Find the section where rules are defined, usually denoted by awful.rules.rules.

  3. Add the Floating and Always on Top Rule: Add a new rule for your application, as shown below. Make sure to replace "YourFloatingAppClass" with the actual class name of the application you want to set. You can find the class name using the xprop command in the terminal:

    xprop | grep WM_CLASS
    

    After running the command, click on the application window you want to inspect, and it will display the class name.

  4. Example: For example, if you want to keep the mpv media player always on top, the rule in your rc.lua would look like this:

    { rule = { class = "mpv" },
      properties = { floating = true, above = true } },
    
  5. Save and Restart Awesome WM: After adding the desired rules, save the file and restart Awesome WM. You can usually do this by pressing Mod4 + Ctrl + r.

Analyzing the Code

The properties floating and above work hand-in-hand in ensuring that your window not only floats but also remains above other windows:

  • floating = true: This makes the window float rather than tile.
  • above = true: This ensures the floating window remains above all other windows, regardless of focus.

Additional Notes

  1. Multiple Applications: You can add multiple rules for different applications by repeating the rule structure for each one. Simply separate them by commas.

  2. Managing Floating Windows: If you find that having too many windows always on top becomes cluttered, you can always toggle their floating status using keyboard shortcuts or the mouse.

  3. Potential Conflicts: Be aware of any other rules that might contradict the above settings. It’s wise to review your entire rules list for any potential overlaps.

Conclusion

With the steps outlined above, you can easily configure Awesome WM to keep your floating windows always on top, allowing for an uninterrupted workflow. This configuration can enhance your productivity by ensuring that you have constant access to essential applications.

Useful Resources

By implementing these configurations and tips, you'll create a more efficient working environment tailored to your needs. Enjoy the power and flexibility of Awesome Window Manager!