[PR #1353] [MERGED] feat(bar): auto select/hide widget based on value #1344

Closed
opened 2026-01-05 14:54:57 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/LGUG2Z/komorebi/pull/1353
Author: @CtByte
Created: 3/16/2025
Status: Merged
Merged: 4/3/2025
Merged by: @LGUG2Z

Base: masterHead: widget_auto_select


📝 Commits (1)

  • 9037fcb feat(bar): auto select/hide widget based on value

📊 Changes

11 files changed (+914 additions, -241 deletions)

View changed files

📝 komorebi-bar/src/bar.rs (+91 -56)
📝 komorebi-bar/src/config.rs (+12 -0)
📝 komorebi-bar/src/main.rs (+4 -0)
📝 komorebi-bar/src/render.rs (+15 -0)
📝 komorebi-bar/src/selected_frame.rs (+27 -4)
📝 komorebi-bar/src/widgets/battery.rs (+39 -18)
📝 komorebi-bar/src/widgets/cpu.rs (+29 -10)
📝 komorebi-bar/src/widgets/memory.rs (+31 -11)
📝 komorebi-bar/src/widgets/network.rs (+252 -88)
📝 komorebi-bar/src/widgets/storage.rs (+49 -15)
📝 schema.bar.json (+365 -39)

📄 Description

This commit adds new settings to some widgets that allows to auto select/hide them based on their current values.

The cpu/memory/network/storage widgets get a setting that auto selects the widget if the current value/percentage is over a value.

The battery widget gets a setting that auto selects the widget if the current percentage is under a value.

The storage widget gets a setting that auto hides the disk widget if the percentage is under a value.

    {
      "Memory": {
        "enable": true,
        "data_refresh_interval": 5,
        "label_prefix": "Icon",
        "auto_select_over": 40
      }
    },
    {
      "Battery": {
        "enable": true,
        "hide_on_full_charge": true,
        "auto_select_under": 15
      }
    },
    {
      "Storage": {
        "enable": true,
        "auto_select_over": 95,
        "auto_hide_under": 90
      }
    },

https://github.com/user-attachments/assets/546fdd10-dbc8-464c-8fcb-813dc46c1dc7

Also added 2 new settings (auto_select_fill and auto_select_text) to the theme, in order to select the fill and
text colors of an auto selected widget.


Screenshot 2025-03-18 224417

  "theme": {
    "palette": "Base16",
    "name": "AyuMirage",
    "accent": "Base09",
    "auto_select_fill": "Base03",
    "auto_select_text": "Base09"
  },

image

  "theme": {
    "palette": "Base16",
    "name": "Ashes",
    "accent": "Base0D",
    "auto_select_fill": "Base05",
    "auto_select_text": "Base02"
  },

image

  "theme": {
    "palette": "Catppuccin",
    "name": "Latte",
    "accent": "Blue",
    "auto_select_fill": "Blue",
    "auto_select_text": "Crust"
  },

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/LGUG2Z/komorebi/pull/1353 **Author:** [@CtByte](https://github.com/CtByte) **Created:** 3/16/2025 **Status:** ✅ Merged **Merged:** 4/3/2025 **Merged by:** [@LGUG2Z](https://github.com/LGUG2Z) **Base:** `master` ← **Head:** `widget_auto_select` --- ### 📝 Commits (1) - [`9037fcb`](https://github.com/LGUG2Z/komorebi/commit/9037fcb95e3adbed71955ec91ca3452dc65009b3) feat(bar): auto select/hide widget based on value ### 📊 Changes **11 files changed** (+914 additions, -241 deletions) <details> <summary>View changed files</summary> 📝 `komorebi-bar/src/bar.rs` (+91 -56) 📝 `komorebi-bar/src/config.rs` (+12 -0) 📝 `komorebi-bar/src/main.rs` (+4 -0) 📝 `komorebi-bar/src/render.rs` (+15 -0) 📝 `komorebi-bar/src/selected_frame.rs` (+27 -4) 📝 `komorebi-bar/src/widgets/battery.rs` (+39 -18) 📝 `komorebi-bar/src/widgets/cpu.rs` (+29 -10) 📝 `komorebi-bar/src/widgets/memory.rs` (+31 -11) 📝 `komorebi-bar/src/widgets/network.rs` (+252 -88) 📝 `komorebi-bar/src/widgets/storage.rs` (+49 -15) 📝 `schema.bar.json` (+365 -39) </details> ### 📄 Description This commit adds new settings to some widgets that allows to auto select/hide them based on their current values. The cpu/memory/network/storage widgets get a setting that auto selects the widget if the current value/percentage is over a value. The battery widget gets a setting that auto selects the widget if the current percentage is under a value. The storage widget gets a setting that auto hides the disk widget if the percentage is under a value. ```json { "Memory": { "enable": true, "data_refresh_interval": 5, "label_prefix": "Icon", "auto_select_over": 40 } }, { "Battery": { "enable": true, "hide_on_full_charge": true, "auto_select_under": 15 } }, { "Storage": { "enable": true, "auto_select_over": 95, "auto_hide_under": 90 } }, ``` https://github.com/user-attachments/assets/546fdd10-dbc8-464c-8fcb-813dc46c1dc7 Also added 2 new settings (auto_select_fill and auto_select_text) to the theme, in order to select the fill and text colors of an auto selected widget. --- ![Screenshot 2025-03-18 224417](https://github.com/user-attachments/assets/bd95dcf1-f0ac-46e3-9dd8-3c29fb2b256a) ```json "theme": { "palette": "Base16", "name": "AyuMirage", "accent": "Base09", "auto_select_fill": "Base03", "auto_select_text": "Base09" }, ``` --- ![image](https://github.com/user-attachments/assets/6f267c60-0c84-49cb-907f-6c1817269a25) ```json "theme": { "palette": "Base16", "name": "Ashes", "accent": "Base0D", "auto_select_fill": "Base05", "auto_select_text": "Base02" }, ``` --- ![image](https://github.com/user-attachments/assets/e49e2b34-5ad2-47e9-bb3a-4676a2924ef4) ```json "theme": { "palette": "Catppuccin", "name": "Latte", "accent": "Blue", "auto_select_fill": "Blue", "auto_select_text": "Crust" }, ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-01-05 14:54:57 +01:00
adam closed this issue 2026-01-05 14:54:58 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#1344