[GH-ISSUE #834] keys causing high CPU usage #4477

Closed
opened 2026-05-23 00:53:47 +01:00 by JakeStanger · 2 comments
Owner

Originally created by @JakeStanger on GitHub (Jan 6, 2025).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/834

Describe the bug
No idea what's going on but Ironbar is using 100% of a CPU core for me.

To Reproduce
Unknown

Expected behavior
CPU usage should be near 0

System information:

  • Distro: Arch Linux
  • Compositor: Hyprland
  • Ironbar version: 0b4d868

Configuration

Config
let {
    $config_dir = "/home/jake/.config/ironbar"

    $workspaces = {
        type = "workspaces"
        all_monitors = false
        sort = "name"
        name_map = {
            1 = "󰙯"
            2 = ""
            3 = ""
            4 = ""
            5 = ""
            Games = ""
            Code = ""
        }
    }

    $launcher = {
        // reversed = true
        type = "launcher"
        favorites = [ "firefox" "discord" "steam" ]
        show_names = false
        show_icons = true
    }

    $mpd_local = { type = "music" name = "music-localhost" player_type = "mpd" music_dir = "/home/jake/Music" }
    $mpd_server = { type = "music" name = "music-chloe" player_type = "mpd" host = "chloe:6600" }

    $sys_info = {
        type = "sys_info"
        format = ["{cpu_percent}% " "{memory_percent}% "]
        interval.cpu = 1
    }

    $tray = { type = "tray" }
    $clock = { type = "clock" }

    $phone_battery = {
        type = "script"
        cmd = "/home/jake/bin/phone-battery"
    }

    $clipboard = { type = "clipboard" max_items = 5 truncate.mode = "end" truncate.length = 30 }

    $focused = { type = "focused" truncate.mode = "middle" truncate.max_length = 60 }

    $power_menu = {
        type = "custom"
        class = "power-menu"

        bar = [ { type = "button" name="power-btn" label = "" on_click = "popup:toggle" } ]

        popup = [ {
            type = "box"
            orientation = "vertical"
            widgets = [
                { type = "label" name = "header" label = "Power menu" }
                {
                    type = "box"
                    name = "buttons"
                    widgets = [
                        { type = "button" class="power-btn" label = "<span font-size='20pt'></span>" on_click = "!shutdown now" }
                        { type = "button" class="power-btn" label = "<span font-size='20pt'></span>" on_click = "!reboot" }
                    ]
                }
            ]
        } ]
    }

    $cairo = { type = "cairo" path = "$config_dir/clock.lua" frequency = 50 width = 300 height = 300 }

    $volume = { type = "volume" }
    $notifications = { type = "notifications" }

    $keys = { type = "keys" show_scroll = false }

    $weather = { 
        type = "custom"
        class = "weather"

        bar = [ { type = "button" label = "#weather_current" on_click = "popup:toggle" } ]
        popup = [ {
            type = "box"
            orientation = "vertical"

            widgets = [
                { type = "label" name = "header" label = "Forecast" }
                { 
                    type = "box"
                    widgets = [
                        { type = "box" name="dates" orientation = "vertical" widgets = [
                            { type = "label" class="weather-date" label = "#weather_date_0" }
                            { type = "label" class="weather-date" label = "#weather_date_1" }
                            { type = "label" class="weather-date" label = "#weather_date_2" }
                        ]}
                        { type = "box" name="temps" orientation = "vertical" widgets = [
                            { 
                              type = "box"
                              widgets = [
                                  { type = "label" class="weather-high" label = " #weather_high_0" }
                                  { type = "label" class="weather-avg" label = " #weather_avg_0" }
                                  { type = "label" class="weather-low" label = " #weather_low_0" }
                              ] 
                          }
                          { 
                              type = "box"
                              widgets = [
                                  { type = "label" class="weather-high" label = " #weather_high_1" }
                                  { type = "label" class="weather-avg" label = " #weather_avg_1" }
                                  { type = "label" class="weather-low" label = " #weather_low_1" }
                              ] 
                          }
                          { 
                              type = "box"
                              widgets = [
                                  { type = "label" class="weather-high" label = " #weather_high_2" }
                                  { type = "label" class="weather-avg" label = " #weather_avg_2" }
                                  { type = "label" class="weather-low" label = " #weather_low_2" }
                              ] 
                          }

                        ] }
                    ]
                }
            ]
        } ]
    }

    $start = [ 
        $workspaces 
        $launcher 
    ]
    // $center = [ $cairo  ]
    $center = [ $keys ] 
    $end = [ 
        $mpd_local 
        // { type = "label" label ="" class="pl-arrow" }
        // $mpd_server 
        // $phone_battery 
        // $keys
        $weather
        $sys_info 
        $clipboard 
        $volume
        $power_menu
	    $tray
        $clock
        $notifications
    ]

    $base = {
        start = $start
        center = $center
        end = $end
        icon_theme = "Paper"
        position = "bottom" 
    }
} in {
    monitors = {
        DP-1 = { name = "DP-1" ..$base }
        DP-2 = { name = "DP-2" ..$base }
        DP-3 = { name = "DP-3" ..$base } 
    }
}

Styles
/* @define-color color_bg #2d2d2d; */
@define-color color_bg rgba(38, 38, 38, 0.6);
@define-color color_bg_dark #1c1c1c;
@define-color color_border #424242;
@define-color color_border_active #6699cc;
@define-color color_text #ffffff;
@define-color color_urgent #8f0a0a;

@keyframes gradient {
    0% {
        background-position: 50% 0%;
    }
    50% {
        background-position: 50% 100%;
    }
    100% {
        background-position: 50% 0%;
    }
}

/* -- base styles -- */

window {
    background: rgba(38, 38, 38, 0.6);
}

#bar, menubar { 
    /* background-color: @color_bg;  */
    background:  linear-gradient(90deg, rgba(102,153,204,0.1) 35%, rgba(204,153,204,0.1) 100%);
    background-size: 200% 100%;
    background-blend-mode: multiply;
    /* animation-name: gradient; */
    /* animation-duration: 30s; */
    /* animation-timing-function: ease; */
    /* animation-iteration-count: infinite; */
}

