如何访问很棒的嵌套小部件属性

发布于 2025-01-21 18:00:01 字数 581 浏览 0 评论 0 原文

我正在尝试访问以下小部件的属性:

local cpu_widget = wibox.widget{
    {
        max_value = 100,
        paddings = 1,
        border_width = 2,
        widget = wibox.widget.progressbar,
    },
    {
        font = beautiful.font_type .. "8",
        widget = wibox.widget.textbox,
    },
    forced_height = 100,
    forced_width  = 20,
    direction     = 'east',
    layout        = wibox.container.rotate,
}

我已经尝试使用 cpu_widget [1] .Value cpu_widget [2] .Text ,但这没用。

关于我该怎么做的任何想法?

I'm trying to access the properties of the following widget:

local cpu_widget = wibox.widget{
    {
        max_value = 100,
        paddings = 1,
        border_width = 2,
        widget = wibox.widget.progressbar,
    },
    {
        font = beautiful.font_type .. "8",
        widget = wibox.widget.textbox,
    },
    forced_height = 100,
    forced_width  = 20,
    direction     = 'east',
    layout        = wibox.container.rotate,
}

I've tried through the conventional way, using cpu_widget[1].value or cpu_widget[2].text, but that didn't work.

Any thoughts on how I could do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

相思碎 2025-01-28 18:00:02

请参阅(我似乎无法直接链接到本节)

:您可以添加 ID =“ bar” > id =“ text” 到您的小部件,并使用这些标识符再次检索小部件。

如果Elv13看到这个答案:您在文档上做得很好!

See the "Accessing Widgets" on https://awesomewm.org/doc/api/documentation/03-declarative-layout.md.html (I can't seem to link to this section directly)

Basically: You can add id = "bar" and id = "text" to your widgets and use these identifiers to retrieve the widgets again.

In case Elv13 ever sees this answer: You did great work on the docs!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文