2008-11-20 20:45:09 +01:00
|
|
|
-- Standard awesome library
|
2012-07-29 16:47:04 +02:00
|
|
|
local gears = require("gears")
|
2012-06-12 20:13:09 +02:00
|
|
|
local awful = require("awful")
|
2009-08-19 11:21:56 +02:00
|
|
|
require("awful.autofocus")
|
2010-10-06 14:32:41 +02:00
|
|
|
-- Widget and layout library
|
2012-06-12 14:14:57 +02:00
|
|
|
local wibox = require("wibox")
|
2008-11-20 20:45:09 +01:00
|
|
|
-- Theme handling library
|
2012-06-12 03:24:22 +02:00
|
|
|
local beautiful = require("beautiful")
|
2008-11-20 20:45:09 +01:00
|
|
|
-- Notification library
|
2012-06-12 03:48:41 +02:00
|
|
|
local naughty = require("naughty")
|
2012-06-12 10:36:28 +02:00
|
|
|
local menubar = require("menubar")
|
2016-02-12 00:49:54 +01:00
|
|
|
local hotkeys_popup = require("awful.hotkeys_popup").widget
|
2008-08-05 22:21:22 +02:00
|
|
|
|
2011-10-23 15:59:15 +02:00
|
|
|
-- {{{ Error handling
|
|
|
|
-- Check if awesome encountered an error during startup and fell back to
|
|
|
|
-- another config (This code will only ever execute for the fallback config)
|
|
|
|
if awesome.startup_errors then
|
|
|
|
naughty.notify({ preset = naughty.config.presets.critical,
|
|
|
|
title = "Oops, there were errors during startup!",
|
|
|
|
text = awesome.startup_errors })
|
|
|
|
end
|
2011-10-23 17:36:56 +02:00
|
|
|
|
|
|
|
-- Handle runtime errors after startup
|
|
|
|
do
|
|
|
|
local in_error = false
|
|
|
|
awesome.connect_signal("debug::error", function (err)
|
|
|
|
-- Make sure we don't go into an endless error loop
|
|
|
|
if in_error then return end
|
|
|
|
in_error = true
|
|
|
|
|
|
|
|
naughty.notify({ preset = naughty.config.presets.critical,
|
|
|
|
title = "Oops, an error happened!",
|
2015-07-10 18:17:48 +02:00
|
|
|
text = tostring(err) })
|
2011-10-23 17:36:56 +02:00
|
|
|
in_error = false
|
|
|
|
end)
|
|
|
|
end
|
2011-10-23 15:59:15 +02:00
|
|
|
-- }}}
|
|
|
|
|
2008-06-11 23:13:15 +02:00
|
|
|
-- {{{ Variable definitions
|
2014-03-28 15:17:41 +01:00
|
|
|
-- Themes define colours, icons, font and wallpapers.
|
2015-12-11 18:24:30 +01:00
|
|
|
beautiful.init(awful.util.get_themes_dir() .. "default/theme.lua")
|
2009-09-28 13:42:34 +02:00
|
|
|
|
2008-10-22 22:51:01 +02:00
|
|
|
-- This is used later as the default terminal and editor to run.
|
2008-05-20 15:39:47 +02:00
|
|
|
terminal = "xterm"
|
2008-10-23 10:26:13 +02:00
|
|
|
editor = os.getenv("EDITOR") or "nano"
|
|
|
|
editor_cmd = terminal .. " -e " .. editor
|
2008-06-11 23:13:15 +02:00
|
|
|
|
2008-05-20 15:39:47 +02:00
|
|
|
-- Default modkey.
|
|
|
|
-- Usually, Mod4 is the key with a logo between Control and Alt.
|
|
|
|
-- If you do not like this or do not have such a key,
|
|
|
|
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
|
|
|
|
-- However, you can use another modifier like Mod1, but it may interact with others.
|
|
|
|
modkey = "Mod4"
|
2008-06-11 23:13:15 +02:00
|
|
|
|
2008-05-24 13:55:49 +02:00
|
|
|
-- Table of layouts to cover with awful.layout.inc, order matters.
|
2014-03-26 23:56:10 +01:00
|
|
|
awful.layout.layouts = {
|
2009-12-21 09:18:51 +01:00
|
|
|
awful.layout.suit.floating,
|
2009-01-28 12:08:33 +01:00
|
|
|
awful.layout.suit.tile,
|
|
|
|
awful.layout.suit.tile.left,
|
|
|
|
awful.layout.suit.tile.bottom,
|
|
|
|
awful.layout.suit.tile.top,
|
2008-11-25 17:01:06 +01:00
|
|
|
awful.layout.suit.fair,
|
|
|
|
awful.layout.suit.fair.horizontal,
|
2009-07-12 20:27:41 +02:00
|
|
|
awful.layout.suit.spiral,
|
|
|
|
awful.layout.suit.spiral.dwindle,
|
2008-11-25 17:01:06 +01:00
|
|
|
awful.layout.suit.max,
|
|
|
|
awful.layout.suit.max.fullscreen,
|
2015-05-25 17:09:43 +02:00
|
|
|
awful.layout.suit.magnifier,
|
|
|
|
awful.layout.suit.corner.nw,
|
|
|
|
-- awful.layout.suit.corner.ne,
|
|
|
|
-- awful.layout.suit.corner.sw,
|
|
|
|
-- awful.layout.suit.corner.se,
|
2008-06-11 23:13:15 +02:00
|
|
|
}
|
2008-05-20 15:39:47 +02:00
|
|
|
-- }}}
|
|
|
|
|
2015-09-13 10:58:44 +02:00
|
|
|
-- {{{ Helper functions
|
2015-09-13 14:47:16 +02:00
|
|
|
local function client_menu_toggle_fn()
|
|
|
|
local instance = nil
|
2015-10-22 23:57:47 +02:00
|
|
|
|
2015-09-13 14:47:16 +02:00
|
|
|
return function ()
|
|
|
|
if instance and instance.wibox.visible then
|
|
|
|
instance:hide()
|
|
|
|
instance = nil
|
|
|
|
else
|
|
|
|
instance = awful.menu.clients({ theme = { width = 250 } })
|
|
|
|
end
|
2015-09-13 10:58:44 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
-- }}}
|
|
|
|
|
2009-08-31 11:52:49 +02:00
|
|
|
-- {{{ Menu
|
2016-01-06 19:25:24 +01:00
|
|
|
-- Create a launcher widget and a main menu
|
2009-09-08 10:23:18 +02:00
|
|
|
myawesomemenu = {
|
2015-09-20 16:42:24 +02:00
|
|
|
{ "hotkeys", function() return false, hotkeys_popup.show_help end},
|
2009-09-08 10:23:18 +02:00
|
|
|
{ "manual", terminal .. " -e man awesome" },
|
2011-09-17 17:24:44 +02:00
|
|
|
{ "edit config", editor_cmd .. " " .. awesome.conffile },
|
2009-09-08 10:23:18 +02:00
|
|
|
{ "restart", awesome.restart },
|
|
|
|
{ "quit", awesome.quit }
|
|
|
|
}
|
|
|
|
|
2009-08-31 11:52:49 +02:00
|
|
|
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
|
|
|
|
{ "open terminal", terminal }
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2010-09-29 13:26:09 +02:00
|
|
|
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
|
2009-08-31 11:52:49 +02:00
|
|
|
menu = mymainmenu })
|
2012-03-08 20:24:21 +01:00
|
|
|
|
|
|
|
-- Menubar configuration
|
|
|
|
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
2009-08-31 11:52:49 +02:00
|
|
|
-- }}}
|
|
|
|
|
2015-02-23 20:30:02 +01:00
|
|
|
-- Keyboard map indicator and switcher
|
|
|
|
mykeyboardlayout = awful.widget.keyboardlayout()
|
|
|
|
|
2008-09-24 12:13:21 +02:00
|
|
|
-- {{{ Wibox
|
2009-06-30 12:20:45 +02:00
|
|
|
-- Create a textclock widget
|
2016-05-23 06:46:01 +02:00
|
|
|
mytextclock = wibox.widget.textclock()
|
2008-06-14 18:12:16 +02:00
|
|
|
|
2008-09-24 12:13:21 +02:00
|
|
|
-- Create a wibox for each screen and add it
|
|
|
|
mywibox = {}
|
2008-10-13 11:28:36 +02:00
|
|
|
mypromptbox = {}
|
2008-10-19 19:14:55 +02:00
|
|
|
mylayoutbox = {}
|
|
|
|
mytaglist = {}
|
2009-04-17 11:13:22 +02:00
|
|
|
mytaglist.buttons = awful.util.table.join(
|
2016-04-05 09:02:00 +02:00
|
|
|
awful.button({ }, 1, function(t) t:view_only() end),
|
2016-04-02 09:27:45 +02:00
|
|
|
awful.button({ modkey }, 1, function(t)
|
|
|
|
if client.focus then
|
|
|
|
client.focus:move_to_tag(t)
|
|
|
|
end
|
|
|
|
end),
|
2009-08-27 17:20:14 +02:00
|
|
|
awful.button({ }, 3, awful.tag.viewtoggle),
|
2016-04-02 09:27:45 +02:00
|
|
|
awful.button({ modkey }, 3, function(t)
|
|
|
|
if client.focus then
|
|
|
|
client.focus:toggle_tag(t)
|
|
|
|
end
|
|
|
|
end),
|
2016-04-05 09:02:00 +02:00
|
|
|
awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
|
|
|
|
awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
|
2015-09-13 10:58:44 +02:00
|
|
|
)
|
|
|
|
|
2008-10-19 19:14:55 +02:00
|
|
|
mytasklist = {}
|
2009-04-17 11:13:22 +02:00
|
|
|
mytasklist.buttons = awful.util.table.join(
|
|
|
|
awful.button({ }, 1, function (c)
|
2011-04-24 17:24:43 +02:00
|
|
|
if c == client.focus then
|
|
|
|
c.minimized = true
|
|
|
|
else
|
2012-07-09 21:26:00 +02:00
|
|
|
-- Without this, the following
|
|
|
|
-- :isvisible() makes no sense
|
|
|
|
c.minimized = false
|
2016-04-05 09:02:00 +02:00
|
|
|
if not c:isvisible() and c.first_tag then
|
|
|
|
c.first_tag:view_only()
|
2011-04-24 17:24:43 +02:00
|
|
|
end
|
|
|
|
-- This will also un-minimize
|
|
|
|
-- the client, if needed
|
|
|
|
client.focus = c
|
|
|
|
c:raise()
|
2009-04-17 11:13:22 +02:00
|
|
|
end
|
|
|
|
end),
|
2015-09-13 14:47:16 +02:00
|
|
|
awful.button({ }, 3, client_menu_toggle_fn()),
|
2009-04-17 11:13:22 +02:00
|
|
|
awful.button({ }, 4, function ()
|
|
|
|
awful.client.focus.byidx(1)
|
|
|
|
end),
|
|
|
|
awful.button({ }, 5, function ()
|
|
|
|
awful.client.focus.byidx(-1)
|
|
|
|
end))
|
2008-10-19 19:14:55 +02:00
|
|
|
|
2016-09-23 09:51:21 +02:00
|
|
|
local function set_wallpaper(s)
|
2016-04-17 15:34:00 +02:00
|
|
|
if beautiful.wallpaper then
|
2016-04-28 17:45:36 +02:00
|
|
|
local wallpaper = beautiful.wallpaper
|
|
|
|
-- If wallpaper is a function, call it with the screen
|
|
|
|
if type(wallpaper) == "function" then
|
|
|
|
wallpaper = wallpaper(s)
|
|
|
|
end
|
|
|
|
gears.wallpaper.maximized(wallpaper, s, true)
|
2016-04-17 15:34:00 +02:00
|
|
|
end
|
2016-09-23 09:51:21 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
|
|
|
|
screen.connect_signal("property::geometry", set_wallpaper)
|
|
|
|
|
|
|
|
awful.screen.connect_for_each_screen(function(s)
|
|
|
|
-- Wallpaper
|
|
|
|
set_wallpaper(s)
|
2016-04-17 15:34:00 +02:00
|
|
|
|
|
|
|
-- Each screen has its own tag table.
|
2016-04-17 15:49:06 +02:00
|
|
|
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
|
2016-04-17 15:34:00 +02:00
|
|
|
|
2008-10-19 19:14:55 +02:00
|
|
|
-- Create a promptbox for each screen
|
2009-10-24 15:06:54 +02:00
|
|
|
mypromptbox[s] = awful.widget.prompt()
|
2008-10-19 19:14:55 +02:00
|
|
|
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
|
|
|
|
-- We need one layoutbox per screen.
|
2009-03-10 19:31:28 +01:00
|
|
|
mylayoutbox[s] = awful.widget.layoutbox(s)
|
2009-08-14 16:46:35 +02:00
|
|
|
mylayoutbox[s]:buttons(awful.util.table.join(
|
2014-03-28 13:29:16 +01:00
|
|
|
awful.button({ }, 1, function () awful.layout.inc( 1) end),
|
|
|
|
awful.button({ }, 3, function () awful.layout.inc(-1) end),
|
|
|
|
awful.button({ }, 4, function () awful.layout.inc( 1) end),
|
|
|
|
awful.button({ }, 5, function () awful.layout.inc(-1) end)))
|
2008-10-19 19:14:55 +02:00
|
|
|
-- Create a taglist widget
|
2009-10-24 15:06:54 +02:00
|
|
|
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
|
2008-10-19 19:14:55 +02:00
|
|
|
|
|
|
|
-- Create a tasklist widget
|
2009-10-24 15:06:54 +02:00
|
|
|
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
|
2008-10-19 19:14:55 +02:00
|
|
|
|
|
|
|
-- Create the wibox
|
2016-05-08 08:10:35 +02:00
|
|
|
mywibox[s] = awful.wibar({ position = "top", screen = s })
|
2009-10-24 15:06:54 +02:00
|
|
|
|
2015-09-27 17:00:01 +02:00
|
|
|
-- Add widgets to the wibox
|
|
|
|
mywibox[s]:setup {
|
|
|
|
layout = wibox.layout.align.horizontal,
|
|
|
|
{ -- Left widgets
|
|
|
|
layout = wibox.layout.fixed.horizontal,
|
|
|
|
mylauncher,
|
|
|
|
mytaglist[s],
|
|
|
|
mypromptbox[s],
|
|
|
|
},
|
|
|
|
mytasklist[s], -- Middle widget
|
|
|
|
{ -- Right widgets
|
|
|
|
layout = wibox.layout.fixed.horizontal,
|
|
|
|
mykeyboardlayout,
|
2016-03-05 16:49:49 +01:00
|
|
|
wibox.widget.systray(),
|
2015-09-27 17:00:01 +02:00
|
|
|
mytextclock,
|
|
|
|
mylayoutbox[s],
|
|
|
|
},
|
|
|
|
}
|
2016-03-26 18:36:38 +01:00
|
|
|
end)
|
2008-05-20 15:39:47 +02:00
|
|
|
-- }}}
|
|
|
|
|
|
|
|
-- {{{ Mouse bindings
|
2009-08-14 16:46:35 +02:00
|
|
|
root.buttons(awful.util.table.join(
|
2009-04-14 17:53:22 +02:00
|
|
|
awful.button({ }, 3, function () mymainmenu:toggle() end),
|
|
|
|
awful.button({ }, 4, awful.tag.viewnext),
|
2009-08-14 16:46:35 +02:00
|
|
|
awful.button({ }, 5, awful.tag.viewprev)
|
|
|
|
))
|
2008-05-20 15:39:47 +02:00
|
|
|
-- }}}
|
|
|
|
|
|
|
|
-- {{{ Key bindings
|
2009-04-17 11:13:22 +02:00
|
|
|
globalkeys = awful.util.table.join(
|
2015-09-20 16:42:24 +02:00
|
|
|
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
|
|
|
|
{description="show help", group="awesome"}),
|
2015-10-17 19:05:35 +02:00
|
|
|
awful.key({ modkey, }, "Left", awful.tag.viewprev,
|
|
|
|
{description = "view previous", group = "tag"}),
|
|
|
|
awful.key({ modkey, }, "Right", awful.tag.viewnext,
|
|
|
|
{description = "view next", group = "tag"}),
|
|
|
|
awful.key({ modkey, }, "Escape", awful.tag.history.restore,
|
|
|
|
{description = "go back", group = "tag"}),
|
2009-02-20 15:02:22 +01:00
|
|
|
|
2009-04-14 17:53:22 +02:00
|
|
|
awful.key({ modkey, }, "j",
|
2009-02-24 17:42:21 +01:00
|
|
|
function ()
|
|
|
|
awful.client.focus.byidx( 1)
|
2015-10-17 19:05:35 +02:00
|
|
|
end,
|
|
|
|
{description = "focus next by index", group = "client"}
|
|
|
|
),
|
2009-04-14 17:53:22 +02:00
|
|
|
awful.key({ modkey, }, "k",
|
2009-02-24 17:42:21 +01:00
|
|
|
function ()
|
|
|
|
awful.client.focus.byidx(-1)
|
2015-10-17 19:05:35 +02:00
|
|
|
end,
|
|
|
|
{description = "focus previous by index", group = "client"}
|
|
|
|
),
|
|
|
|
awful.key({ modkey, }, "w", function () mymainmenu:show() end,
|
|
|
|
{description = "show main menu", group = "awesome"}),
|
2009-02-20 15:02:22 +01:00
|
|
|
|
|
|
|
-- Layout manipulation
|
2015-10-17 19:05:35 +02:00
|
|
|
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
|
|
|
|
{description = "swap with next client by index", group = "client"}),
|
|
|
|
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
|
|
|
|
{description = "swap with previous client by index", group = "client"}),
|
|
|
|
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
|
|
|
|
{description = "focus the next screen", group = "screen"}),
|
|
|
|
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
|
|
|
|
{description = "focus the previous screen", group = "screen"}),
|
|
|
|
awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
|
|
|
|
{description = "jump to urgent client", group = "client"}),
|
2009-04-14 17:53:22 +02:00
|
|
|
awful.key({ modkey, }, "Tab",
|
2009-02-24 17:42:21 +01:00
|
|
|
function ()
|
|
|
|
awful.client.focus.history.previous()
|
|
|
|
if client.focus then
|
|
|
|
client.focus:raise()
|
|
|
|
end
|
2015-10-17 19:05:35 +02:00
|
|
|
end,
|
|
|
|
{description = "go back", group = "client"}),
|
2009-02-20 15:02:22 +01:00
|
|
|
|
|
|
|
-- Standard program
|
2015-10-17 19:05:35 +02:00
|
|
|
awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
|
|
|
|
{description = "open a terminal", group = "launcher"}),
|
|
|
|
awful.key({ modkey, "Control" }, "r", awesome.restart,
|
|
|
|
{description = "reload awesome", group = "awesome"}),
|
|
|
|
awful.key({ modkey, "Shift" }, "q", awesome.quit,
|
|
|
|
{description = "quit awesome", group = "awesome"}),
|
|
|
|
|
|
|
|
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
|
|
|
|
{description = "increase master width factor", group = "layout"}),
|
|
|
|
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
|
|
|
|
{description = "decrease master width factor", group = "layout"}),
|
|
|
|
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
|
|
|
|
{description = "increase the number of master clients", group = "layout"}),
|
|
|
|
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
|
|
|
|
{description = "decrease the number of master clients", group = "layout"}),
|
|
|
|
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
|
|
|
|
{description = "increase the number of columns", group = "layout"}),
|
|
|
|
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
|
|
|
|
{description = "decrease the number of columns", group = "layout"}),
|
|
|
|
awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end,
|
|
|
|
{description = "select next", group = "layout"}),
|
|
|
|
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
|
|
|
|
{description = "select previous", group = "layout"}),
|
2009-02-20 15:02:22 +01:00
|
|
|
|
2015-05-19 02:21:03 +02:00
|
|
|
awful.key({ modkey, "Control" }, "n",
|
|
|
|
function ()
|
2016-02-07 13:05:11 +01:00
|
|
|
local c = awful.client.restore()
|
2015-05-19 02:21:03 +02:00
|
|
|
-- Focus restored client
|
|
|
|
if c then
|
|
|
|
client.focus = c
|
|
|
|
c:raise()
|
|
|
|
end
|
2015-10-17 19:05:35 +02:00
|
|
|
end,
|
|
|
|
{description = "restore minimized", group = "client"}),
|
2011-02-19 22:25:12 +01:00
|
|
|
|
2009-02-20 15:02:22 +01:00
|
|
|
-- Prompt
|
2015-10-17 19:05:35 +02:00
|
|
|
awful.key({ modkey }, "r", function () mypromptbox[awful.screen.focused()]:run() end,
|
|
|
|
{description = "run prompt", group = "launcher"}),
|
2009-04-14 17:53:22 +02:00
|
|
|
|
2009-04-17 18:19:37 +02:00
|
|
|
awful.key({ modkey }, "x",
|
2009-04-14 17:53:22 +02:00
|
|
|
function ()
|
|
|
|
awful.prompt.run({ prompt = "Run Lua code: " },
|
2015-01-31 16:40:46 +01:00
|
|
|
mypromptbox[awful.screen.focused()].widget,
|
2009-04-14 17:53:22 +02:00
|
|
|
awful.util.eval, nil,
|
2015-11-28 19:36:26 +01:00
|
|
|
awful.util.get_cache_dir() .. "/history_eval")
|
2015-10-17 19:05:35 +02:00
|
|
|
end,
|
|
|
|
{description = "lua execute prompt", group = "awesome"}),
|
2012-03-08 20:24:21 +01:00
|
|
|
-- Menubar
|
2015-10-17 19:05:35 +02:00
|
|
|
awful.key({ modkey }, "p", function() menubar.show() end,
|
|
|
|
{description = "show the menubar", group = "launcher"})
|
2009-04-17 11:13:22 +02:00
|
|
|
)
|
2009-02-20 15:02:22 +01:00
|
|
|
|
2009-04-17 11:13:22 +02:00
|
|
|
clientkeys = awful.util.table.join(
|
2015-06-21 23:26:08 +02:00
|
|
|
awful.key({ modkey, }, "f",
|
|
|
|
function (c)
|
|
|
|
c.fullscreen = not c.fullscreen
|
|
|
|
c:raise()
|
2016-05-30 04:33:59 +02:00
|
|
|
end,
|
|
|
|
{description = "toggle fullscreen", group = "client"}),
|
2015-10-17 19:05:35 +02:00
|
|
|
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
|
|
|
|
{description = "close", group = "client"}),
|
|
|
|
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
|
|
|
|
{description = "toggle floating", group = "client"}),
|
|
|
|
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
|
|
|
|
{description = "move to master", group = "client"}),
|
2016-04-02 09:27:45 +02:00
|
|
|
awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
|
2015-10-17 19:05:35 +02:00
|
|
|
{description = "move to screen", group = "client"}),
|
|
|
|
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
|
|
|
|
{description = "toggle keep on top", group = "client"}),
|
2011-04-28 20:14:11 +02:00
|
|
|
awful.key({ modkey, }, "n",
|
|
|
|
function (c)
|
|
|
|
-- The client currently has the input focus, so it cannot be
|
|
|
|
-- minimized, since minimized clients can't have the focus.
|
|
|
|
c.minimized = true
|
2015-10-17 19:05:35 +02:00
|
|
|
end ,
|
|
|
|
{description = "minimize", group = "client"}),
|
2009-08-25 14:56:17 +02:00
|
|
|
awful.key({ modkey, }, "m",
|
2009-02-20 15:02:22 +01:00
|
|
|
function (c)
|
2015-06-21 23:26:08 +02:00
|
|
|
c.maximized = not c.maximized
|
|
|
|
c:raise()
|
2015-10-17 19:05:35 +02:00
|
|
|
end ,
|
|
|
|
{description = "maximize", group = "client"})
|
2009-04-17 11:13:22 +02:00
|
|
|
)
|
2009-02-20 15:02:22 +01:00
|
|
|
|
2009-09-18 11:41:55 +02:00
|
|
|
-- 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.
|
2013-03-22 05:59:05 +01:00
|
|
|
for i = 1, 9 do
|
2009-05-09 20:31:26 +02:00
|
|
|
globalkeys = awful.util.table.join(globalkeys,
|
2014-03-28 15:17:41 +01:00
|
|
|
-- View tag only.
|
2009-09-18 11:41:55 +02:00
|
|
|
awful.key({ modkey }, "#" .. i + 9,
|
2009-04-17 11:13:22 +02:00
|
|
|
function ()
|
2015-01-31 16:40:46 +01:00
|
|
|
local screen = awful.screen.focused()
|
2016-04-05 09:02:00 +02:00
|
|
|
local tag = screen.tags[i]
|
2013-03-22 05:59:05 +01:00
|
|
|
if tag then
|
2016-04-05 09:02:00 +02:00
|
|
|
tag:view_only()
|
2009-04-14 17:53:22 +02:00
|
|
|
end
|
2015-10-17 19:05:35 +02:00
|
|
|
end,
|
|
|
|
{description = "view tag #"..i, group = "tag"}),
|
2014-03-28 15:17:41 +01:00
|
|
|
-- Toggle tag.
|
2009-09-18 11:41:55 +02:00
|
|
|
awful.key({ modkey, "Control" }, "#" .. i + 9,
|
2009-04-17 11:13:22 +02:00
|
|
|
function ()
|
2015-01-31 16:40:46 +01:00
|
|
|
local screen = awful.screen.focused()
|
2016-04-05 09:02:00 +02:00
|
|
|
local tag = screen.tags[i]
|
2013-03-22 05:59:05 +01:00
|
|
|
if tag then
|
|
|
|
awful.tag.viewtoggle(tag)
|
2009-04-17 11:13:22 +02:00
|
|
|
end
|
2015-10-17 19:05:35 +02:00
|
|
|
end,
|
|
|
|
{description = "toggle tag #" .. i, group = "tag"}),
|
2014-03-28 15:17:41 +01:00
|
|
|
-- Move client to tag.
|
2009-09-18 11:41:55 +02:00
|
|
|
awful.key({ modkey, "Shift" }, "#" .. i + 9,
|
2009-04-17 11:13:22 +02:00
|
|
|
function ()
|
2013-09-30 12:41:57 +02:00
|
|
|
if client.focus then
|
2016-04-05 09:02:00 +02:00
|
|
|
local tag = client.focus.screen.tags[i]
|
2013-09-30 12:41:57 +02:00
|
|
|
if tag then
|
2016-04-02 09:27:45 +02:00
|
|
|
client.focus:move_to_tag(tag)
|
2013-09-30 12:41:57 +02:00
|
|
|
end
|
2013-03-22 05:59:05 +01:00
|
|
|
end
|
2015-10-17 19:05:35 +02:00
|
|
|
end,
|
|
|
|
{description = "move focused client to tag #"..i, group = "tag"}),
|
2016-04-04 20:28:54 +02:00
|
|
|
-- Toggle tag on focused client.
|
2009-09-18 11:41:55 +02:00
|
|
|
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
|
2009-04-17 11:13:22 +02:00
|
|
|
function ()
|
2013-09-30 12:41:57 +02:00
|
|
|
if client.focus then
|
2016-04-05 09:02:00 +02:00
|
|
|
local tag = client.focus.screen.tags[i]
|
2013-09-30 12:41:57 +02:00
|
|
|
if tag then
|
2016-04-02 09:27:45 +02:00
|
|
|
client.focus:toggle_tag(tag)
|
2013-09-30 12:41:57 +02:00
|
|
|
end
|
2009-04-17 11:13:22 +02:00
|
|
|
end
|
2015-10-17 19:05:35 +02:00
|
|
|
end,
|
|
|
|
{description = "toggle focused client on tag #" .. i, group = "tag"})
|
|
|
|
)
|
2008-05-20 15:39:47 +02:00
|
|
|
end
|
|
|
|
|
2009-08-24 16:27:35 +02:00
|
|
|
clientbuttons = awful.util.table.join(
|
|
|
|
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
|
|
|
|
awful.button({ modkey }, 1, awful.mouse.client.move),
|
|
|
|
awful.button({ modkey }, 3, awful.mouse.client.resize))
|
|
|
|
|
2009-01-05 16:59:20 +01:00
|
|
|
-- Set keys
|
2009-08-14 16:46:35 +02:00
|
|
|
root.keys(globalkeys)
|
2008-05-20 15:39:47 +02:00
|
|
|
-- }}}
|
|
|
|
|
2009-08-24 16:27:35 +02:00
|
|
|
-- {{{ Rules
|
2014-03-28 15:17:41 +01:00
|
|
|
-- Rules to apply to new clients (through the "manage" signal).
|
2009-08-24 16:27:35 +02:00
|
|
|
awful.rules.rules = {
|
|
|
|
-- All clients will match this rule.
|
|
|
|
{ rule = { },
|
|
|
|
properties = { border_width = beautiful.border_width,
|
|
|
|
border_color = beautiful.border_normal,
|
2012-07-06 17:30:35 +02:00
|
|
|
focus = awful.client.focus.filter,
|
2014-03-23 18:34:38 +01:00
|
|
|
raise = true,
|
2009-08-24 16:27:35 +02:00
|
|
|
keys = clientkeys,
|
2016-04-16 11:51:25 +02:00
|
|
|
buttons = clientbuttons,
|
2016-09-15 22:50:28 +02:00
|
|
|
screen = awful.screen.preferred,
|
2016-04-16 11:51:25 +02:00
|
|
|
placement = awful.placement.no_overlap+awful.placement.no_offscreen
|
|
|
|
}
|
|
|
|
},
|
2015-07-20 01:57:21 +02:00
|
|
|
|
|
|
|
-- Floating clients.
|
|
|
|
{ rule_any = {
|
|
|
|
instance = {
|
|
|
|
"DTA", -- Firefox addon DownThemAll.
|
|
|
|
"copyq", -- Includes session name in class.
|
|
|
|
},
|
|
|
|
class = {
|
|
|
|
"Arandr",
|
|
|
|
"Gpick",
|
|
|
|
"Kruler",
|
|
|
|
"MessageWin", -- kalarm.
|
|
|
|
"Sxiv",
|
|
|
|
"Wpa_gui",
|
|
|
|
"pinentry",
|
|
|
|
"veromix",
|
|
|
|
"xtightvncviewer"},
|
|
|
|
|
|
|
|
name = {
|
|
|
|
"Event Tester", -- xev.
|
|
|
|
},
|
|
|
|
role = {
|
|
|
|
"AlarmWindow", -- Thunderbird's calendar.
|
|
|
|
"pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
|
|
|
|
}
|
|
|
|
}, properties = { floating = true }},
|
|
|
|
|
2016-04-14 09:13:06 +02:00
|
|
|
-- Add titlebars to normal clients and dialogs
|
|
|
|
{ rule_any = {type = { "normal", "dialog" }
|
|
|
|
}, properties = { titlebars_enabled = true }
|
|
|
|
},
|
|
|
|
|
2016-04-10 11:18:07 +02:00
|
|
|
-- Set Firefox to always map on the tag named "2" on screen 1.
|
2009-08-25 11:09:12 +02:00
|
|
|
-- { rule = { class = "Firefox" },
|
2016-04-10 11:18:07 +02:00
|
|
|
-- properties = { screen = 1, tag = "2" } },
|
2009-08-24 16:27:35 +02:00
|
|
|
}
|
|
|
|
-- }}}
|
|
|
|
|
2009-08-19 15:49:15 +02:00
|
|
|
-- {{{ Signals
|
|
|
|
-- Signal function to execute when a new client appears.
|
2014-03-16 20:15:02 +01:00
|
|
|
client.connect_signal("manage", function (c)
|
2016-04-16 11:51:25 +02:00
|
|
|
-- Set the windows at the slave,
|
|
|
|
-- i.e. put it at the end of others instead of setting it master.
|
|
|
|
-- if not awesome.startup then awful.client.setslave(c) end
|
|
|
|
|
|
|
|
if awesome.startup and
|
|
|
|
not c.size_hints.user_position
|
|
|
|
and not c.size_hints.program_position then
|
2015-07-11 22:53:57 +02:00
|
|
|
-- Prevent clients from being unreachable after screen count changes.
|
2014-11-01 23:53:03 +01:00
|
|
|
awful.placement.no_offscreen(c)
|
2009-09-18 11:35:59 +02:00
|
|
|
end
|
2016-04-14 09:13:06 +02:00
|
|
|
end)
|
2012-10-23 20:32:59 +02:00
|
|
|
|
2016-04-14 09:13:06 +02:00
|
|
|
-- Add a titlebar if titlebars_enabled is set to true in the rules.
|
|
|
|
client.connect_signal("request::titlebars", function(c)
|
|
|
|
-- buttons for the titlebar
|
|
|
|
local buttons = awful.util.table.join(
|
|
|
|
awful.button({ }, 1, function()
|
|
|
|
client.focus = c
|
|
|
|
c:raise()
|
|
|
|
awful.mouse.client.move(c)
|
|
|
|
end),
|
|
|
|
awful.button({ }, 3, function()
|
|
|
|
client.focus = c
|
|
|
|
c:raise()
|
|
|
|
awful.mouse.client.resize(c)
|
|
|
|
end)
|
|
|
|
)
|
|
|
|
|
|
|
|
awful.titlebar(c) : setup {
|
|
|
|
{ -- Left
|
|
|
|
awful.titlebar.widget.iconwidget(c),
|
|
|
|
buttons = buttons,
|
|
|
|
layout = wibox.layout.fixed.horizontal
|
|
|
|
},
|
|
|
|
{ -- Middle
|
|
|
|
{ -- Title
|
|
|
|
align = "center",
|
|
|
|
widget = awful.titlebar.widget.titlewidget(c)
|
2015-09-27 17:00:01 +02:00
|
|
|
},
|
2016-04-14 09:13:06 +02:00
|
|
|
buttons = buttons,
|
|
|
|
layout = wibox.layout.flex.horizontal
|
|
|
|
},
|
|
|
|
{ -- Right
|
|
|
|
awful.titlebar.widget.floatingbutton (c),
|
|
|
|
awful.titlebar.widget.maximizedbutton(c),
|
|
|
|
awful.titlebar.widget.stickybutton (c),
|
|
|
|
awful.titlebar.widget.ontopbutton (c),
|
|
|
|
awful.titlebar.widget.closebutton (c),
|
|
|
|
layout = wibox.layout.fixed.horizontal()
|
|
|
|
},
|
|
|
|
layout = wibox.layout.align.horizontal
|
|
|
|
}
|
2008-08-25 15:35:17 +02:00
|
|
|
end)
|
2009-08-21 16:08:38 +02:00
|
|
|
|
2014-03-23 19:48:07 +01:00
|
|
|
-- Enable sloppy focus
|
|
|
|
client.connect_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)
|
|
|
|
|
2009-10-09 20:39:55 +02:00
|
|
|
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
|
|
|
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
2008-05-20 15:39:47 +02:00
|
|
|
-- }}}
|