You are not logged in.
Hi,
I'm playing around with awesome and installed shifty. Works fine, but the key-/buttonbindings for actions on client windows (modkey + rightclick = resize etc.) have seized to work. What could that be?
My rc.lua is posted below, apart from some keybindings it's mostly unchanged, I haven't even edited the example tag definition for Shifty yet :
-- {{{ Load libraries
require("awful")
require("awful.autofocus")
require("awful.rules")
require("beautiful")
require("naughty")
require("shifty")
-- }}}
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
beautiful.init(awful.util.getdir("config") .. "/themes/zenburn/theme.lua")
-- This is used later as the default terminal and editor to run.
terminal = "urxvt"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor
-- Default modkey.
modkey = "Mod4"
altkey = "Mod1"
-- Table of layouts to cover with awful.layout.inc, order matters.
-- Available layouts: awful.layout.suit.floating, .tile, .tile.left,
-- .tile.bottom, .tile.top, .fair, .fair.horizontal, .spiral,
-- .spiral.dwindle, .max, .max.fullscreen, .magnifier
layouts =
{
awful.layout.suit.floating,
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
}
-- }}}
--[[
-- {{{ Tags: Traditional way
-- Define a tag table which hold all screen tags.
tags = {
names = { 1, 2, 3, 4, 5, 6, 7, 8, 9 },
layout = { layouts[1], layouts[2], layouts[1], layouts[1],
layouts[1], layouts[1], layouts[1], layouts[1], layouts[1] }
}
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( tags.names, s, tags.layout)
end
-- }}}
]]
-- {{{ Tags using Shifty
-- tag settings
shifty.config.tags =
{
["term"] = { position = 1, exclusive = true, spawn = terminal, },
["web"] = { position = 2, exclusive = true, spawn = browser, layout = awful.layout.suit.max, },
}
-- client settings
-- order here matters, early rules will be applied first
shifty.config.apps =
{
{ match = { "Navigator","Vimperator","Gran Paradiso","Firefox","Iceweasel","Opera"} , tag = "web" } ,
{ match = { "xterm", "urxvt"} , honorsizehints = false, slave = true, tag = "term" } ,
{ match = { "pcmanfm" }, slave = true } ,
{ match = { "" }, buttons =
{
button({ }, 1, function (c) client.focus = c; c:raise() end),
button({ modkey }, 1, function (c) awful.mouse.client.move() end),
button({ modkey }, 3, awful.mouse.client.resize ),
},
},
}
-- tag defaults
shifty.config.defaults =
{
layout = awful.layout.suit.tile.bottom,
ncol = 1,
mwfact = 0.60,
floatBars = true
}
shifty.init()
-- }}}
-- {{{ Menu
-- Create a laucher widget and a main menu
myawesomemenu =
{
{ "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
{ "restart", awesome.restart },
{ "quit", awesome.quit }
}
mymainmenu = awful.menu(
{
items =
{
{ "awesome", myawesomemenu, beautiful.awesome_icon },
{ "open terminal", terminal }
}
})
mylauncher = awful.widget.launcher(
{
image = image(beautiful.awesome_icon),
menu = mymainmenu
})
-- }}}
-- {{{ Wibox
-- Create a textclock widget
mytextclock = awful.widget.textclock({ align = "right" })
-- Create a systray
mysystray = widget({ type = "systray" })
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey }, 1, awful.client.movetotag),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
)
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1,
function (c)
if not c:isvisible() then
awful.tag.viewonly(c:tags()[1])
end
client.focus = c
c:raise()
end
),
awful.button({ }, 3,
function ()
if instance then
instance:hide()
instance = nil
else
instance = awful.menu.clients({ width=250 })
end
end
),
awful.button({ }, 4,
function ()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end
),
awful.button({ }, 5,
function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end
)
)
for s = 1, screen.count() do
-- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s)
mylayoutbox[s]:buttons(
awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)
)
)
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
-- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(
function(c)
return awful.widget.tasklist.label.currenttags(c, s)
end,
mytasklist.buttons
)
-- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s })
-- Add widgets to the wibox - order matters
mywibox[s].widgets =
{
{
mylauncher,
mytaglist[s],
mypromptbox[s],
layout = awful.widget.layout.horizontal.leftright
},
mylayoutbox[s],
mytextclock,
s == 1 and mysystray or nil,
mytasklist[s],
layout = awful.widget.layout.horizontal.rightleft
}
end
shifty.taglist = mytaglist
-- }}}
-- {{{ Mouse bindings
root.buttons(
awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
)
)
-- }}}
-- {{{ Key bindings
globalkeys = awful.util.table.join(
-- Tag manipulation
awful.key({ "Control", altkey }, "Left", awful.tag.viewprev ),
awful.key({ "Control", altkey }, "Right", awful.tag.viewnext ),
awful.key({ "Control", altkey }, "Escape", awful.tag.history.restore ),
awful.key({ modkey }, "t", function() shifty.add({ rel_index = 1 }) end),
awful.key({ modkey, "Control" }, "t", function() shifty.add({ rel_index = 1, nopopup = true }) end),
awful.key({ modkey, "Shift" }, "r", shifty.rename),
awful.key({ modkey, "Shift" }, "w", shifty.del),
awful.key({ altkey, }, "Tab",
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end
),
awful.key({ altkey, "Shift" }, "Tab",
function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end
),
awful.key({ modkey, }, "w", function () mymainmenu:show(true) end ),
-- Layout manipulation
awful.key({ modkey, }, "Tab", function () awful.client.swap.byidx(1) end ),
awful.key({ modkey, "Shift" }, "Tab", function () awful.client.swap.byidx(-1) end ),
awful.key({ "Control" }, "Tab", function () awful.screen.focus_relative(1) end ),
awful.key({ "Control", "Shift" }, "Tab", function () awful.screen.focus_relative(-1) end ),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto ),
-- awful.key({ modkey, }, "Tab",
-- function ()
-- awful.client.focus.history.previous()
-- if client.focus then
-- client.focus:raise()
-- end
-- 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({ 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 ),
-- Prompt
awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end ),
awful.key({ modkey }, "x",
function ()
awful.prompt.run({ prompt = "Run Lua code: " },
mypromptbox[mouse.screen].widget,
awful.util.eval, nil,
awful.util.getdir("cache") .. "/history_eval")
end
)
)
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, "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 ),
awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end ),
awful.key({ modkey, }, "n", function (c) c.minimized = not c.minimized end ),
awful.key({ modkey, }, "m",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
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, 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]]
-- Create <modkey>+i keybindings for Shifty
for i = 1, 9 do
globalkeys = awful.util.table.join(globalkeys,
awful.key(
{ modkey }, i,
function ()
local t = awful.tag.viewonly(shifty.getpos(i))
end
)
)
globalkeys = awful.util.table.join(globalkeys,
awful.key(
{ modkey, "Control" }, i,
function ()
local t = shifty.getpos(i)
t.selected = not t.selected
end
)
)
globalkeys = awful.util.table.join(globalkeys,
awful.key(
{ modkey, "Control", "Shift" }, i,
function ()
if client.focus then
awful.client.toggletag(shifty.getpos(i))
end
end
)
)
-- move clients to other tags
globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey, "Shift" }, i,
function ()
if client.focus then
local t = shifty.getpos(i)
awful.client.movetotag(t)
awful.tag.viewonly(t)
end
end
)
)
end
clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ altkey }, 1, awful.mouse.client.move),
awful.button({ altkey }, 3, awful.mouse.client.resize))
-- Set keys
root.keys(globalkeys)
shifty.config.globalkeys = globalkeys
shifty.config.clientkeys = clientkeys
--shifty.config.clientbuttons = clientbuttons
-- }}}
-- {{{ Rules
awful.rules.rules =
{
-- All clients will match this rule.
{ rule = { }, properties =
{
border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = true,
keys = clientkeys,
buttons = clientbuttons
}
},
-- { rule = {class = "MPlayer" },
-- properties = { floating = true } },
-- { rule = { class = "pinentry" },
-- properties = { floating = true } },
-- { rule = { class = "gimp" },
-- properties = { floating = true } },
-- { rule = { class = "Pidgin", role = "buddy_list" },
-- properties = { tag = { tags[1][2], tags[1][3] } } },
-- { rule = { class = "Pidgin", role = "conversation" },
-- properties = { tag = { tags[1][3] } } },
-- { rule = { class = "Opera" },
--§ properties = { tag = tags[1][2] } }
}
-- }}}
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.add_signal("manage",
function (c, startup)
-- Add a titlebar
-- awful.titlebar.add(c, { modkey = modkey })
-- Enable sloppy focus
c:add_signal("mouse::enter",
function(c)
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
end
end
)
if not startup then
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- awful.client.setslave(c)
-- Put windows in a smart way, only if they does not set an initial position.
if not c.size_hints.user_position and not c.size_hints.program_position then
awful.placement.no_overlap(c)
awful.placement.no_offscreen(c)
end
end
end
)
client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}
Another question: Does anyone know a good awesome tutorial? Because the awesome wiki is rather useless, I'm afraid.
My ship don't crash! She crashes, you crashed her!
Offline
It's not useless, or at least it wasn't for the other 5000 users. Everything is indexed on the main page, including the tutorial you seek http://awesome.naquadah.org/wiki/My_first_awesome
The first entry in your awful.rules.rules table applies to all clients. One of the rules assigns clientbuttons to every new client, another does the same with keys. Find out how the same is done with Shifty (because for some reason it overrides it? I don't know I never used Shifty).
You need to install an RTFM interface.
Offline
For Shifty it's in the shifty.config.apps section:
shifty.config.apps =
{
...
{ match = { "" }, buttons =
{
button({ }, 1, function (c) client.focus = c; c:raise() end),
button({ modkey }, 1, function (c) awful.mouse.client.move() end),
button({ modkey }, 3, awful.mouse.client.resize ),
},
},
}
but for some reason this does not work. But maybe it's to do with this being a set again later by awful in rules.rules. I'll play with that when I get home.
Concerning the wiki: Granted 'useless' was maybe too harsh, but the wiki is bad, including the tutorial, especially where the rules-table is concerned.
Example: Set up a rule to put a client on multiple tags by default. I find some entry somewhere (and I mean "some entry, somewhere". I can't even find it again, it is that well hidden) that tells me how to set 1 tag and mentions that I can set multiple tags "that way" as well. It doesn't tell me how, and a chance look in the correct place of the FAQ tells me that you CAN'T set multiple tags like you would set one, but have to use some strange function in conjunction with "callback =". Why? Because, apparently. The awesome-3-configuration entry doesn't even mention rules, neither does the tutorial.
If I wanted to teach awesome to cook tea, it would be alright for the wiki to be unhelpful, but the above seems to me to be pretty basic.
There are many things that are un- or badly documented. What is documented is documented mostly by examples that often aren't explained, leaving you unable to apply these to similar but not identical situations. And if there is some sort of explanation, chances are you won't find it because the wiki is all over the place.
Don't get me wrong, awesome is great, and I love it. It is very easy to use if you stay away from rc.lua and would be very easy to configure if rc.lua was explained properly.
My ship don't crash! She crashes, you crashed her!
Offline
Awesome went trough many transformations to become 'awesome' in just a short period of time. It was hard for volunteers to keep up with this and have the whole wiki updated. But we work hard to keep the most important pages updated, the FAQ, the Widgets in awesome, the widget libraries, User configuration files... and some other pages, that combined with the API docs is good enough.
You need to install an RTFM interface.
Offline
Playing with the two definitions of the client buttons didn't help. Either the buttons defined in the normal awesome rc.lua have to be passed to Shifty like globalkeys and clientkeys or awesome needs to be made aware of the keybindings defined within Shifty in some manner. Only I don't know how. Some more trial and error seems to be in order.
I agree that it is close to impossible to keep up with documenting in the time available while so much development is going on and so much still changes frequently. Insofar the documentation is certainly 'good enough' considering the resources (human or otherwise) available. It's not, however, good enough in objective terms.
Anyway, since I don't know enough about either Lua or awesome to start writing wiki entries myself, I'll take what I can get. (That being said, the awesome-3-configuration entry is definitely missing an awful.rules.rules section )
My ship don't crash! She crashes, you crashed her!
Offline
Hey,
I changed the line
button({ modkey }, 3, awful.mouse.client.resize ),
into
button({ modkey }, 3, function (c) awful.mouse.client.resize() end),
and this works pretty well for me.
Hope I could help you.
Offline