From f892687ce5e41c6896fad0e7a9a3c4a337277bad Mon Sep 17 00:00:00 2001 From: luke bonham Date: Thu, 25 Apr 2013 13:41:47 +0200 Subject: [PATCH] binding key to tags: switched back to 3.5-2 config --- rc.lua.blackburn | 49 ++++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/rc.lua.blackburn b/rc.lua.blackburn index 3ad4049..5505631 100755 --- a/rc.lua.blackburn +++ b/rc.lua.blackburn @@ -85,8 +85,6 @@ editor_cmd = terminal .. " -e " .. editor gui_editor = "gvim" browser = "dwb" mail = terminal .. " -e mutt " -chat = terminal .. " -e irssi " -tasks = terminal .. " -e htop " wifi = terminal .. " -e sudo wifi-menu " musicplr = terminal .. " -g 130x34-320+16 -e ncmpcpp " @@ -126,18 +124,13 @@ myaccessories = { { "archives", "7zFM" }, { "charmap", "gucharmap" }, { "gbdfed", "gbdfed" }, - { "editor", gui_editor }, + { "gimp", "gimp" }, + { "text editor", gui_editor }, } myinternet = { - { "browser", browser }, - { "irc client" , chat }, { "torrent" , "rtorrent" }, { "torrent search" , "torrent-search" } } -mygraphics = { - { "gimp" , "gimp" }, - { "dia", "dia" }, -} myoffice = { { "writer" , "lowriter" }, { "impress" , "loimpress" }, @@ -146,11 +139,9 @@ mysystem = { { "appearance" , "lxappearance" }, { "cleaning" , "bleachbit" }, { "powertop" , terminal .. " -e sudo powertop " }, - { "task manager" , tasks } } mymainmenu = awful.menu({ items = { { "accessories" , myaccessories }, - { "graphics" , mygraphics }, { "internet" , myinternet }, { "office" , myoffice }, { "system" , mysystem }, @@ -814,39 +805,43 @@ clientkeys = awful.util.table.join( c.maximized_vertical = not c.maximized_vertical end) ) + + +-- Compute the maximum number of digit we need, limited to 9 +keynumber = 0 +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, 9 do +for i = 1, keynumber do globalkeys = awful.util.table.join(globalkeys, awful.key({ modkey }, "#" .. i + 9, function () - local screen = mouse.screen - local tag = awful.tag.gettags(screen)[i] - if tags then - awful.tag.viewonly(tags) + 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 - local tag = awful.tag.gettags(screen)[i] - if tags then - awful.tag.viewtoggle(tags) - end + screen = mouse.screen + if tags[screen][i] then + awful.tag.viewtoggle(tags[screen][i]) + end end), awful.key({ modkey, "Shift" }, "#" .. i + 9, function () - local tag = awful.tag.gettags(client.focus.screen)[i] - if client.focus and tag then - awful.client.movetotag(tag) + 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 () - local tag = awful.tag.gettags(client.focus.screen)[i] - if client.focus and tag then - awful.client.movetotag(tag) + if client.focus and tags[client.focus.screen][i] then + awful.client.toggletag(tags[client.focus.screen][i]) end end)) end