box, button, label {
    background-color: rgba(0, 0, 0, 0);
}

* {
    font-family: Noto Sans Nerd Font, sans-serif;
    font-size: 16px;
    border: none;
    border-radius: 0;
}

button, label {
    color: @color_text;
}

button:hover {
    background-color: @color_bg_dark;
}

menuitem:not(.item) {
    background-color: @color_bg_dark;
}

menuitem:hover {
    background-color: @color_bg;
}

scale.horizontal highlight {
    background: linear-gradient(90deg, rgba(102,153,204,1) 35%, rgba(204,153,204,1) 100%);
}

scale.vertical highlight {
    background: linear-gradient(0, rgba(102,153,204,1) 35%, rgba(204,153,204,1) 100%);
}

#bar {
    border-top: 1px solid @color_border;
}

.popup {
    border: 1px solid @color_border;
    padding: 1em;
}

.popup box, calendar {
    background-color: rgba(0, 0, 0, 0);
}


/* -- clipboard -- */

.clipboard {
    margin-left: 5px;
    font-size: 1.1em;
}

.popup-clipboard .item {
    padding-bottom: 0.3em;
    border-bottom: 1px solid @color_border;
}


/* -- clock -- */

.clock {
    font-weight: bold;
    margin-left: 5px;
}

.popup-clock .calendar-clock {
    color: @color_text;
    font-size: 2.5em;
    padding-bottom: 0.1em;
}

.popup-clock .calendar {
    /* background-color: @color_bg; */
    color: @color_text;
}

.popup-clock .calendar .header {
    padding-top: 1em;
    border-top: 1px solid @color_border;
    font-size: 1.5em;
}

