-- Standard awesome library local gears = require("gears") local awful = require("awful") require("awful.autofocus") -- Widget and layout library local wibox = require("wibox") -- Theme handling library local beautiful = require("beautiful") -- Notification library local naughty = require("naughty") local vicious = require("vicious") local menubar = require("menubar") awful.screen = require("awful.screen") local hotkeys = require("awful.hotkeys_popup") local hotkeys_popup = require("awful.hotkeys_popup").widget -- Lain local lain = require("lain") -- {{{ 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 -- 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!", text = err }) in_error = false end) end -- }}} -- {{{ Variable definitions -- Themes define colours, icons, and wallpapers beautiful.init(os.getenv("HOME") .. "/.config/awesome/themes/customII/theme.lua") -- This is used later as the default terminal and editor to run. terminal = "roxterm" editor = os.getenv("EDITOR") or "vim" editor_cmd = terminal .. " -e " .. editor -- 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" -- Table of layouts to cover with awful.layout.inc, order matters. awful.layout.layouts = { lain.layout.uselessfairnogap, --3 awful.layout.suit.tile, --1 lain.layout.uselesspiral, --2 } -- }}} -- {{{ Wallpaper if beautiful.wallpaper then for s = 1, screen.count() do gears.wallpaper.maximized(beautiful.wallpaper, s, true) end end -- }}} awful.screen.connect_for_each_screen(function(s) awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) 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))) end) -- {{{ Menu -- Create a laucher widget and a main menu myawesomemenu = { { "manual", terminal .. " -e man awesome" }, { "edit config", editor_cmd .. " " .. awesome.conffile }, { "restart", awesome.restart }, { "quit", awesome.quit } } mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, { "firefox", function () awful.util.spawn("firefox") end}, { "open terminal", terminal } } }) mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu }) -- Menubar configuration menubar.utils.terminal = terminal -- Set the terminal for applications that require it -- }}} -- {{{ Wibox -- Create a textclock widget mytextclock = awful.widget.textclock(" %H:%M") markup = lain.util.markup -- Calendar lain.widgets.calendar:attach(mytextclock) -- CPU cpuwidget = lain.widgets.cpu({ settings = function() int_cpu_usage = tonumber(cpu_now.usage) widget:set_markup(markup("#cb66cb", "") .. cpu_now.usage .. "%") end }) -- MPD -- mpdwidget = lain.widgets.mpd() mpdwidget = wibox.widget.textbox() -- Register widget vicious.register(mpdwidget, vicious.widgets.mpd, function (mpdwidget, args) if args["{state}"] == "Stop" then return "" else if not (args["{Artist}"] == 'N/A') then if not (args["{Title}"] == 'N/A') then return markup.bold(args["{Artist}"]..' - '.. args["{Title}"]) .. " / " else return markup.bold(args["{Artist}"] ) .. " / " end else if not (args["{Title}"] == 'N/A') then return markup.bold(args["{Title}"]) .. " / " end return '' end end end, 10) -- MEM memwidget = lain.widgets.mem({ settings = function() int_mem_now_used = tonumber(mem_now.used) widget:set_markup(markup.fg.color("#dda", mem_now.used .. "M")) end }) -- ALSA volume volumewidget = lain.widgets.alsa({ settings = function() header = " " int_volume_level = tonumber(volume_now.level) if int_volume_level == 100 then vlevel = "MX" elseif int_volume_level == 0 then vlevel = "MM" else vlevel = volume_now.level end if volume_now.status == "off" then vlevel = vlevel .. "#" else vlevel = vlevel .. "%" end widget:set_markup(markup.fg.color("#ccaacc", vlevel)) end }) -- Separators first = wibox.widget.textbox(markup.font("Terminus 4", " ")) spr = wibox.widget.textbox(' ⌁ ') myemailwidget = wibox.widget.textbox() mybatwidget = wibox.widget.textbox ('') mynetworkwidget = wibox.widget.textbox ('') notify_bat = true local lastIp = '' local lastInt = '' function act() vicious.force({ mpdwidget, }) --{{ Batterie notification awful.spawn.easy_async("bash -c \"acpi | cut -d' ' -f3 \"", function(stdout, stderr, reason, exit_code) if stdout == "Discharging,\n" then awful.spawn.easy_async("bash -c \"acpi | cut -d',' -f2 \"", function(percent, stderr, reason, exit_code) a,b = string.find( percent, "%%") nPercent = tonumber(string.sub(percent,2,a-1)) if nPercent > 30 then mybatwidget:set_markup_silently( markup("#19DF1D", "🔋") .. string.sub(percent, 1, a+1)) elseif nPercent > 10 then mybatwidget:set_markup_silently( markup("#E28126", "🔋") .. string.sub(percent, 1, a+1)) else mybatwidget:set_markup_silently( markup("#E61E1E", "🔋") .. string.sub(percent, 1, a+1)) end if notify_bat then -- str = awful.util.shell("acpi | cut -d',' -f2") if percent == " 21%\n" or percent == " 20%\n" then naughty.notify({ preset = naughty.config.presets.critical, title = "Niveau de batterie", text = "Niveau de batterie inquiétant." .. "Pensez à trouver une prise" }) end if percent == " 8%\n" or percent == " 9%\n" or percent == " 10%\n" then naughty.notify({ preset = naughty.config.presets.critical, title = "Alerte niveau de batterie", text = "Niveau de batterie faible," .. "pensez à charger le portable" }) end if percent == " 4%\n" or percent == " 5%\n" then naughty.notify({ preset = naughty.config.presets.critical, title = "Attention niveau batterie critique !", text = "Plus que quelque minutes avant un manque d'energie." .. "Pensez à sauvegarder." }) end end end) else awful.spawn.easy_async("bash -c \"acpi | cut -d',' -f2 \"", function(percent, stderr, reason, exit_code) a,b = string.find( percent, "%%") if a then mybatwidget:set_text ("🔌" .. string.sub(percent, 1, a+1)) end end) end end) --{{ Network awful.spawn.easy_async("bash -c \"ip r | grep default | head -n 1 | sed s/.*dev/sed/ | cut -d' ' -f 2\"", function(interface, stderr, reason, exit_code) if not ( interface == "" or interface == "\n") then interface = string.gsub(interface, "\n", "") if not (interface == lastInt) then naughty.notify({ preset = naughty.config.presets.normal, title = "ip change", text = "Changement d'interface " .. lastInt .. " to " .. interface, timeout=20}) lastInt = interface end awful.spawn.easy_async("bash -c \"ip r | grep 'dev " .. interface .. "' | grep src | head -n 1 | sed 's/.*src/src/' | cut -d' ' -f 2 | cut -z -f1\"", function(ip, stderr2, reason3, exit_code3) toShow = "" if not ( ip == "" or ip == "\n") then ip = string.gsub(ip, "\n", "") toShow = ip .. "@" if not (ip == lastIp) then naughty.notify({ preset = naughty.config.presets.normal, title = "ip route", text = "Changement de route " .. lastIp .. " to " .. ip, timeout=20}) lastIp = ip end end awful.spawn.easy_async("bash -c \"iwconfig " .. interface .. " 2>&1 | grep -v 'no wireless' | grep " .. interface .. " | cut -d'\\\"' -f 2 \"", function(essid, stderr2, reason2, exit_code2) if not (essid == "" ) then essid = string.gsub(essid, "\n", "") awful.spawn.easy_async("bash -c \"iwconfig " .. interface .. " 2>&1 | grep -v 'no wireless' | grep Signal | cut -d'=' -f 3 | cut -d' ' -f 1\"", function(signal, stderr3, reason3, exit_code3) signal = string.gsub(signal, "\n", "") mynetworkwidget:set_text ( ip .. "@" .. essid .. "#" .. signal) end ) else mynetworkwidget:set_text ( toShow .. interface ) end end ) end ) else mynetworkwidget:set_markup( "ip" ) end end ) --{{ E-mail notification awful.spawn.easy_async( "bash -c \"which hasMail > /dev/null 2>&1 && hasMail\"", function(res, stderr, reason, exit_code) if res == "0\n" then myemailwidget:set_text ( "" ) elseif res == "" then myemailwidget:set_text ( "☠" ) else myemailwidget:set_text ( "📧" ) naughty.notify({ preset = naughty.config.presets.normal, title = "T'as un email", text = string.gsub(res, "\n", "") .. " new mails !" }) end end) end act() mytimer = timer { timeout = 60 } mytimer:connect_signal("timeout", function() act() end) -- Create a wibox for each screen and add it mywibox = {} mypromptbox = {} 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, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end), awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end) ) mytasklist = {} mytasklist.buttons = awful.util.table.join( awful.button({ }, 1, function (c) if c == client.focus then c.minimized = true else -- Without this, the following -- :isvisible() makes no sense c.minimized = false if not c:isvisible() then awful.tag.viewonly(c:tags()[1]) end -- This will also un-minimize -- the client, if needed client.focus = c c:raise() end 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() screen[s].mypromptbox = mypromptbox[s] -- Create a taglist widget mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons) -- Create a tasklist widget mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) -- Create the wibox mywibox[s] = awful.wibox({ position = "top", screen = s }) mywibox[s].visible = true -- 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(spr) right_layout:add(mpdwidget) right_layout:add(mynetworkwidget) right_layout:add(spr) right_layout:add(cpuwidget) right_layout:add(spr) right_layout:add(memwidget) right_layout:add(spr) right_layout:add(volumewidget) right_layout:add(spr) right_layout:add(mybatwidget) right_layout:add(spr) right_layout:add(myemailwidget) right_layout:add(mytextclock) mytimer:start() -- 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 -- }}} wp_timer = timer { timeout = 15 } wp_timer:connect_signal("timeout", function() showHideWibox() end) blockWibox = true function showHideWibox() if not blockWibox then for s = 1, screen.count() do mywibox[s].visible = not mywibox[s].visible end if mywibox[1].visible then wp_timer:start() else wp_timer:stop() end end end function showHide() end local rule_any2 = {class={"Weechat", "weechat"}} for group_name, group_data in pairs({ ["Weechat"] = { color="#659FdF", rule_any=urxvt_rule_any}, ["Vim"] = { color="#C59FdF", rule_any=urxvt_rule_any} }) do hotkeys_popup.group_rules[group_name] = group_data end local own_rule_any = { ["Weechat"] = { { modifiers = { "Alt" }, keys = { Left = "Tampon précédent" } }, { modifiers = {"Alt"}, keys = { Right = "Tampon suivant" } }, { modifiers = {"F7"}, keys = { v = "Fenêtre précédente" } }, { modifiers = {"F8"}, keys = { v = "Fenêtre suivante" } }, { modifiers = {"F11"}, keys = { v = "Pseudo précédente" } }, { modifiers = {"F12"}, keys = { v = "Pseudo suivant" } }, { modifiers = {"Alt"}, keys = { a = "Sauter au " } } }, ["Vim"] = { { modifiers = {"z"}, keys = { R = "Open every", M = "Fold every", a = "Toogle fold", A = "Toogle recursively" } } } } hotkeys_popup.add_hotkeys(own_rule_any) layoutKkb = 1 -- {{{ Key bindings globalkeys = awful.util.table.join( awful.key({ modkey, "Shift" }, "s", hotkeys_popup.show_help, {description="Show help", group="awesome"}), awful.key({ modkey, }, "Escape", awful.tag.history.restore --[[, {description = "go back", group = "tag"} --]]), -- Layout manipulation 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, }, "u", awful.client.urgent.jumpto, {description = "Jump to urgent client", group = "client"}), -- Raccourcis perso awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("pamixer -i 8") end), awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("pamixer -d 8") end), awful.key({ }, "XF86AudioMute", function () awful.util.spawn("pamixer -t") end), awful.key({ }, "F12", function () awful.util.spawn("pamixer -i 8") end), awful.key({ }, "F10", function () awful.util.spawn("pamixer -d 8") end), awful.key({ }, "F11", function () awful.util.spawn("pamixer -t") end), awful.key({ }, "XF86AudioPlay", function () awful.util.spawn("mpc toggle") end), awful.key({ }, "XF86AudioNext", function () awful.util.spawn("mpc next") end), awful.key({ }, "XF86AudioPrev", function () awful.util.spawn("mpc prev") end), awful.key({ "Control" }, "F11", function () awful.util.spawn("mpc toggle") end), awful.key({ "Control" }, "F12", function () awful.util.spawn("mpc next") end), awful.key({ "Control" }, "F10", function () awful.util.spawn("mpc prev") end), awful.key({ modkey}, "F1", function () awful.util.spawn("roxterm -e bash -c \"systemctl --user start mpd;mpc random on;mpc repeat on;ncmpcpp\"") end, {description = "MPD", group = "awesome"}), awful.key({ modkey}, "F2", function () awful.util.spawn("roxterm -e fish -c mutt") end, {description = "mutt", group = "awesome"}), awful.key({ modkey, "Mod1"}, "f", function () awful.util.spawn("firefox") end, {description = "Firefox", group = "awesome"}), -- awful.key({ modkey, }, "b", function () awful.util.spawn("vimb -c /usr/share/vimb/.vimbrc") end), awful.key({ modkey, "Mod1"}, "r", function () awful.util.spawn_with_shell("xterm -ti vt340 -e 'ranger'") end, {description = "Ranger", group = "awesome"}), awful.key({ modkey, "Control"}, "r", function () awful.util.spawn("pcmanfm") end), awful.key({ modkey, }, "s", function () awful.util.spawn("scrot") naughty.notify({ title = 'Scrot', text = 'New screenshot taken', timeout = 3 }) end, {description = "Screenshot", group = "awesome"}), awful.key({ modkey, "Control" }, "s", function () awful.util.spawn("scrot -u") naughty.notify({ title = 'Scrot', text = 'Use the mouse to make a screenshot', timeout = 2 }) end, {description = "Screenshot selection", group = "awesome"}), awful.key({ modkey, }, "Left", awful.tag.viewprev, {description = "Previous", group = "tag"}), awful.key({ modkey, }, "Right", awful.tag.viewnext, {description = "Next", group = "tag"}), awful.key({ modkey, "Control" }, "Left", function() awful.screen.focus_relative(-1) end, {description = "Next screen", group = "awesome"}), awful.key({ modkey, "Control" }, "Right", function() awful.screen.focus_relative( 1) end, {description = "Previous screen", group = "awesome"}), awful.key({ modkey, }, "Escape", awful.tag.history.restore), awful.key({ modkey, }, "Tab", function () awful.client.focus.byidx( 1) if client.focus then client.focus:raise() end end, {description = "Next client", group = "client"}), awful.key({ modkey, "Shift" }, "Tab", function () awful.client.focus.byidx(-1) if client.focus then client.focus:raise() end end,{description = "Previous client", group = "client"}), awful.key({ modkey, }, "w", function () awful.util.spawn("autoWall") end, {description = "Switch wallpaper", group = "awesome"}), awful.key({ modkey, "Control" }, "w", function () act() end, {description = "Actualise Wibox", group = "awesome"}), awful.key({ modkey, "Shift" }, "w", function () awful.util.spawn("passmenu --type") end, {description = "Passwd promt", group = "awesome"}), awful.key({ modkey, "Control" }, "x", function () awful.util.spawn("loock") end, {description = "Lock screen", group = "awesome"}), -- Layout manipulation awful.key({ modkey, "Mod1" }, "k", function () awful.util.spawn("xkill") end, {description = "xkill", group = "awesome"}), 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), -- Standard program awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end, {description = "new term", group = "awesome"}), awful.key({ modkey, "Shift" }, "r", awesome.restart, {description = "restart", group = "awesome"}), awful.key({ modkey, "Shift" }, "q", awesome.quit,{description = "quit", 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, }, "j", function () awful.client.incwfact( 0.05) end), awful.key({ modkey, }, "k", function () awful.client.incwfact(-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(1) naughty.notify({ title = 'Layout', text = awful.layout.getname(), timeout = 1 }) end, {description = "Next layout", group = "client"}), awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) naughty.notify({ title = 'Layout', text = awful.layout.getname(), timeout = 1 }) end, {description = "Previous layout", group = "client"}), -- ## TODO : Add a description for it awful.key({ modkey, "Mod1" }, "Right", function () awful.tag.incmwfact( 0.01) end), awful.key({ modkey, "Mod1" }, "Left", function () awful.tag.incmwfact(-0.01) end), awful.key({ modkey, "Mod1" }, "Down", function () awful.client.incwfact( 0.01) end), awful.key({ modkey, "Mod1" }, "Up", function () awful.client.incwfact(-0.01) end), --~ awful.key({ modkey, "Control" }, "n", awful.client.restore), awful.key({ modkey, }, "t", function () showHideWibox() end, {description = "Toogle Wibox", group = "awesome"}), awful.key({ modkey, "Shift" }, "t", function () blockWibox = not blockWibox end, {description = "Lock Wibox", group = "awesome"}), awful.key({ modkey, "Shift" }, "b", function () notify_bat = not notify_bat naughty.notify({ preset = naughty.config.presets.normal, timeout=1, text = "Notification d'énergie : " .. ( notify_bat and "activée" or "désactivée" )}) end, {description = "Toggle battery warning", group = "awesome"}), awful.key({ modkey, "Control" }, "t", function () showHideWibox() end), -- Prompt -- 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: ", textbox = awful.screen.focused().mypromptbox.widget, exe_callback = awful.util.eval, history_path = awful.util.get_cache_dir() .. "/history_eval" } ]] awful.util.spawn("rofi -show run -modi run") end,{description = "Run rofi prompt", group = "awesome"}), -- Menubar awful.key({ modkey }, "p", function() local list=client.get() for k, c in pairs(list) do -- Without this, the following -- :isvisible() makes no sense c.minimized = false if not c:isvisible() and ok then awful.tag.viewonly(c:tags()[1]) end -- This will also un-minimize -- the client, if needed client.focus = c c:raise() end end) ) -- Simple function to move the mouse to the coordinates set above. local function moveMouse(x_co, y_co) mouse.coords({ x=x_co, y=y_co }) end clientkeys = awful.util.table.join( awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end, {description = "Set active client fullscreen", group = "client"}), awful.key({ modkey, }, "c", function (c) c:kill() end), awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle, {description = "Set floating layout", group = "client"}), awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end), awful.key({ modkey, }, "o", awful.client.movetoscreen ), 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. local A, B A=mouse.coords()["x"] B=mouse.coords()["y"] mouse.coords({ x=0, y=0 }) c.minimized=true mouse.coords({ x=A, y=B }) end, {description = "Set minimized", group = "client"}), awful.key({ modkey, "Control" }, "p", function () menubar.show() end, {description = "Maximize all clients", group = "awesome"}), -- all minimized clients are restored awful.key({ modkey, }, "b", function() for c in awful.client.iterate(function (x) x:raise() return true end) do c.minimized=false end end), awful.key({ modkey, }, "d", function (c) c.floating = not c.floating end, {description = "Set floating", group = "client"}), awful.key({ modkey, }, "m", function (c) c.maximized = not c.maximized -- Alternative : -- c.maximized_horizontal = not c.maximized_horizontal -- c.maximized_vertical = not c.maximized_vertical end, {description = "Set maximized", group = "client"}), awful.key({ modkey, "Control" }, "m", function (c) if c == client.focus then c.minimized = true else -- Without this, the following -- :isvisible() makes no sense c.minimized = false end end), awful.key({ modkey, "Control" }, "Menu", function (c) if layoutKbd == 1 then layoutKbd = 2 awful.util.spawn_with_shell("setxkbmap us") else if layoutKbd == 2 then layoutKbd = 3 awful.util.spawn_with_shell("setxkbmap dvorak") else if layoutKbd == 3 then awful.util.spawn_with_shell("setxkbmap fr bepo") layoutKbd = 4 -- else if layoutKbd == 4 then -- layoutKbd = 5 -- awful.util.spawn_with_shell("setxkbmap dvorak fr") else layoutKbd = 1 awful.util.spawn_with_shell("setxkbmap fr") end end end end,{description = "Switch keboard layout", group = "awesome"}) ) -- {{{ 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 -- 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 local titlebars_enabled = false if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then -- 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) ) -- 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) -- 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) end end) -- }}} for i = 1, 9 do globalkeys = awful.util.table.join(globalkeys, -- View tag only. awful.key({ modkey }, "#" .. i + 9, function () local screen = awful.screen.focused() local tag = screen.tags[i] if tag then tag:view_only() end end --[[, {description = "view tag #"..i, group = "tag"}--]]), -- Toggle tag display. awful.key({ modkey, "Control" }, "#" .. i + 9, function () local screen = awful.screen.focused() local tag = screen.tags[i] if tag then awful.tag.viewtoggle(tag) end end --[[, {description = "toggle tag #" .. i, group = "tag"}--]]), -- Move client to tag. awful.key({ modkey, "Shift" }, "#" .. i + 9, function () if client.focus then local tag = client.focus.screen.tags[i] if tag then client.focus:move_to_tag(tag) end end 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 = client.focus.screen.tags[i] if tag then client.focus:toggle_tag(tag) 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), awful.button({ modkey }, 1, awful.mouse.client.move), awful.button({ modkey }, 3, awful.mouse.client.resize)) -- Set keys root.keys(globalkeys) -- }}} -- {{{ Rules -- Rules to apply to new clients (through the "manage" signal). awful.rules.rules = { -- All clients will match this rule. { rule = { }, properties = { border_width = beautiful.border_width, border_color = beautiful.border_normal, focus = awful.client.focus.filter, raise = true, keys = clientkeys, 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 = true } }, } awful.util.spawn_with_shell("xbindkeys") awful.util.spawn_with_shell("autoWall") awful.util.spawn_with_shell("setxkbmap -option grab:break_actions") 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)