diff --git a/.gitignore b/.gitignore index b94c4fe..9c2e8c0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ battery-widget keyboard-layout-indicator revelation awesome-switcher +.idea +*.iml diff --git a/rc.lua b/rc.lua index 56dab33..a774020 100644 --- a/rc.lua +++ b/rc.lua @@ -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") -- }}}