Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      June 2, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      June 2, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      June 2, 2025

      How To Prevent WordPress SQL Injection Attacks

      June 2, 2025

      The Alters: Release date, mechanics, and everything else you need to know

      June 2, 2025

      I’ve fallen hard for Starsand Island, a promising anime-style life sim bringing Ghibli vibes to Xbox and PC later this year

      June 2, 2025

      This new official Xbox 4TB storage card costs almost as much as the Xbox SeriesXitself

      June 2, 2025

      I may have found the ultimate monitor for conferencing and productivity, but it has a few weaknesses

      June 2, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      May report 2025

      June 2, 2025
      Recent

      May report 2025

      June 2, 2025

      Write more reliable JavaScript with optional chaining

      June 2, 2025

      Deploying a Scalable Next.js App on Vercel – A Step-by-Step Guide

      June 2, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      The Alters: Release date, mechanics, and everything else you need to know

      June 2, 2025
      Recent

      The Alters: Release date, mechanics, and everything else you need to know

      June 2, 2025

      I’ve fallen hard for Starsand Island, a promising anime-style life sim bringing Ghibli vibes to Xbox and PC later this year

      June 2, 2025

      This new official Xbox 4TB storage card costs almost as much as the Xbox SeriesXitself

      June 2, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Operating Systems»Linux»Adding Grouped Items in Waybar

    Adding Grouped Items in Waybar

    January 16, 2025

    Adding Grouped Items in Waybar

    Waybar is the perfect top panel program for Wayland systems like Hyprland, Sway, etc.

    It offers many built-in modules and also allows the user to create custom modules to fill the panel.

    We have already discussed how to configure Waybar in a previous tutorial.

    📋
    I recommend you to go through the article first. It should make things easy to understand as you read on.

    In this article, let’s learn some eye-candy tricks to make your Hyprland user experience even better.



    0:00
    /0:11



    Hardware Groups with Waybar with group module.

    Grouping modules in Waybar

    Those who went through the wiki pages of Waybar, may have seen a module called group. Unlike other modules (memory, cpu, etc.), this group module allows you to embed more pre-built modules inside it.

    This is shown in the above video.

    So, what we are doing here is grouping related (or even unrelated, as you like) modules inside a group.

    Writing a sample group module

    Usually, all modules should be defined and then called in the top bar on respective places as you require.

    This is applicable to the group as well. Let’s make one:

    Step 1: Start with framework

    First, define the group with a name and the structure:

    "group/<groupname>": {
    	----,
    	----
    }
    

    The group module definition should be wrapped between the parentheses.

    For example, I am creating a group called hardware to place CPU, RAM (memory), and Temperature modules.

    🚧
    The modules like cpu, memory, etc., that we need to add to a group should be defined separately outside the group definition. These definitions are explained in the Waybar article.

    So, I will start the group definition at the end of my ~/.config/waybar/config.jsonc file:

    "group/hardware": {
    	----,
    	----
    }
    
    🚧
    In the JSONC files, never forget to add a comma to the end of previous module (},), if it is not the last item.

    Step 2: Add an orientation

    You already know that Waybar allows you to place the bar on the top, bottom, left, or right of the screen. This means, you can place your bar either vertically (left/right) or horizontally (top/bottom).

    Therefore, you may need to specify an orientation for the group items using the key orientation.

    "group/hardware": {
    	"oreintation": "horizontal",
    }
    

    I am using a bar configured to appear at the top of the screen. Therefore, I chose “horizontal” orientation. The value for orientation can be horizontal, vertical, orthogonal, or inherit.

    Step 3: Add a drawer effect

    With orientation set, let’s make the groups a bit neat by hiding all items except one.

    The interesting part is, when you hover over this unhidden item, the rest of the modules inside the group will come out with a nice effect. It is like collapsing the items at once under one of the items, and then expanding.

    The keyword we use in the configuration here is “drawer”.

    "group/hardware": {
    	"oreintation": "horizontal",
    	"drawer": {
    		---
    	},
    }
    

    Inside the drawer, we can set the transition duration, motion, etc. Let’s go minimal, with only setting the transition duration and transition motion.

    "group/hardware": {
    	"oreintation": "horizontal"
    	"drawer": {
    		"transition-duration": 500,
    		"transition-left-to-right": false
    	},
    }
    

    If we set the transition-left-to-right key to false, the first item in the list of modules (that we will add in the next section) will stay there, and the rest is expanded.

    Likewise, if left to default (true), the first item and the rest will all draw out.

    Step 4: Add the modules

    It’s time to add the modules that we want to appear inside the group.

    "group/hardware": {
    	"oreintation": "horizontal",
    	"drawer": {
    		"transition-duration": 500,
    		"transition-left-to-right": false
    	},
    	"modules": [
    		"custom/hardware-wrap",
    		"cpu",
    		"memory"
    		"temperature"
    	]
    }
    

    Here, in the above snippet, we have created four modules to appear inside the group hardware.

    📋
    The first item inside the module key will be the one visible. The subsequent items will be hidden and will only appear when hovered over the first item.

    As said earlier, we need to define all the modules appearing inside the group as regular Waybar modules.

    Here, we will define a custom module called custom/hardware-wrap, just to hold a place for the Hardware section.

    So, outside the group module definition parenthesis, use the following code:

    "custom/hardware-wrap": {
    	"format": Hardware
    	"tooltip-format": "Hardware group"
    } 
    

    So, when “custom/hardware-wrap” is placed inside the group module as the first item, only that will be visible, hiding the rest (cpu, memory, and temperature in this case.).

    Step 5: Simple CSS for the custom module

    Let’s add a CSS for the custom module that we have added. Go inside the ~/.conf/waybar/style.css file and add the lines:

    #custom-hardware-wrap {
         box-shadow: none;
         background: #202131;
             text-shadow: none;
         padding: 0px;
         border-radius: 5px;
         margin-top: 3px;
         margin-bottom: 3px;
         margin-right: 6px;
         margin-left: 6px;
         padding-right: 4px;
         padding-left: 4px;
         color: #98C379;
    }
    

    Step 6: Add it to the panel

    Now that we have designed and styled the group, let’s add it to the panel.

    We know that in Waybar, we have modules-left, modules-center, and modules-right to align elements in the panel.

    Let’s place the new Hardware group to the right side of the panel.

    "modules-right": ["group/hardware", "pulseaudio", "tray"],
    

    In the above code inside the ~/.config/waybar/config.jsonc, you can see that, I have placed the group/hardware on the right along with PulseAudio and system tray.

    Adding Grouped Items in Waybar
    Hardware Group Collapsed
    Adding Grouped Items in Waybar
    Hardware Group Expanded

    Wrapping Up

    Grouping items is a handy trick, since it can create some space to place other items and make the top bar organized.

    If you are curious, you can take a look at the drawer snippet given in the group page of Waybar wiki. You can explore some more customizations like adding a power menu button.

    Source: Read More

    Facebook Twitter Reddit Email Copy Link
    Previous ArticlePlayStation just reportedly canceled two live service games that likely would’ve launched on Windows PC
    Next Article Error’d: Secret Horror

    Related Posts

    News & Updates

    The Alters: Release date, mechanics, and everything else you need to know

    June 2, 2025
    News & Updates

    I’ve fallen hard for Starsand Island, a promising anime-style life sim bringing Ghibli vibes to Xbox and PC later this year

    June 2, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    CVE-2025-2767 – Arista NG Firewall User-Agent Cross-Site Scripting Remote Code Execution

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-5365 – Campcodes Online Hospital Management System SQL Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Docker Malware Exploits Teneo Web3 Node to Earn Crypto via Fake Heartbeat Signals

    Development

    Amazon Q Developer gets new agentic coding experience in Visual Studio Code

    Tech & Work

    Highlights

    Development

    [Podcast] What If Intuition Built Your Website? An Interview With Neelima Sharma

    June 19, 2024

    In this episode of “What If? So What?” Jim talks with Neelima Sharma, SVP of…

    CVE-2025-0639 – GitLab CE/EE Service Availability Denial of Service

    April 24, 2025

    CVE-2025-3855 – CodeCanyon RISE Ultimate Project Manager File Inclusion Vulnerability

    April 21, 2025

    Choosing the Right React Native App Development Company: A Smart Business Guide📱

    April 14, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.