[GH-ISSUE #1385] Allow to put lua code in the config file #411

Closed
opened 2026-05-22 21:53:13 +01:00 by JakeStanger · 2 comments
Owner

Originally created by @lypwig on GitHub (Feb 17, 2026).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/1385

For some use cases where a small amount of code is required to do something, it could be convenient to put the code directly in the config file instead of using a dedicated script file:

- type: cairo
  lua: |
    return function(cr, width, height)
      ...
    end
  frequency: 100
  width: 20
  height: 20
Originally created by @lypwig on GitHub (Feb 17, 2026). Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/1385 For some use cases where a small amount of code is required to do something, it could be convenient to put the code directly in the config file instead of using a dedicated script file: ```yml - type: cairo lua: | return function(cr, width, height) ... end frequency: 100 width: 20 height: 20 ```
Author
Owner

@imnotpoz commented on GitHub (Feb 17, 2026):

Another solution if you want that code inlined next to your ironbar config is to use Nix to generate that config. This isn't exclusive to NixOS and there are ways to make it work without rebuilding your entire system (or home-manager) configuration just to get a small change in your config that I won't go into detail here.

For an example, see this part of my ironbar config: git.poz.pet/poz/niksos@683137a/packages/ironbar/config.nix (L122-L139)

Which generates this on my machine:
        {
          "all_monitors": false,
          "favorites": [
            "btop",
            "chat",
            "keepassxc",
            "niksos",
            "pipewire"
          ],
          "name_map": {
            "10": "5",
            "11": "6",
            "12": "7",
            "13": "8",
            "14": "9",
            "15": "10",
            "16": "11",
            "17": "12",
            "18": "13",
            "19": "14",
            "20": "15",
            "21": "16",
            "22": "17",
            "23": "18",
            "24": "19",
            "25": "20",
            "26": "21",
            "27": "22",
            "28": "23",
            "29": "24",
            "30": "25",
            "31": "26",
            "32": "27",
            "33": "28",
            "34": "29",
            "35": "30",
            "6": "1",
            "7": "2",
            "8": "3",
            "9": "4",
            "btop": "",
            "chat": "",
            "keepassxc": "",
            "niksos": "",
            "pipewire": ""
          },
          "sort": "index",
          "type": "workspaces"
        }
<!-- gh-comment-id:3917685520 --> @imnotpoz commented on GitHub (Feb 17, 2026): Another solution if you want that code inlined next to your ironbar config is to use Nix to generate that config. This isn't exclusive to NixOS and there are ways to make it work without rebuilding your entire system (or home-manager) configuration just to get a small change in your config that I won't go into detail here. For an example, see this part of my ironbar config: https://git.poz.pet/poz/niksos/src/commit/683137a/packages/ironbar/config.nix#L122-L139 <details> <summary>Which generates this on my machine:</summary> ```json { "all_monitors": false, "favorites": [ "btop", "chat", "keepassxc", "niksos", "pipewire" ], "name_map": { "10": "5", "11": "6", "12": "7", "13": "8", "14": "9", "15": "10", "16": "11", "17": "12", "18": "13", "19": "14", "20": "15", "21": "16", "22": "17", "23": "18", "24": "19", "25": "20", "26": "21", "27": "22", "28": "23", "29": "24", "30": "25", "31": "26", "32": "27", "33": "28", "34": "29", "35": "30", "6": "1", "7": "2", "8": "3", "9": "4", "btop": "", "chat": "", "keepassxc": "", "niksos": "", "pipewire": "" }, "sort": "index", "type": "workspaces" } ``` </details>
Author
Owner

@lypwig commented on GitHub (Feb 19, 2026):

I think all this stuff represents a considerable amount of work and might be out of scope of this project, sorry for the inconvenience. Feel free to reopen if necessary.

<!-- gh-comment-id:3930385698 --> @lypwig commented on GitHub (Feb 19, 2026): I think all this stuff represents a considerable amount of work and might be out of scope of this project, sorry for the inconvenience. Feel free to reopen if necessary.
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#411
No description provided.