1

我想在按下组合键时显示一个很棒的 wibox,例如,我希望这个 wibox 在 3 秒后消失。我不想使用 naughty 或 popup,因为 wibox 里面会有小部件。

我已经有一个解决方案,但我不知道这个解决方案是标准解决方案还是有其他方法可以做到这一点:

function taglist_wibox_show_hide(box)
  local show = timer({ timeout = 0 })
  show:connect_signal("timeout", function ()
                                      print("show")
                                      box.visible=true
                                      show:stop() end)
  show:start()
  local hide = timer({ timeout = 2 })
  hide:connect_signal("timeout", function ()
                                       print("hide")
                                       box.visible=false
                                       hide:stop() end)
  hide:start()
end

然后我添加这个快捷方式:

awful.key({ modkey, "Control" },"y",function() 
                                     taglist_wibox_show_hide(box[mouse.screen])
                                    end),
4

1 回答 1

1

据我所知,没有其他办法。但是我认为你的第一个计时器是没有必要的。

function taglist_wibox_show_hide(box)

  print("show")
  box.visible=true

  local hide = timer({ timeout = 2 })
  hide:connect_signal("timeout", function ()
                                       print("hide")
                                       box.visible=false
                                       hide:stop() end)
  hide:start()
end

应该也能正常工作。

干杯

于 2014-12-30T23:17:33.660 回答