X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/887c37778210facea0c4c45a032dc00f06eaf78d..04fad5c8f1bcfd5beb3dc04cd0611f269414c753:/.config/awesome/rc.lua diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index 3c7cdf3..aab31dd 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -115,11 +115,18 @@ local function set_wallpaper(s) end end -local function centre_mouse_on_area(a) - mouse.coords({ - x = a.x + a.width/2, - y = a.y + a.height/2, - }, true) +local function move_mouse_to_area(a) + local coords = mouse.coords() + if (coords.x < a.x or + coords.x > (a.x+a.width) or + coords.y < a.y or + coords.y > (a.y+a.height)) then + + mouse.coords({ + x = a.x + a.width/2, + y = a.y + a.height/2, + }, true) + end end -- }}} @@ -166,8 +173,11 @@ menubar.utils.terminal = terminal -- Set the terminal for applications that requ -- forced_width = 4, -- widget = wibox.widget.separator --} -local spacer = wibox.widget.textbox() -spacer:set_text(" │ ") +local function make_spacer(text) + local spacer = wibox.widget.textbox() + spacer:set_text(text or " │ ") + return spacer +end -- Keyboard map indicator and switcher mykeyboardlayout = awful.widget.keyboardlayout() @@ -186,7 +196,7 @@ local lain_bat = lain.widget.bat({ clocksarray = clocksarray.get_clocksarray("%a %d %b %H:%M:%S %Z", { ["NZ"] = "Pacific/Auckland", ["DE"] = "Europe/Berlin" - }, spacer) + }, make_spacer()) -- Create a wibox for each screen and add it local taglist_buttons = gears.table.join( @@ -279,34 +289,31 @@ awful.screen.connect_for_each_screen(function(s) -- Add widgets to the wibox local right_widgets = gears.table.join(clocksarray, { - spacer, - --spacing = 4, - --spacing_widget = spacer, + make_spacer(" "), + wibox.widget.systray(), s.mylayoutbox, layout = wibox.layout.fixed.horizontal, }) if s == screen.primary then right_widgets = gears.table.join({ - wibox.widget.systray(), - spacer, + make_spacer(" "), ccwidgets.btc_widget, - spacer, + make_spacer(), ccwidgets.eth_widget, - spacer, + make_spacer(), lain_bat.widget, - spacer, + make_spacer(), }, right_widgets) end s.mywibox:setup { layout = wibox.layout.align.horizontal, { -- Left widgets - spacing = 4, - spacing_widget = spacer, layout = wibox.layout.fixed.horizontal, --s.namebox, s.mytaglist, + make_spacer(" "), s.mypromptbox, }, s.mytasklist, -- Middle widget @@ -746,11 +753,11 @@ globalkeys = gears.table.join( awful.key({ modkey, }, "d", th.delete_tag, {description = "delete the current tag", group = "tag"}), awful.key({ modkey, "Shift", }, "a", function() - move_to_new_tag(nil,nil,true,true,true) + th.move_to_new_tag(nil,nil,true,true,true) end, {description = "add a volatile tag with the focused client", group = "tag"}), awful.key({ modkey, "Shift", "Control" }, "a", function() - move_to_new_tag(nil,nil,false,true,true) + th.move_to_new_tag(nil,nil,false,true,true) end, {description = "add a permanent tag with the focused client", group = "tag"}), awful.key({ modkey, "Mod1" }, "a", th.copy_tag, @@ -1131,10 +1138,10 @@ client.connect_signal("request::activate", function(c, context, hints) }, context) then gears.timer.delayed_call(function() -- we need a delayed call so that we execute *after layout changes - centre_mouse_on_area(client.focus) + if hints.raise and c == client.focus and client.focus:isvisible() then + move_mouse_to_area(client.focus) + end end) - else - dbg.dump(c, context, hints) end end)