Update to last version of awesome
This commit is contained in:
parent
0fb3428db7
commit
4fdc19c55c
630
awesome/rc.lua
630
awesome/rc.lua
|
@ -1,19 +1,18 @@
|
|||
-- Standard awesome library
|
||||
local gears = require("gears")
|
||||
local awful = require("awful")
|
||||
awful.rules = require("awful.rules")
|
||||
require("awful.autofocus")
|
||||
-- Widget and layout library
|
||||
local wibox = require("wibox")
|
||||
-- Theme handling library
|
||||
local beautiful = require("beautiful")
|
||||
local vicious = require('vicious')
|
||||
-- Notification library
|
||||
naughty = require("naughty")
|
||||
local naughty = require("naughty")
|
||||
local menubar = require("menubar")
|
||||
local vicious = require("vicious")
|
||||
local options = require("options")
|
||||
local hotkeys_popup = require("awful.hotkeys_popup").widget
|
||||
|
||||
-- Custom imports
|
||||
local options = require("options")
|
||||
home = os.getenv('HOME')
|
||||
|
||||
os.execute('xset m 16/1 0')
|
||||
|
@ -49,7 +48,7 @@ do
|
|||
|
||||
naughty.notify({ preset = naughty.config.presets.critical,
|
||||
title = "Oops, an error happened!",
|
||||
text = err })
|
||||
text = tostring(err) })
|
||||
in_error = false
|
||||
end)
|
||||
end
|
||||
|
@ -59,37 +58,6 @@ end
|
|||
-- Themes define colours, icons, font and wallpapers.
|
||||
beautiful.init("~/.config/awesome/themes/default/theme.lua")
|
||||
|
||||
function file_exists(name)
|
||||
local f=io.open(name,"r")
|
||||
if f~=nil then io.close(f) return true else return false end
|
||||
end
|
||||
|
||||
function change_wallpaper(path, extension)
|
||||
path = home .. '/Pictures/Wallpapers/' .. path
|
||||
|
||||
-- if not file_exists(path) then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
theme.wallpaper = path
|
||||
|
||||
if beautiful.wallpaper then
|
||||
if screen.count() == 2 and file_exists(path..'-16-9.'..extension) and file_exists(path..'-4-3.'..extension) then
|
||||
gears.wallpaper.maximized(path .. '-16-9.' .. extension, 1, true)
|
||||
gears.wallpaper.maximized(path .. '-4-3.' .. extension, 2, true)
|
||||
elseif file_exists(path..'-16-9.'..extension) then
|
||||
for s = 1, screen.count() do
|
||||
gears.wallpaper.maximized(path .. '-16-9.' .. extension, s, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Widgets
|
||||
local volume = require("volume")
|
||||
local battery = require("battery")
|
||||
local calendar = require("calendar")
|
||||
|
||||
-- This is used later as the default terminal and editor to run.
|
||||
terminal = options.terminal
|
||||
editor = os.getenv("EDITOR") or "nano"
|
||||
|
@ -103,8 +71,7 @@ editor_cmd = terminal .. " -e " .. editor
|
|||
modkey = "Mod4"
|
||||
|
||||
-- Table of layouts to cover with awful.layout.inc, order matters.
|
||||
local layouts =
|
||||
{
|
||||
awful.layout.layouts = {
|
||||
awful.layout.suit.tile.left,
|
||||
awful.layout.suit.tile,
|
||||
awful.layout.suit.tile.bottom,
|
||||
|
@ -116,36 +83,37 @@ local layouts =
|
|||
awful.layout.suit.max,
|
||||
awful.layout.suit.max.fullscreen,
|
||||
awful.layout.suit.magnifier,
|
||||
awful.layout.suit.floating
|
||||
awful.layout.suit.corner.nw,
|
||||
-- awful.layout.suit.corner.ne,
|
||||
-- awful.layout.suit.corner.sw,
|
||||
-- awful.layout.suit.corner.se,
|
||||
awful.layout.suit.floating,
|
||||
}
|
||||
-- }}}
|
||||
|
||||
-- {{{ Wallpaper
|
||||
if beautiful.wallpaper then
|
||||
for s = 1, screen.count() do
|
||||
gears.wallpaper.maximized(beautiful.wallpaper, s, true)
|
||||
-- {{{ Helper functions
|
||||
local function client_menu_toggle_fn()
|
||||
local instance = nil
|
||||
|
||||
return function ()
|
||||
if instance and instance.wibox.visible then
|
||||
instance:hide()
|
||||
instance = nil
|
||||
else
|
||||
instance = awful.menu.clients({ theme = { width = 250 } })
|
||||
end
|
||||
end
|
||||
end
|
||||
change_wallpaper('arch2', 'png')
|
||||
|
||||
-- }}}
|
||||
|
||||
-- {{{ Tags
|
||||
-- Define a tag table which hold all screen tags.
|
||||
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, 0 }, s, layouts[1])
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Menu
|
||||
-- Create a laucher widget and a main menu
|
||||
-- Create a launcher widget and a main menu
|
||||
myawesomemenu = {
|
||||
{ "hotkeys", function() return false, hotkeys_popup.show_help end},
|
||||
{ "manual", terminal .. " -e man awesome" },
|
||||
{ "edit config", editor_cmd .. " " .. awesome.conffile },
|
||||
{ "restart", awesome.restart },
|
||||
{ "quit", awesome.quit }
|
||||
{ "quit", function() awesome.quit() end}
|
||||
}
|
||||
|
||||
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
|
||||
|
@ -160,24 +128,30 @@ mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
|
|||
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
||||
-- }}}
|
||||
|
||||
-- {{{ Wibox
|
||||
-- Create a textclock widget
|
||||
-- Keyboard map indicator and switcher
|
||||
mykeyboardlayout = awful.widget.keyboardlayout()
|
||||
|
||||
-- {{{ Wibar
|
||||
|
||||
-- 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),
|
||||
local taglist_buttons = awful.util.table.join(
|
||||
awful.button({ }, 1, function(t) t:view_only() end),
|
||||
awful.button({ modkey }, 1, function(t)
|
||||
if client.focus then
|
||||
client.focus:move_to_tag(t)
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 3, awful.tag.viewtoggle),
|
||||
awful.button({ modkey }, 3, awful.client.toggletag),
|
||||
awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
|
||||
awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
|
||||
awful.button({ modkey }, 3, function(t)
|
||||
if client.focus then
|
||||
client.focus:toggle_tag(t)
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
|
||||
awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
|
||||
)
|
||||
mytasklist = {}
|
||||
mytasklist.buttons = awful.util.table.join(
|
||||
|
||||
local tasklist_buttons = awful.util.table.join(
|
||||
awful.button({ }, 1, function (c)
|
||||
if c == client.focus then
|
||||
c.minimized = true
|
||||
|
@ -185,8 +159,8 @@ mytasklist.buttons = awful.util.table.join(
|
|||
-- Without this, the following
|
||||
-- :isvisible() makes no sense
|
||||
c.minimized = false
|
||||
if not c:isvisible() then
|
||||
awful.tag.viewonly(c:tags()[1])
|
||||
if not c:isvisible() and c.first_tag then
|
||||
c.first_tag:view_only()
|
||||
end
|
||||
-- This will also un-minimize
|
||||
-- the client, if needed
|
||||
|
@ -194,225 +168,263 @@ mytasklist.buttons = awful.util.table.join(
|
|||
c:raise()
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 3, function ()
|
||||
if instance then
|
||||
instance:hide()
|
||||
instance = nil
|
||||
else
|
||||
instance = awful.menu.clients({
|
||||
theme = { width = 250 }
|
||||
})
|
||||
end
|
||||
end),
|
||||
awful.button({ }, 3, client_menu_toggle_fn()),
|
||||
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))
|
||||
|
||||
-- Creation de quelques widgets
|
||||
delimiter = wibox.widget.textbox(" | ")
|
||||
local battery = require('battery')
|
||||
local volume = require('volume')
|
||||
local calendar = require('calendar')
|
||||
local delimiter = wibox.widget.textbox(" | ")
|
||||
|
||||
local function set_wallpaper(s)
|
||||
-- Wallpaper
|
||||
if beautiful.wallpaper then
|
||||
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)
|
||||
end
|
||||
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)
|
||||
|
||||
-- Each screen has its own tag table.
|
||||
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }, s, awful.layout.layouts[1])
|
||||
|
||||
for s = 1, screen.count() do
|
||||
-- Create a promptbox for each screen
|
||||
mypromptbox[s] = awful.widget.prompt()
|
||||
s.mypromptbox = awful.widget.prompt()
|
||||
-- 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)))
|
||||
s.mylayoutbox = awful.widget.layoutbox(s)
|
||||
s.mylayoutbox:buttons(awful.util.table.join(
|
||||
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)))
|
||||
-- Create a taglist widget
|
||||
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
|
||||
s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons)
|
||||
|
||||
-- Create a tasklist widget
|
||||
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
|
||||
s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons)
|
||||
|
||||
-- Create the wibox
|
||||
mywibox[s] = awful.wibox({ position = "top", screen = s })
|
||||
s.mywibox = awful.wibar({ position = "top", screen = s })
|
||||
|
||||
-- Widgets that are aligned to the left
|
||||
local left_layout = wibox.layout.fixed.horizontal()
|
||||
left_layout:add(mylauncher)
|
||||
left_layout:add(mytaglist[s])
|
||||
left_layout:add(mypromptbox[s])
|
||||
|
||||
-- Widgets that are aligned to the right
|
||||
local right_layout = wibox.layout.fixed.horizontal()
|
||||
if s == 1 then right_layout:add(wibox.widget.systray()) end
|
||||
|
||||
right_layout:add(delimiter)
|
||||
right_layout:add(volume_widget)
|
||||
right_layout:add(delimiter)
|
||||
right_layout:add(battery_widget)
|
||||
right_layout:add(delimiter)
|
||||
right_layout:add(textclock_widget)
|
||||
right_layout:add(mylayoutbox[s])
|
||||
|
||||
-- Now bring it all together (with the tasklist in the middle)
|
||||
local layout = wibox.layout.align.horizontal()
|
||||
layout:set_left(left_layout)
|
||||
layout:set_middle(mytasklist[s])
|
||||
layout:set_right(right_layout)
|
||||
|
||||
mywibox[s]:set_widget(layout)
|
||||
end
|
||||
-- Add widgets to the wibox
|
||||
s.mywibox:setup {
|
||||
layout = wibox.layout.align.horizontal,
|
||||
{ -- Left widgets
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
mylauncher,
|
||||
s.mytaglist,
|
||||
s.mypromptbox,
|
||||
},
|
||||
s.mytasklist, -- Middle widget
|
||||
{ -- Right widgets
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
delimiter,
|
||||
volume_widget,
|
||||
delimiter,
|
||||
battery_widget,
|
||||
delimiter,
|
||||
mykeyboardlayout,
|
||||
wibox.widget.systray(),
|
||||
textclock_widget,
|
||||
s.mylayoutbox,
|
||||
},
|
||||
}
|
||||
end)
|
||||
-- }}}
|
||||
|
||||
-- {{{ 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)
|
||||
-- ))
|
||||
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(
|
||||
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, }, "s", hotkeys_popup.show_help,
|
||||
{description="show help", group="awesome"}),
|
||||
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"}),
|
||||
|
||||
awful.key({ modkey, }, "j",
|
||||
function ()
|
||||
awful.client.focus.byidx( 1)
|
||||
if client.focus then client.focus:raise() end
|
||||
end),
|
||||
end,
|
||||
{description = "focus next by index", group = "client"}
|
||||
),
|
||||
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() end),
|
||||
end,
|
||||
{description = "focus previous by index", group = "client"}
|
||||
),
|
||||
awful.key({ modkey, }, "w", function () mymainmenu:show() end,
|
||||
{description = "show main menu", group = "awesome"}),
|
||||
|
||||
-- Layout manipulation
|
||||
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
|
||||
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
|
||||
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
|
||||
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
|
||||
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
|
||||
|
||||
-- modkey + Tab gets the next client
|
||||
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"}),
|
||||
awful.key({ modkey, }, "Tab",
|
||||
function ()
|
||||
awful.client.focus.byidx( 1)
|
||||
if client.focus then client.focus:raise() end
|
||||
end),
|
||||
|
||||
-- modkey + Tab gets the previous focused client
|
||||
-- awful.key({ modkey, }, "Tab",
|
||||
-- function ()
|
||||
-- awful.client.focus.history.previous()
|
||||
-- if client.focus then
|
||||
-- client.focus:raise()
|
||||
-- end
|
||||
-- end),
|
||||
awful.client.focus.history.previous()
|
||||
if client.focus then
|
||||
client.focus:raise()
|
||||
end
|
||||
end,
|
||||
{description = "go back", group = "client"}),
|
||||
|
||||
-- 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, }, "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),
|
||||
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, }, "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"}),
|
||||
|
||||
awful.key({ modkey, "Control" }, "n", awful.client.restore),
|
||||
awful.key({ modkey, "Control" }, "n",
|
||||
function ()
|
||||
local c = awful.client.restore()
|
||||
-- Focus restored client
|
||||
if c then
|
||||
client.focus = c
|
||||
c:raise()
|
||||
end
|
||||
end,
|
||||
{description = "restore minimized", group = "client"}),
|
||||
|
||||
-- Prompt
|
||||
awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
|
||||
awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
|
||||
{description = "run prompt", group = "launcher"}),
|
||||
|
||||
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),
|
||||
awful.prompt.run {
|
||||
prompt = "Run Lua code: ",
|
||||
textbox = awful.screen.focused().mypromptbox.widget,
|
||||
exe_callback = awful.util.eval,
|
||||
history_path = awful.util.get_cache_dir() .. "/history_eval"
|
||||
}
|
||||
end,
|
||||
{description = "lua execute prompt", group = "awesome"}),
|
||||
-- Menubar
|
||||
awful.key({ modkey }, "p", function() menubar.show() end),
|
||||
|
||||
awful.key({ }, "XF86PowerOff", function()
|
||||
_,_,return_code = os.execute('ask-for-stop&');
|
||||
|
||||
end),
|
||||
|
||||
-- Volume keys
|
||||
awful.key({ }, "XF86AudioRaiseVolume",
|
||||
function ()
|
||||
awful.key({ modkey }, "p", function() menubar.show() end,
|
||||
{description = "show the menubar", group = "launcher"}),
|
||||
|
||||
-- Custom shortcuts
|
||||
awful.key({ }, "XF86AudioRaiseVolume", function()
|
||||
awful.util.spawn("amixer set Master 3%+", false)
|
||||
update_volume()
|
||||
end, {description = "increase the volume by 3%", group="custom"}),
|
||||
|
||||
end),
|
||||
|
||||
awful.key({ }, "XF86AudioLowerVolume",
|
||||
function ()
|
||||
awful.key({ }, "XF86AudioLowerVolume", function()
|
||||
awful.util.spawn("amixer set Master 3%-", false)
|
||||
update_volume()
|
||||
end),
|
||||
end, {description = "decrease the volume by 3%", group="custom"}),
|
||||
|
||||
awful.key({ }, "XF86AudioMute",
|
||||
function ()
|
||||
-- end
|
||||
awful.key({ }, "XF86AudioMute", function()
|
||||
awful.util.spawn("amixer set Master toggle", false)
|
||||
update_volume()
|
||||
end),
|
||||
end, {description = "mute sound", group="custom"}),
|
||||
|
||||
awful.key({ }, "XF86MonBrightnessDown", function ()
|
||||
awful.util.spawn("xbacklight -dec 5") end),
|
||||
awful.key({ }, "XF86MonBrightnessUp", function ()
|
||||
awful.util.spawn("xbacklight -inc 5") end),
|
||||
awful.util.spawn("xbacklight -dec 5")
|
||||
end, {description = "decrease brightness", group="custom"}),
|
||||
|
||||
awful.key({ }, "XF86MonBrightnessUp", function ()
|
||||
awful.util.spawn("xbacklight -inc 5")
|
||||
end, {description = "increase brightness", group="custom"}),
|
||||
|
||||
-- Print screen keys
|
||||
awful.key({ }, "Print", function ()
|
||||
os.execute('gnome-screenshot -fp "`echo -n ' .. home .. '"/Pictures/Captures/Capture du " && date "+%Y-%m-%d %H:%M:%S"`.png"')
|
||||
end),
|
||||
end, {description = "capture the screen", group="custom"}),
|
||||
|
||||
-- Chromium
|
||||
awful.key({ }, "XF86HomePage", function () os.execute('$BROWSER &') end),
|
||||
awful.key({ modkey}, "a", function () os.execute(options.browser .. '&')
|
||||
naughty.notify({
|
||||
title = options.browser .. " starting...",
|
||||
text = awesome.startup_errors })
|
||||
end
|
||||
),
|
||||
awful.key({modkey}, "a", function ()
|
||||
os.execute(options.browser .. '&')
|
||||
naughty.notify({title = options.browser .. " starting..."})
|
||||
end, {description="start the web browser", group="custom"}),
|
||||
|
||||
awful.key({modkey, "Shift"}, "Tab", function() os.execute('xdotool key Caps_Lock') end)
|
||||
awful.key({modkey, "Shift"}, "Tab", function()
|
||||
os.execute('xdotool key Caps_Lock')
|
||||
end, {description="switch the caps lock", group="custom"})
|
||||
)
|
||||
|
||||
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" }, "t", function(c) c.sticky = not c.sticky end),
|
||||
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
|
||||
awful.key({ modkey, }, "o", awful.client.movetoscreen ),
|
||||
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
|
||||
awful.key({ modkey, }, "f",
|
||||
function (c)
|
||||
c.fullscreen = not c.fullscreen
|
||||
c:raise()
|
||||
end,
|
||||
{description = "toggle fullscreen", group = "client"}),
|
||||
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"}),
|
||||
awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
|
||||
{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"}),
|
||||
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
|
||||
end),
|
||||
end ,
|
||||
{description = "minimize", group = "client"}),
|
||||
awful.key({ modkey, }, "m",
|
||||
function (c)
|
||||
c.maximized_horizontal = not c.maximized_horizontal
|
||||
c.maximized_vertical = not c.maximized_vertical
|
||||
end),
|
||||
awful.key({modkey, }, "F2", function () awful.screen.focus(1) end),
|
||||
awful.key({modkey, }, "F1", function () awful.screen.focus(2) end)
|
||||
)
|
||||
c.maximized = not c.maximized
|
||||
c:raise()
|
||||
end ,
|
||||
{description = "maximize", group = "client"})
|
||||
)
|
||||
|
||||
-- Bind all key numbers to tags.
|
||||
-- Be careful: we use keycodes to make it works on any keyboard layout.
|
||||
|
@ -422,43 +434,48 @@ for i = 1, 10 do
|
|||
-- View tag only.
|
||||
awful.key({ modkey }, "#" .. i + 9,
|
||||
function ()
|
||||
local screen = mouse.screen
|
||||
local tag = awful.tag.gettags(screen)[i]
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
awful.tag.viewonly(tag)
|
||||
tag:view_only()
|
||||
end
|
||||
end),
|
||||
-- Toggle tag.
|
||||
end,
|
||||
{description = "view tag #"..i, group = "tag"}),
|
||||
-- Toggle tag display.
|
||||
awful.key({ modkey, "Control" }, "#" .. i + 9,
|
||||
function ()
|
||||
local screen = mouse.screen
|
||||
local tag = awful.tag.gettags(screen)[i]
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
awful.tag.viewtoggle(tag)
|
||||
end
|
||||
end),
|
||||
end,
|
||||
{description = "toggle tag #" .. i, group = "tag"}),
|
||||
-- Move client to tag.
|
||||
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])
|
||||
local screen = mouse.screen
|
||||
if tags[screen][i] then
|
||||
awful.tag.viewonly(tags[screen][i])
|
||||
if client.focus then
|
||||
local tag = client.focus.screen.tags[i]
|
||||
if tag then
|
||||
client.focus:move_to_tag(tag)
|
||||
tag:view_only()
|
||||
end
|
||||
end
|
||||
end),
|
||||
-- Toggle tag.
|
||||
end,
|
||||
{description = "move focused client to tag #"..i, group = "tag"}),
|
||||
-- Toggle tag on focused client.
|
||||
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
|
||||
function ()
|
||||
if client.focus then
|
||||
local tag = awful.tag.gettags(client.focus.screen)[i]
|
||||
local tag = client.focus.screen.tags[i]
|
||||
if tag then
|
||||
awful.client.toggletag(tag)
|
||||
client.focus:toggle_tag(tag)
|
||||
end
|
||||
end
|
||||
end))
|
||||
end
|
||||
end,
|
||||
{description = "toggle focused client on tag #" .. i, group = "tag"})
|
||||
)
|
||||
end
|
||||
|
||||
clientbuttons = awful.util.table.join(
|
||||
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
|
||||
|
@ -479,45 +496,66 @@ awful.rules.rules = {
|
|||
focus = awful.client.focus.filter,
|
||||
raise = true,
|
||||
keys = clientkeys,
|
||||
buttons = clientbuttons
|
||||
} },
|
||||
{ rule = { class = "MPlayer" },
|
||||
properties = { floating = true } },
|
||||
{ rule = { class = "pinentry" },
|
||||
properties = { floating = true } },
|
||||
{ rule = { class = "gimp" },
|
||||
properties = { floating = true } },
|
||||
-- Set Firefox to always map on tags number 2 of screen 1.
|
||||
buttons = clientbuttons,
|
||||
screen = awful.screen.preferred,
|
||||
placement = awful.placement.no_overlap+awful.placement.no_offscreen
|
||||
}
|
||||
},
|
||||
|
||||
-- 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 }},
|
||||
|
||||
-- Add titlebars to normal clients and dialogs
|
||||
{ rule_any = {type = { "normal", "dialog" }
|
||||
}, properties = { titlebars_enabled = false }
|
||||
},
|
||||
|
||||
-- Set Firefox to always map on the tag named "2" on screen 1.
|
||||
-- { rule = { class = "Firefox" },
|
||||
-- properties = { tag = tags[1][2] } },
|
||||
-- properties = { screen = 1, tag = "2" } },
|
||||
}
|
||||
-- }}}
|
||||
|
||||
-- {{{ Signals
|
||||
-- Signal function to execute when a new client appears.
|
||||
client.connect_signal("manage", function (c, startup)
|
||||
-- Enable sloppy focus
|
||||
c: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)
|
||||
|
||||
if not startup then
|
||||
client.connect_signal("manage", function (c)
|
||||
-- Set the windows at the slave,
|
||||
-- i.e. put it at the end of others instead of setting it master.
|
||||
-- awful.client.setslave(c)
|
||||
-- if not awesome.startup then awful.client.setslave(c) end
|
||||
|
||||
-- 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)
|
||||
if awesome.startup and
|
||||
not c.size_hints.user_position
|
||||
and not c.size_hints.program_position then
|
||||
-- Prevent clients from being unreachable after screen count changes.
|
||||
awful.placement.no_offscreen(c)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local titlebars_enabled = false
|
||||
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
|
||||
-- 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()
|
||||
|
@ -532,38 +570,40 @@ client.connect_signal("manage", function (c, startup)
|
|||
end)
|
||||
)
|
||||
|
||||
-- Widgets that are aligned to the left
|
||||
local left_layout = wibox.layout.fixed.horizontal()
|
||||
left_layout:add(awful.titlebar.widget.iconwidget(c))
|
||||
left_layout:buttons(buttons)
|
||||
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)
|
||||
},
|
||||
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
|
||||
}
|
||||
end)
|
||||
|
||||
-- Widgets that are aligned to the right
|
||||
local right_layout = wibox.layout.fixed.horizontal()
|
||||
right_layout:add(awful.titlebar.widget.floatingbutton(c))
|
||||
right_layout:add(awful.titlebar.widget.maximizedbutton(c))
|
||||
right_layout:add(awful.titlebar.widget.stickybutton(c))
|
||||
right_layout:add(awful.titlebar.widget.ontopbutton(c))
|
||||
right_layout:add(awful.titlebar.widget.closebutton(c))
|
||||
|
||||
-- The title goes in the middle
|
||||
local middle_layout = wibox.layout.flex.horizontal()
|
||||
local title = awful.titlebar.widget.titlewidget(c)
|
||||
title:set_align("center")
|
||||
middle_layout:add(title)
|
||||
middle_layout:buttons(buttons)
|
||||
|
||||
-- Now bring it all together
|
||||
local layout = wibox.layout.align.horizontal()
|
||||
layout:set_left(left_layout)
|
||||
layout:set_right(right_layout)
|
||||
layout:set_middle(middle_layout)
|
||||
|
||||
awful.titlebar(c):set_widget(layout)
|
||||
-- Enable sloppy focus, so that focus follows mouse.
|
||||
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)
|
||||
|
||||
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)
|
||||
-- }}}
|
||||
|
||||
os.execute('resetusb&')
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
-- Default awesome theme --
|
||||
---------------------------
|
||||
|
||||
theme = {}
|
||||
local theme = {}
|
||||
|
||||
theme.font = "sans 8"
|
||||
|
||||
|
@ -17,6 +17,7 @@ theme.fg_focus = "#ffffff"
|
|||
theme.fg_urgent = "#ffffff"
|
||||
theme.fg_minimize = "#ffffff"
|
||||
|
||||
theme.useless_gap = 0
|
||||
theme.border_width = 1
|
||||
theme.border_normal = "#39404b"
|
||||
theme.border_focus = "#6d7a8d"
|
||||
|
|
Loading…
Reference in New Issue