add iterate over all client in active tag

This commit is contained in:
Roland Schneider 2022-01-29 20:42:08 +01:00
parent 39835d2a82
commit 334d71f5fd
2 changed files with 67 additions and 2 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@ battery-widget
keyboard-layout-indicator
revelation
awesome-switcher
.idea
*.iml

67
rc.lua
View File

@ -292,6 +292,51 @@ local function set_wallpaper(s)
end
end
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
local function getAllClient()
local focusedScreen = awful.screen.focused ()
local t = focusedScreen.selected_tag
local clientsOnTag = t:clients()
return clientsOnTag
end
-- make all client minimized=false,maximized=false,fullscreen=false
local function restoreAll()
local clientsOnTag = getAllClient()
for k, currentClient in pairs(clientsOnTag) do
currentClient.minimized = false
currentClient.maximized = false
currentClient.fullscreen = false
end
end
-- only the focused client will be opened, all other client minimized
local function normalizeClients(idx)
local focusedScreen = awful.screen.focused ()
local focusedClient = client.focus
local t = focusedScreen.selected_tag
print ( 'tag' .. tostring(t))
local clientsOnTag = t:clients()
print('focused is'..tostring(focusedClient))
for k, currentClient in pairs(clientsOnTag) do
currentClient.maximized = false
if currentClient == focusedClient then
print('focused found'..tostring(k))
currentClient.minimized = false
else
print('minimize client'..tostring(currentClient))
currentClient.minimized = true;
end
end
end
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
screen.connect_signal("property::geometry", set_wallpaper)
@ -394,6 +439,7 @@ globalkeys = gears.table.join(
awful.key({ modkey, }, "j",
function ()
awful.client.focus.byidx( 1)
--swapClient(1)
end,
{description = "focus next by index", group = "client"}
),
@ -403,12 +449,28 @@ globalkeys = gears.table.join(
end,
{description = "focus previous by index", group = "client"}
),
awful.key({ modkey, }, "u",
function ()
restoreAll()
awful.client.focus.byidx( 1)
normalizeClients()
end,
{description = "focus next by index", group = "client"}
),
awful.key({ modkey, }, "i",
function ()
restoreAll()
awful.client.focus.byidx(-1)
normalizeClients()
end,
{description = "focus previous by index", group = "client"}
),
-- mod + w -> show main menu
awful.key({ modkey, }, "w", function () mymainmenu:show() end,
{description = "show main menu", group = "awesome"}),
-- Layout manipulation
-- mod + shift + j|k -> swap client wiht next|prev client in tag
-- md + shift + j|k -> swap client wiht next|prev client in tag
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
{description = "swap with next client by index", group = "client"}),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
@ -663,6 +725,7 @@ local function getTagByName(tagName)
return awful.tag.find_by_name(nil, tagName)
end
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = {
@ -820,5 +883,5 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
-- }}}
--
-- {{{ autostart
awful.spawn.with_shell("~/.config/awesome/autorun.sh")
-- awful.spawn.with_shell("~/.config/awesome/autorun.sh")
-- }}}