summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2016-12-13 19:25:18 +0100
committerPeter Palfrader <peter@palfrader.org>2016-12-15 21:49:55 +0100
commitb6e5feb04a133e572836ceffcf4044e7ac2cb101 (patch)
treef59509d55cf14575c09092873c66dfcd0340c59c
parent4bfeafc3ae74c7ca6d7cf123f597932ec512e6ef (diff)
Do not wrap around at edges, implement 2d behavior
-rw-r--r--config/awesome/rc.lua25
1 files changed, 20 insertions, 5 deletions
diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua
index 418579f..362786a 100644
--- a/config/awesome/rc.lua
+++ b/config/awesome/rc.lua
@@ -226,8 +226,8 @@ root.buttons(awful.util.table.join(
-- {{{ Key bindings
globalkeys = awful.util.table.join(
- awful.key({ modkey, }, "Left", awful.tag.viewprev ),
- awful.key({ modkey, }, "Right", awful.tag.viewnext ),
+ --awful.key({ modkey, }, "Left", awful.tag.viewprev ),
+ --awful.key({ modkey, }, "Right", awful.tag.viewnext ),
-- awful.key({ modkey, }, "Escape", awful.tag.history.restore),
awful.key({ modkey, }, "j",
@@ -294,9 +294,6 @@ globalkeys = awful.util.table.join(
awful.key({ "Control", "Mod1"}, "l", function () awful.util.spawn_with_shell("xscreensaver-command -lock") end),
- awful.key({ modkey, }, "Up" , function () awful.tag.viewidx(-5) end ),
- awful.key({ modkey, }, "Down", function () awful.tag.viewidx( 5) end ),
-
awful.key({ }, "XF86AudioRaiseVolume", function ()
awful.util.spawn("amixer -q -D default sset Master 5%+", false) end),
awful.key({ }, "XF86AudioLowerVolume", function ()
@@ -316,6 +313,24 @@ globalkeys = awful.util.table.join(
)
-- more weasel
+ local function viewidx_no_wrap(num_cols, delta_rows, delta_cols)
+ local screen = mouse.screen
+ local cur = awful.tag.getidx()
+ local cc = (cur-1) % num_cols
+ local jump = delta_rows * num_cols + delta_cols
+
+ if cc + delta_cols >= 0 and cc + delta_cols < num_cols and
+ cur + jump > 0 and cur + jump <= #tags[screen] then
+ awful.tag.viewidx(jump)
+ end
+ end
+ globalkeys = awful.util.table.join(globalkeys,
+ awful.key({ modkey, }, "Left" , function () viewidx_no_wrap (5, 0, -1) end ),
+ awful.key({ modkey, }, "Right", function () viewidx_no_wrap (5, 0, 1) end ),
+ awful.key({ modkey, }, "Up" , function () viewidx_no_wrap (5, -1, 0) end ),
+ awful.key({ modkey, }, "Down" , function () viewidx_no_wrap (5, 1, 0) end )
+ )
+
local tag_keys = {
"1", "2", "3", "4", "5",