如何在awesome wm中检索当前标签名称?

发布于 2024-12-28 17:40:48 字数 257 浏览 2 评论 0原文

我希望用一个仅显示当前标签名称的简单文本框替换很棒的 WM 中的标签列表。我尝试创建一个包含以下代码的文本框:

mytagbox = widget({ type = "textbox" })
mytagbox.text = awful.tag.selected(s).getproperty("name")

但这不起作用,并且将 Awesome 恢复为其默认配置。我需要输入什么正确的代码才能实现这一点?我也在用 Shifty。谢谢

I am looking to replace the tag list in awesome WM with a simple text box that only displays the name of the current tag. I have tried to create a textbox that contains the following code:

mytagbox = widget({ type = "textbox" })
mytagbox.text = awful.tag.selected(s).getproperty("name")

But this does not work and reverts awesome to its default config. What is the correct code I need to put in to make this possible? I'm also using Shifty. Thanks

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

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

发布评论

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

评论(2

江湖正好 2025-01-04 17:40:48

您已经接近正确的方法:

screen[1]:connect_signal("tag::history::update", function()
       mytagbox.text = awful.tag.selected(1).name
end)

-- Or add_signal on awesome < 3.5

因此 mytagbox.text 将在每次标签切换时发生变化。

You were close to the correct way:

screen[1]:connect_signal("tag::history::update", function()
       mytagbox.text = awful.tag.selected(1).name
end)

-- Or add_signal on awesome < 3.5

So mytagbox.text will be changing on each tags switching.

匿名。 2025-01-04 17:40:48

另一个解决方案是更改标签列表上的过滤功能

mytaglist[s] = awful.widget.taglist(s, function(t, args) return t.selected end, mytaglist.buttons)

Another solution would be to change filter function on taglist

mytaglist[s] = awful.widget.taglist(s, function(t, args) return t.selected end, mytaglist.buttons)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文