📜  Awesome wm tasklist disabled icon - Lua (1)

📅  最后修改于: 2023-12-03 15:29:32.590000             🧑  作者: Mango

Awesome wm tasklist disabled icon - Lua

This is a Lua script for the Awesome Window Manager that disables the tasklist icon for inactive clients.

Introduction

By default, the Awesome Window Manager displays an icon in the tasklist for every open client, whether it is active or inactive. This script allows you to disable the icon for inactive clients, so that only the active client is displayed in the tasklist.

Implementation
-- define the function
local function update_tasklist_icon(c)
    if not c.first_tag then return end
    local clients = c.first_tag.clients
    for _, c in ipairs(clients) do
        if c.minimized or not c:isvisible() then
            c.tasklist_disable_icon = true
        else
            c.tasklist_disable_icon = false
        end
    end
end

-- add the signal hook
client.connect_signal("manage", function(c)
    update_tasklist_icon(c)
end)

client.connect_signal("tagged", function(c)
    update_tasklist_icon(c)
end)

client.connect_signal("untagged", function(c)
    update_tasklist_icon(c)
end)

client.connect_signal("property::minimized", function(c)
    update_tasklist_icon(c)
end)
Explanation

The script defines a function update_tasklist_icon that takes a client c as an argument. The function checks if the client is minimized or not visible, and if so, sets the tasklist_disable_icon property of the client to true. This property disables the tasklist icon for the client.

The script also sets up signal hooks for various client events (manage, tagged, untagged, and property::minimized) that call the update_tasklist_icon function for the affected client.

Conclusion

With this script, you can customize the behavior of the Awesome Window Manager to your liking. By disabling the tasklist icon for inactive clients, you can streamline your workflow and focus on the task at hand.