.popup-clock .calendar:selected {
    background-color: @color_border_active;
}


/** -- keys -- */

/* .keys .key.enabled { */
/*     margin-left: 10px; */
/*     margin-right: 10px; */
/* } */

/* .keys { */
/*     margin-right: 10px; */
/* } */

/* redefine as wildcard font size overwrites */
/* .keys .key:not(.enabled) .icon { */
/*     font-size: 0; */
/* } */


/* -- launcher -- */

.launcher .item {
    margin-right: 4px;
}

.launcher .item:not(.focused):hover, .launcher .item:not(.focused):hover * {
    background-color: @color_bg_dark;
}

.launcher .open {
    border-bottom: 1px solid @color_text;
}

.launcher .focused {
    border-bottom: 1px solid @color_border_active;
}

.launcher .urgent {
    border-bottom-color: @color_urgent;
}

.popup-launcher {
    padding: 0;
}

.popup-launcher .popup-item:not(:first-child) {
    border-top: 1px solid @color_border;
}


/* -- music -- */

 .music:hover * {
    background-color: @color_bg_dark;
}

.popup-music .album-art {
    margin-right: 1em;
}

.popup-music .icon-box {
    margin-right: 0.4em;
}

.popup-music .title .icon, .popup-music .title .label {
    font-size: 1.7em;
}

.popup-music .controls *:disabled {
    color: @color_border;
}

.popup-music .volume {
    margin-left: 1em;
}

.popup-music .volume .slider slider {
    border-radius: 100%;
}

/* volume icon */
.popup-music .volume .icon {
    margin-left: 4px;
}

.popup-music .progress .slider slider {
    border-radius: 100%;
}

/* -- network_manager -- */

.network_manager * {
    color: white;
    background-color: white;
}

/* notifications */

.notifications .count {
    font-size: 0.6rem;
    background-color: @color_text;
    color: @color_bg;
    border-radius: 100%;
    margin-right: 3px;
    margin-top: 3px;
    padding-left: 4px;
    padding-right: 4px;
    opacity: 0.7;
}

/* -- script -- */

.script {
    padding-left: 10px;
}


/* -- sys_info -- */

.sysinfo {
    margin-left: 10px;
}

.sysinfo .item {
    margin-left: 5px;
}


/* -- tray -- */

.tray {
    margin-left: 10px;
    margin-right: 10px;
    /* background-color: red; */
}

.tray .item {
    background-color: rgba(0, 0, 0, 0);
    padding: 1px;
    /* background-color: red; */
    /* border: 1px solid blue; */
}

menu {
    background-color: @color_bg_dark;
}

separator {
    outline: none;
    margin: 0;
    /* padding-top: 2px; */
    margin-top: 2px;
    color: @color_border;
    background-color: @color_border;
}

/* -- volume -- */

.popup-volume .device-box {
    border-right: 1px solid @color_border;
}


/* -- workspaces -- */

.workspaces {
    margin-right: 10px;
}

.workspaces .item.visible {
    box-shadow: inset 0 -1px @color_text;
}

.workspaces .item.focused {
    box-shadow: inset 0 -1px @color_border_active;
    background-color: @color_bg_dark;
}

.workspaces .item:hover {
    box-shadow: inset 0 -3px;
}

.workspaces .item.urgent {
    background-color: @color_urgent;
}


/* -- custom: power menu -- */

.popup-power-menu #header {
    font-size: 1.4em;
    padding-bottom: 0.4em;
    margin-bottom: 0.6em;
    border-bottom: 1px solid @color_border;
}

.popup-power-menu .power-btn {
    border: 1px solid @color_border;
    padding: 0.6em 1em;
}

.popup-power-menu #buttons > *:nth-child(1) .power-btn {
    margin-right: 1em;
}

/** custom: weather -- */


