add iterate over all client in active tag
This commit is contained in:
parent
39835d2a82
commit
334d71f5fd
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,3 +2,5 @@ battery-widget
|
|||||||
keyboard-layout-indicator
|
keyboard-layout-indicator
|
||||||
revelation
|
revelation
|
||||||
awesome-switcher
|
awesome-switcher
|
||||||
|
.idea
|
||||||
|
*.iml
|
||||||
|
|||||||
67
rc.lua
67
rc.lua
@ -292,6 +292,51 @@ local function set_wallpaper(s)
|
|||||||
end
|
end
|
||||||
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)
|
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
|
||||||
screen.connect_signal("property::geometry", set_wallpaper)
|
screen.connect_signal("property::geometry", set_wallpaper)
|
||||||
|
|
||||||
@ -394,6 +439,7 @@ globalkeys = gears.table.join(
|
|||||||
awful.key({ modkey, }, "j",
|
awful.key({ modkey, }, "j",
|
||||||
function ()
|
function ()
|
||||||
awful.client.focus.byidx( 1)
|
awful.client.focus.byidx( 1)
|
||||||
|
--swapClient(1)
|
||||||
end,
|
end,
|
||||||
{description = "focus next by index", group = "client"}
|
{description = "focus next by index", group = "client"}
|
||||||
),
|
),
|
||||||
@ -403,12 +449,28 @@ globalkeys = gears.table.join(
|
|||||||
end,
|
end,
|
||||||
{description = "focus previous by index", group = "client"}
|
{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
|
-- mod + w -> show main menu
|
||||||
awful.key({ modkey, }, "w", function () mymainmenu:show() end,
|
awful.key({ modkey, }, "w", function () mymainmenu:show() end,
|
||||||
{description = "show main menu", group = "awesome"}),
|
{description = "show main menu", group = "awesome"}),
|
||||||
|
|
||||||
-- Layout manipulation
|
-- 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,
|
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
|
||||||
{description = "swap with next client by index", group = "client"}),
|
{description = "swap with next client by index", group = "client"}),
|
||||||
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
|
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)
|
return awful.tag.find_by_name(nil, tagName)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- {{{ Rules
|
-- {{{ Rules
|
||||||
-- Rules to apply to new clients (through the "manage" signal).
|
-- Rules to apply to new clients (through the "manage" signal).
|
||||||
awful.rules.rules = {
|
awful.rules.rules = {
|
||||||
@ -820,5 +883,5 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
|
|||||||
-- }}}
|
-- }}}
|
||||||
--
|
--
|
||||||
-- {{{ autostart
|
-- {{{ autostart
|
||||||
awful.spawn.with_shell("~/.config/awesome/autorun.sh")
|
-- awful.spawn.with_shell("~/.config/awesome/autorun.sh")
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user