From 7f6575ca7aa2db4e63b7c29457bdb3b5b0224995 Mon Sep 17 00:00:00 2001 From: ryuslash Date: Sat, 21 Aug 2010 22:28:30 +0200 Subject: Added ide-skel keybinds to .emacs, changed awesome rc --- awesome/rc.lua | 170 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 112 insertions(+), 58 deletions(-) (limited to 'awesome') diff --git a/awesome/rc.lua b/awesome/rc.lua index b7e1cb0..4102ec6 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -11,6 +11,49 @@ require("naughty") -- Themes define colours, icons, and wallpapers beautiful.init(os.getenv("HOME") .. "/.config/awesome/themes/default/theme.lua") +-- Functions +function switch_tag (i) + local screen = mouse.screen + if tags[screen][i] then + awful.tag.viewonly(tags[screen][i]) + end +end + +function toggle_tag (i) + local screen = mouse.screen + if tags[screen][i] then + awful.tag.viewtoggle(tags[screen][i]) + end +end + +function move_to_tag (i) + if client.focus and tags[client.focus.screen][i] then + awful.client.movetotag(tags[client.focus.screen][i]) + end +end + +function toggle_client_tag (i) + if client.focus and tags[client.focus.screen][i] then + awful.client.toggletag(tags[client.focus.screen][i]) + end +end + +function fexists(n) + local f = io.open(n) + + print(f) + print(f == nil) + + if f == nil then + print("returning false") + return false + end + + print("returning true") + io.close(f) + return true +end + -- This is used later as the default terminal and editor to run. terminal = "urxvt" editor = "emacs" @@ -46,7 +89,7 @@ layouts = tags = {} for s = 1, screen.count() do -- Each screen has its own tag table. - tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1]) + tags[s] = awful.tag({ "Q", "W", "E", "A", "S", "D", "Z", "X", "C" }, s, layouts[1]) end -- }}} @@ -217,21 +260,21 @@ 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, }, "Escape", awful.tag.history.restore), + 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", + awful.key({ modkey, }, "j", function () awful.client.focus.byidx( 1) if client.focus then client.focus:raise() end end), - awful.key({ modkey, }, "k", + awful.key({ modkey, }, "k", function () awful.client.focus.byidx(-1) if client.focus then client.focus:raise() end end), - awful.key({ modkey, }, "w", function () mymainmenu:show(true) end), + awful.key({ modkey, "Mod1" }, "w", function () mymainmenu:show(true) end), -- Layout manipulation awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), @@ -248,24 +291,65 @@ globalkeys = awful.util.table.join( end), -- Standard program - awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), - awful.key({ modkey, "Control" }, "r", awesome.restart), - awful.key({ modkey, "Shift" }, "q", awesome.quit), - awful.key({ "Mod1", "Control" }, "l", function () awful.util.spawn("i3lock -c 000000") end), - - awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), - awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), - awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), - awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), - awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), - awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), - awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), - awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), - + awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + awful.key({ modkey, "Control" }, "r", awesome.restart), + awful.key({ modkey, "Mod1" }, "q", awesome.quit), + awful.key({ "Mod1", "Control" }, "l", function () awful.util.spawn("i3lock -c 000000") end), + + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), + awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), + + -- Extra tag bindings + awful.key({ modkey, }, "q", function () switch_tag(1) end), + awful.key({ modkey, }, "w", function () switch_tag(2) end), + awful.key({ modkey, }, "e", function () switch_tag(3) end), + awful.key({ modkey, }, "a", function () switch_tag(4) end), + awful.key({ modkey, }, "s", function () switch_tag(5) end), + awful.key({ modkey, }, "d", function () switch_tag(6) end), + awful.key({ modkey, }, "z", function () switch_tag(7) end), + awful.key({ modkey, }, "x", function () switch_tag(8) end), + awful.key({ modkey, }, "c", function () switch_tag(9) end), + + awful.key({ modkey, "Control" }, "q", function () toggle_tag(1) end), + awful.key({ modkey, "Control" }, "w", function () toggle_tag(2) end), + awful.key({ modkey, "Control" }, "e", function () toggle_tag(3) end), + awful.key({ modkey, "Control" }, "a", function () toggle_tag(4) end), + awful.key({ modkey, "Control" }, "s", function () toggle_tag(5) end), + awful.key({ modkey, "Control" }, "d", function () toggle_tag(6) end), + awful.key({ modkey, "Control" }, "z", function () toggle_tag(7) end), + awful.key({ modkey, "Control" }, "x", function () toggle_tag(8) end), + awful.key({ modkey, "Control" }, "c", function () toggle_tag(9) end), + + awful.key({ modkey, "Shift" }, "q", function () move_to_tag(1) end), + awful.key({ modkey, "Shift" }, "w", function () move_to_tag(2) end), + awful.key({ modkey, "Shift" }, "e", function () move_to_tag(3) end), + awful.key({ modkey, "Shift" }, "a", function () move_to_tag(4) end), + awful.key({ modkey, "Shift" }, "s", function () move_to_tag(5) end), + awful.key({ modkey, "Shift" }, "d", function () move_to_tag(6) end), + awful.key({ modkey, "Shift" }, "z", function () move_to_tag(7) end), + awful.key({ modkey, "Shift" }, "x", function () move_to_tag(8) end), + awful.key({ modkey, "Shift" }, "c", function () move_to_tag(9) end), + + awful.key({ modkey, "Control", "Shift" }, "q", function () toggle_cleint_tag(1) end), + awful.key({ modkey, "Control", "Shift" }, "w", function () toggle_cleint_tag(2) end), + awful.key({ modkey, "Control", "Shift" }, "e", function () toggle_cleint_tag(3) end), + awful.key({ modkey, "Control", "Shift" }, "a", function () toggle_cleint_tag(4) end), + awful.key({ modkey, "Control", "Shift" }, "s", function () toggle_cleint_tag(5) end), + awful.key({ modkey, "Control", "Shift" }, "d", function () toggle_cleint_tag(6) end), + awful.key({ modkey, "Control", "Shift" }, "z", function () toggle_cleint_tag(7) end), + awful.key({ modkey, "Control", "Shift" }, "x", function () toggle_cleint_tag(8) end), + awful.key({ modkey, "Control", "Shift" }, "c", function () toggle_cleint_tag(9) end), + -- Prompt awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end), - awful.key({ modkey }, "x", + awful.key({ modkey, "Mod1" }, "x", function () awful.prompt.run({ prompt = "Run Lua code: " }, mypromptbox[mouse.screen].widget, @@ -276,7 +360,7 @@ globalkeys = awful.util.table.join( clientkeys = awful.util.table.join( awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end), - awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end), + awful.key({ modkey, "Mod1" }, "c", function (c) c:kill() end), awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ), awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end), awful.key({ modkey, }, "o", awful.client.movetoscreen ), @@ -295,39 +379,6 @@ for s = 1, screen.count() do keynumber = math.min(9, math.max(#tags[s], keynumber)); end --- Bind all key numbers to tags. --- Be careful: we use keycodes to make it works on any keyboard layout. --- This should map on the top row of your keyboard, usually 1 to 9. -for i = 1, keynumber do - globalkeys = awful.util.table.join(globalkeys, - awful.key({ modkey }, "#" .. i + 9, - function () - local screen = mouse.screen - if tags[screen][i] then - awful.tag.viewonly(tags[screen][i]) - end - end), - awful.key({ modkey, "Control" }, "#" .. i + 9, - function () - local screen = mouse.screen - if tags[screen][i] then - awful.tag.viewtoggle(tags[screen][i]) - end - end), - awful.key({ modkey, "Shift" }, "#" .. i + 9, - function () - if client.focus and tags[client.focus.screen][i] then - awful.client.movetotag(tags[client.focus.screen][i]) - end - end), - awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, - function () - if client.focus and tags[client.focus.screen][i] then - awful.client.toggletag(tags[client.focus.screen][i]) - end - end)) -end - clientbuttons = awful.util.table.join( awful.button({ }, 1, function (c) client.focus = c; c:raise() end), awful.button({ modkey }, 1, awful.mouse.client.move), @@ -352,6 +403,8 @@ awful.rules.rules = { properties = { floating = true } }, { rule = { class = "gimp" }, properties = { floating = true } }, + { rule = { class = "gwibber", name = "gwibber" }, + properties = { floating = true } }, -- Set Firefox to always map on tags number 2 of screen 1. -- { rule = { class = "Firefox" }, -- properties = { tag = tags[1][2] } }, @@ -395,5 +448,6 @@ client.add_signal("unfocus", function(c) end) -- }}} -awful.util.spawn_with_shell("xcompmgr") -awful.util.spawn_with_shell("xscreensaver") +if fexists(os.getenv("HOME") .. "/.config/awesome/local_rc.lua") then + dofile(os.getenv("HOME") .. "/.config/awesome/local_rc.lua") +end -- cgit v1.2.3-54-g00ecf