diff --git a/README.md b/README.md index 7a1b087..4499251 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,10 @@ modkey + shift + i : shift to up region modkey + shift + insert : move to top-left modkey + shift + page_up : move to top-right modkey + shift + home : move to center -modkey + shift + end : move to center + +modkey + shift + end : toggle always on +--|will keep the floating client always visible + modkey + shift + delete : move to bottom-left modkey + shift + page_down : move to bottom-right --|these will also work with tiled clients diff --git a/init.lua b/init.lua index be7360d..c17e583 100644 --- a/init.lua +++ b/init.lua @@ -20,6 +20,7 @@ local shuffle = machina.shuffle local my_shifter = machina.my_shifter local expand_vertical = machina.expand_vertical local move_to = machina.move_to +local toggle_always_on = machina.toggle_always_on ---------------------------------------------------------- key bindings -- ; @@ -41,7 +42,7 @@ local bindings = { awful.key({modkey, "Shift"}, "Insert", move_to("top-left")), awful.key({modkey, "Shift"}, "Page_Up", move_to("top-right")), awful.key({modkey, "Shift"}, "Home", move_to("center")), - awful.key({modkey, "Shift"}, "End", move_to("center")), + awful.key({modkey, "Shift"}, "End", toggle_always_on), awful.key({modkey, "Shift"}, "Delete", move_to("bottom-left")), awful.key({modkey, "Shift"}, "Page_Down", move_to("bottom-right")), --▨ move (positional) @@ -85,12 +86,12 @@ client.connect_signal("request::activate", function(c) c:raise() client.focus = c end) --|this is needed to ensure floating stuff becomes - --|visible when invoked through run_or_raise + --|visible when invoked through run_or_raise. client.connect_signal("focus", function(c) if not c.floating then for _, tc in ipairs(screen[awful.screen.focused()].all_clients) do - if tc.floating then + if tc.floating and not tc.always_on then tc.hidden = true end end @@ -107,7 +108,7 @@ client.connect_signal("focus", function(c) end end) --|hide all floating windows when the user switches to a --|tiled client. this is handy when you have a floating - --|browser open. + --|browser open. unless, client is set to always_on. --------------------------------------------------------------- exports -- ; diff --git a/methods.lua b/methods.lua index c09ca1b..f0f49e4 100644 --- a/methods.lua +++ b/methods.lua @@ -1,3 +1,4 @@ + ---------------------------------------------------------------- locals -- ; local grect = require("gears.geometry").rectangle @@ -59,7 +60,7 @@ end --------------------------------------------------------------- helpers -- ; -local function getLowest(table) +local function getlowest(table) local low = math.huge local index for i, v in pairs(table) do @@ -81,6 +82,13 @@ local function tablelength(T) return count end +----------------------------------------------------------- always_on() -- ; + +local function toggle_always_on() + always_on = nil or client.focus.always_on + client.focus.always_on = not always_on +end + ----------------------------------------- focus_by_direction(direction) -- ; local function focus_by_direction(direction) @@ -164,7 +172,7 @@ local function move_to(location) edges.y[region.y] = region.y + region.height end - useless_gap = getLowest(edges.x) + useless_gap = getlowest(edges.x) client.focus:geometry(geoms[location](useless_gap)) return end @@ -596,7 +604,8 @@ module = { shuffle = shuffle, my_shifter = my_shifter, expand_vertical = expand_vertical, - move_to = move_to + move_to = move_to, + toggle_always_on = toggle_always_on } return module