1
0
Fork 0
mirror of https://github.com/lcpz/awesome-copycats.git synced 2024-10-22 20:41:22 +00:00

binding key to tags: switched back to 3.5-2 config

This commit is contained in:
luke bonham 2013-04-25 13:41:47 +02:00
parent cd562892ab
commit f892687ce5

View file

@ -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