.popup-weather #header {
    font-size: 1.8em;
    padding-bottom: 0.4em;
    margin-bottom: 0.6em;
    border-bottom: 1px solid @color-border;
} 

.popup-weather .weather-date {
    font-size: 1.5em;
    padding-right: 1em;
}

.popup-weather .weather-avg {
    margin-left: 0.5em;
    margin-right: 0.5em;
}

.popup-weather #temps label {
    padding-top: 0.2em;
    margin-bottom: 0.7em;
}
Originally created by @JakeStanger on GitHub (Jan 6, 2025). Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/834 **Describe the bug** No idea what's going on but Ironbar is using 100% of a CPU core for me. **To Reproduce** Unknown **Expected behavior** CPU usage should be near 0 **System information:** - Distro: Arch Linux - Compositor: Hyprland - Ironbar version: [0b4d868](https://github.com/JakeStanger/ironbar/commit/0b4d868134631b1029ba06280a237bb0995de585) **Configuration** <details><summary>Config</summary> ```corn let { $config_dir = "/home/jake/.config/ironbar" $workspaces = { type = "workspaces" all_monitors = false sort = "name" name_map = { 1 = "󰙯" 2 = "" 3 = "" 4 = "" 5 = "" Games = "" Code = "" } } $launcher = { // reversed = true type = "launcher" favorites = [ "firefox" "discord" "steam" ] show_names = false show_icons = true } $mpd_local = { type = "music" name = "music-localhost" player_type = "mpd" music_dir = "/home/jake/Music" } $mpd_server = { type = "music" name = "music-chloe" player_type = "mpd" host = "chloe:6600" } $sys_info = { type = "sys_info" format = ["{cpu_percent}% " "{memory_percent}% "] interval.cpu = 1 } $tray = { type = "tray" } $clock = { type = "clock" } $phone_battery = { type = "script" cmd = "/home/jake/bin/phone-battery" } $clipboard = { type = "clipboard" max_items = 5 truncate.mode = "end" truncate.length = 30 } $focused = { type = "focused" truncate.mode = "middle" truncate.max_length = 60 } $power_menu = { type = "custom" class = "power-menu" bar = [ { type = "button" name="power-btn" label = "" on_click = "popup:toggle" } ] popup = [ { type = "box" orientation = "vertical" widgets = [ { type = "label" name = "header" label = "Power menu" } { type = "box" name = "buttons" widgets = [ { type = "button" class="power-btn" label = "<span font-size='20pt'></span>" on_click = "!shutdown now" } { type = "button" class="power-btn" label = "<span font-size='20pt'></span>" on_click = "!reboot" } ] } ] } ] } $cairo = { type = "cairo" path = "$config_dir/clock.lua" frequency = 50 width = 300 height = 300 } $volume = { type = "volume" } $notifications = { type = "notifications" } $keys = { type = "keys" show_scroll = false } $weather = { type = "custom" class = "weather" bar = [ { type = "button" label = "#weather_current" on_click = "popup:toggle" } ] popup = [ { type = "box" orientation = "vertical" widgets = [ { type = "label" name = "header" label = "Forecast" } { type = "box" widgets = [ { type = "box" name="dates" orientation = "vertical" widgets = [ { type = "label" class="weather-date" label = "#weather_date_0" } { type = "label" class="weather-date" label = "#weather_date_1" } { type = "label" class="weather-date" label = "#weather_date_2" } ]} { type = "box" name="temps" orientation = "vertical" widgets = [ { type = "box" widgets = [ { type = "label" class="weather-high" label = " #weather_high_0" } { type = "label" class="weather-avg" label = " #weather_avg_0" } { type = "label" class="weather-low" label = " #weather_low_0" } ] } { type = "box" widgets = [ { type = "label" class="weather-high" label = " #weather_high_1" } { type = "label" class="weather-avg" label = " #weather_avg_1" } { type = "label" class="weather-low" label = " #weather_low_1" } ] } { type = "box" widgets = [ { type = "label" class="weather-high" label = " #weather_high_2" } { type = "label" class="weather-avg" label = " #weather_avg_2" } { type = "label" class="weather-low" label = " #weather_low_2" } ] } ] } ] } ] } ] } $start = [ $workspaces $launcher ] // $center = [ $cairo ] $center = [ $keys ] $end = [ $mpd_local // { type = "label" label ="" class="pl-arrow" } // $mpd_server // $phone_battery // $keys $weather $sys_info $clipboard $volume $power_menu $tray $clock $notifications ] $base = { start = $start center = $center end = $end icon_theme = "Paper" position = "bottom" } } in { monitors = { DP-1 = { name = "DP-1" ..$base } DP-2 = { name = "DP-2" ..$base } DP-3 = { name = "DP-3" ..$base } } } ``` </details> <details><summary>Styles</summary> ```css /* @define-color color_bg #2d2d2d; */ @define-color color_bg rgba(38, 38, 38, 0.6); @define-color color_bg_dark #1c1c1c; @define-color color_border #424242; @define-color color_border_active #6699cc; @define-color color_text #ffffff; @define-color color_urgent #8f0a0a; @keyframes gradient { 0% { background-position: 50% 0%; } 50% { background-position: 50% 100%; } 100% { background-position: 50% 0%; } } /* -- base styles -- */ window { background: rgba(38, 38, 38, 0.6); } #bar, menubar { /* background-color: @color_bg; */ background: linear-gradient(90deg, rgba(102,153,204,0.1) 35%, rgba(204,153,204,0.1) 100%); background-size: 200% 100%; background-blend-mode: multiply; /* animation-name: gradient; */ /* animation-duration: 30s; */ /* animation-timing-function: ease; */ /* animation-iteration-count: infinite; */ } box, button, label { background-color: rgba(0, 0, 0, 0); } * { font-family: Noto Sans Nerd Font, sans-serif; font-size: 16px; border: none; border-radius: 0; } button, label { color: @color_text; } button:hover { background-color: @color_bg_dark; } menuitem:not(.item) { background-color: @color_bg_dark; } menuitem:hover { background-color: @color_bg; } scale.horizontal highlight { background: linear-gradient(90deg, rgba(102,153,204,1) 35%, rgba(204,153,204,1) 100%); } scale.vertical highlight { background: linear-gradient(0, rgba(102,153,204,1) 35%, rgba(204,153,204,1) 100%); } #bar { border-top: 1px solid @color_border; } .popup { border: 1px solid @color_border; padding: 1em; } .popup box, calendar { background-color: rgba(0, 0, 0, 0); } /* -- clipboard -- */ .clipboard { margin-left: 5px; font-size: 1.1em; } .popup-clipboard .item { padding-bottom: 0.3em; border-bottom: 1px solid @color_border; } /* -- clock -- */ .clock { font-weight: bold; margin-left: 5px; } .popup-clock .calendar-clock { color: @color_text; font-size: 2.5em; padding-bottom: 0.1em; } .popup-clock .calendar { /* background-color: @color_bg; */ color: @color_text; } .popup-clock .calendar .header { padding-top: 1em; border-top: 1px solid @color_border; font-size: 1.5em; } .popup-clock .calendar:selected { background-color: @color_border_active; } /** -- keys -- */ /* .keys .key.enabled { */ /* margin-left: 10px; */ /* margin-right: 10px; */ /* } */ /* .keys { */ /* margin-right: 10px; */ /* } */ /* redefine as wildcard font size overwrites */ /* .keys .key:not(.enabled) .icon { */ /* font-size: 0; */ /* } */ /* -- launcher -- */ .launcher .item { margin-right: 4px; } .launcher .item:not(.focused):hover, .launcher .item:not(.focused):hover * { background-color: @color_bg_dark; } .launcher .open { border-bottom: 1px solid @color_text; } .launcher .focused { border-bottom: 1px solid @color_border_active; } .launcher .urgent { border-bottom-color: @color_urgent; } .popup-launcher { padding: 0; } .popup-launcher .popup-item:not(:first-child) { border-top: 1px solid @color_border; } /* -- music -- */ .music:hover * { background-color: @color_bg_dark; } .popup-music .album-art { margin-right: 1em; } .popup-music .icon-box { margin-right: 0.4em; } .popup-music .title .icon, .popup-music .title .label { font-size: 1.7em; } .popup-music .controls *:disabled { color: @color_border; } .popup-music .volume { margin-left: 1em; } .popup-music .volume .slider slider { border-radius: 100%; } /* volume icon */ .popup-music .volume .icon { margin-left: 4px; } .popup-music .progress .slider slider { border-radius: 100%; } /* -- network_manager -- */ .network_manager * { color: white; background-color: white; } /* notifications */ .notifications .count { font-size: 0.6rem; background-color: @color_text; color: @color_bg; border-radius: 100%; margin-right: 3px; margin-top: 3px; padding-left: 4px; padding-right: 4px; opacity: 0.7; } /* -- script -- */ .script { padding-left: 10px; } /* -- sys_info -- */ .sysinfo { margin-left: 10px; } .sysinfo .item { margin-left: 5px; } /* -- tray -- */ .tray { margin-left: 10px; margin-right: 10px; /* background-color: red; */ } .tray .item { background-color: rgba(0, 0, 0, 0); padding: 1px; /* background-color: red; */ /* border: 1px solid blue; */ } menu { background-color: @color_bg_dark; } separator { outline: none; margin: 0; /* padding-top: 2px; */ margin-top: 2px; color: @color_border; background-color: @color_border; } /* -- volume -- */ .popup-volume .device-box { border-right: 1px solid @color_border; } /* -- workspaces -- */ .workspaces { margin-right: 10px; } .workspaces .item.visible { box-shadow: inset 0 -1px @color_text; } .workspaces .item.focused { box-shadow: inset 0 -1px @color_border_active; background-color: @color_bg_dark; } .workspaces .item:hover { box-shadow: inset 0 -3px; } .workspaces .item.urgent { background-color: @color_urgent; } /* -- custom: power menu -- */ .popup-power-menu #header { font-size: 1.4em; padding-bottom: 0.4em; margin-bottom: 0.6em; border-bottom: 1px solid @color_border; } .popup-power-menu .power-btn { border: 1px solid @color_border; padding: 0.6em 1em; } .popup-power-menu #buttons > *:nth-child(1) .power-btn { margin-right: 1em; } /** custom: weather -- */ .popup-weather #header { font-size: 1.8em; padding-bottom: 0.4em; margin-bottom: 0.6em; border-bottom: 1px solid @color-border; } .popup-weather .weather-date { font-size: 1.5em; padding-right: 1em; } .popup-weather .weather-avg { margin-left: 0.5em; margin-right: 0.5em; } .popup-weather #temps label { padding-top: 0.2em; margin-bottom: 0.7em; } ``` </details>
JakeStanger 2026-05-23 00:53:47 +01:00
  • closed this issue
  • added the
    T:Bug
    label
Author
Owner

@JakeStanger commented on GitHub (Jan 6, 2025):

Looks like this is caused by the new keys module

<!-- gh-comment-id:2574009821 --> @JakeStanger commented on GitHub (Jan 6, 2025): Looks like this is caused by the new `keys` module
Author
Owner

@JakeStanger commented on GitHub (Jan 6, 2025):

Bit of a bodge fix but that mostly sorts it, I'm looking at potentially moving to a more efficient crate to further improve performance

<!-- gh-comment-id:2574028147 --> @JakeStanger commented on GitHub (Jan 6, 2025): Bit of a bodge fix but that mostly sorts it, I'm looking at potentially moving to a more efficient crate to further improve performance
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#4477
No description provided.