Last active
September 17, 2022 15:47
-
-
Save adamnejm/8633201ac6b9d47cdcd802d6a28a850d to your computer and use it in GitHub Desktop.
[AwesomeWM] Tasklist tooltip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local gui = require "gui" | |
local bind = require "bind" | |
local agent = require "agent" | |
local theme = require "theme" | |
local awful = require "awful" | |
------------------------------------------- | |
local tooltip = awful.tooltip({ | |
opacity = 0.8, | |
delay_show = 0.2, | |
}) | |
local layout = { | |
widget = gui.box, | |
theme = theme.tasklist, | |
} | |
local cell = { | |
widget = gui.icon, | |
theme = theme.tasklist.cell, | |
binds = bind { | |
{ | |
combo = "Any + MouseLeft", | |
press = function(self) | |
self.client:activate { context = "tasklist", action = "toggle_minimization" } | |
end | |
},{ | |
combo = "Any + MouseMiddle", | |
press = function(self) | |
agent.kill(self.client) | |
end | |
} | |
}, | |
{ | |
widget = gui.icon, | |
theme = theme.tasklist.cell.icon | |
}, | |
{ | |
widget = gui.text, | |
theme = theme.tasklist.cell.text | |
}, | |
} | |
function cell:create_callback(c, index, clients) | |
self.children[1].image = c.theme_icon | |
self.client = c | |
tooltip:add_to_object(self) | |
self:connect_signal("mouse::enter", function() | |
tooltip.text = c.name or "Unknown" | |
end) | |
self:update_callback(c, index, clients) | |
end | |
function cell:update_callback(c, index, clients) | |
local children = self.children | |
self:send_request(children[1], children[2], c, index, clients) | |
end | |
------------------------------------------- | |
return function(s) | |
return awful.widget.tasklist { | |
screen = s, | |
filter = awful.widget.tasklist.filter.currenttags, | |
layout = layout, | |
widget_template = cell, | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment