From 22d656903563f75678f3634964731ccf93355dfd Mon Sep 17 00:00:00 2001 From: ache Date: Mon, 13 Mar 2017 23:17:19 +0100 Subject: Init commit --- rc.lua | 857 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 857 insertions(+) create mode 100644 rc.lua (limited to 'rc.lua') diff --git a/rc.lua b/rc.lua new file mode 100644 index 0000000..657f3e2 --- /dev/null +++ b/rc.lua @@ -0,0 +1,857 @@ +-- default rc.lua for shifty +-- +-- 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") +-- shifty - dynamic tagging library +local shifty = require("lib.shifty.init") + +awful.screen = require("awful.screen") + + + + +local naughty = require("naughty") + +-- 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("/home/ache/.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. +local layouts = +{ + lain.layout.uselesspiral, --1 + lain.layout.uselessfairnogap, --2 + awful.layout.suit.tile, --3 +} +-- }}} + +-- {{{ Wallpaper +if beautiful.wallpaper then + for s = 1, screen.count() do + gears.wallpaper.maximized(beautiful.wallpaper, s, true) + end +end +-- }}} + +-- Shifty configured tags. +shifty.config.tags = { + ["一"] = { + layout = layouts[2], + mwfact = 0.60, + init = true, + position = 1, + screen = 1, + }, + ["二"] = { + layout = layouts[2], + mwfact = 0.60, + init = true, + position = 2, + }, + ["三"] = { + layout = layouts[2], + mwfact = 0.60, + init = true, + position = 3, + }, + ["四"] = { + layout = layouts[2], + mwfact = 0.60, + init = true, + position = 4, + }, + ["五"] = { + layout = layouts[2], + mwfact = 0.60, + init = true, + position = 5, + }, + ["六"] = { + layout = layouts[2], + mwfact = 0.60, + init = true, + position = 6, + }, + ["七"] = { + layout = layouts[1], + mwfact = 0.60, + init = true, + position = 7, + }, + ["八"] = { + layout = layouts[1], + mwfact = 0.60, + init = true, + position = 8, + }, +} + +-- SHIFTY: application matching rules +-- order here matters, early rules will be applied first +shifty.config.apps = { + { match = {""}, + buttons = awful.util.table.join( + awful.button({}, 1, function (c) client.focus = c; c:raise() end), + awful.button({modkey}, 1, function(c) + client.focus = c + c:raise() + awful.mouse.client.move(c) + end), + awful.button({modkey}, 3, awful.mouse.client.resize) + ) + }, +} + +-- SHIFTY: default tag creation rules +-- parameter description +-- * floatBars : if floating clients should always have a titlebar +-- * guess_name : should shifty try and guess tag names when creating +-- new (unconfigured) tags? +-- * guess_position: as above, but for position parameter +-- * run : function to exec when shifty creates a new tag +-- * all other parameters (e.g. layout, mwfact) follow awesome's tag API +shifty.config.defaults = { + layout = awful.layout.suit.tile, + ncol = 1, + mwfact = 0.10, + floatBars = false, + guess_name = true, + guess_position = false, +} + +-- {{{ 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() +mytextclock = awful.widget.textclock(" %H:%M ") +markup = lain.util.markup + +-- Calendar +lain.widgets.calendar:attach(mytextclock) + + +-- CPU +cpuwidget = lain.widgets.cpu({ + settings = function() + widget:set_markup(markup("#cbcbcb", "") .. 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 args["{Artist}"]..' - '.. args["{Title}"] .. ' ' + else + return args["{Artist}"] .. ' ' + end + else + if not (args["{Title}"] == 'N/A') then + return args["{Title}"] .. ' ' + end + return '' + end + end + end, 10) + +-- MEM +memwidget = lain.widgets.mem({ + settings = function() + widget:set_markup(markup("#cbcbcb", " ⌥ ") .. mem_now.used .. " Mb") + end +}) + + +-- ALSA volume +volumewidget = lain.widgets.alsa({ + settings = function() + header = " ⌘ " + vlevel = volume_now.level + if volume_now.status == "off" then + vlevel = vlevel .. "%🔇" + else + vlevel = vlevel .. "% " + end + widget:set_markup(markup("#cbcbcb", header) .. vlevel) + end +}) + + +-- Separators +first = wibox.widget.textbox(markup.font("Terminus 4", " ")) +spr = wibox.widget.textbox(' ⌁ ') + + +myemailwidget = wibox.widget.textbox() +mybatwidget = wibox.widget.textbox ('') + + +function act() + --{{ 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, "%%") + mybatwidget:set_text ( "⚡" .. string.sub(percent, 1, a+1)) + -- 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) + 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) + + --{{ 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 = "Hey mec ! e-mail !" }) + 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() + right_layout:add(mpdwidget) + if s == 1 then right_layout:add(wibox.widget.systray()) end +-- right_layout:add(musicwidget.widget) +-- right_layout:add(mybatwidget) +-- right_layout:add(wibox.widget.systray()) + right_layout:add(first) + right_layout:add(spr) + right_layout:add(cpuwidget) + right_layout:add(memwidget) + right_layout:add(volumewidget) + right_layout:add(mybatwidget) + 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 +-- }}} + +-- SHIFTY: initialize shifty +-- the assignment of shifty.taglist must always be after its actually +-- initialized with awful.widget.taglist.new() +shifty.taglist = mytaglist +shifty.init() + +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[mouse.screen].visible then + wp_timer:start() + else + wp_timer:stop() + end + end +end + +function showHide() + +end + + +layoutKkb = 1 + + +-- {{{ Key bindings +globalkeys = awful.util.table.join( + + -- Raccour cis perso + awful.key({ }, "XF86AudioRaiseVolume", function () + awful.util.spawn("amixer set Master 9%+") end), + awful.key({ }, "XF86AudioLowerVolume", function () + awful.util.spawn("amixer set Master 9%-") end), + awful.key({ }, "XF86AudioMute", function () + awful.util.spawn("amixer sset Master toggle") 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({ modkey}, "F1", function () + awful.util.spawn("roxterm -e bash -c \"mpd;mpc random on;mpc repeat on;ncmpcpp\"") end), + + awful.key({ modkey, "Mod1"}, "f", function () awful.util.spawn("firefox") end), + awful.key({ modkey, }, "t", function () awful.util.spawn("uzbl-browser") end), + awful.key({ modkey, }, "b", function () awful.util.spawn("vimb -c /usr/share/vimb/.vimbrc") end), + awful.key({ modkey, "Mod1"}, "t", function () awful.util.spawn("proxychains uzbl-browser") end), + awful.key({ modkey, "Mod1"}, "b", function () awful.util.spawn("proxychains vimb -c /usr/share/vimb/.vimbrc http://duckduckgo.com") end), + awful.key({ modkey, "Mod1"}, "q", function () awful.util.spawn("uzbl-browser http://duckduckgo.com > /dev/null") end), + awful.key({ modkey, "Mod1"}, "r", function () awful.util.spawn_with_shell("xterm -e 'ranger'") end), + awful.key({ modkey, "Control"}, "r", function () awful.util.spawn("pcmanfm") end), + awful.key({ modkey, "Mod1"}, "v", function () awful.util.spawn("gvim") end), + awful.key({ modkey, }, "s", function () awful.util.spawn("scrot") end), + awful.key({ modkey, "Control" }, "s", function () awful.util.spawn("scrot -u") end), + awful.key({ modkey, "Shift" }, "s", function () awful.util.spawn("scrot -u") end), + + + awful.key({ modkey, }, "Left", awful.tag.viewprev ), + awful.key({ modkey, }, "Right", awful.tag.viewnext ), + awful.key({ modkey, "Control" }, "Left", function() awful.screen.focus_relative(-1) end ), + awful.key({ modkey, "Control" }, "Right", function() awful.screen.focus_relative( 1) end ), + awful.key({ modkey, }, "Escape", awful.tag.history.restore), + + -- Shifty: keybindings specific to shifty + awful.key({modkey, "Shift"}, "d", shifty.del), -- delete a tag + -- awful.key({modkey, "Shift"}, "n", shifty.send_prev), -- client to prev tag + -- awful.key({modkey}, "n", shifty.send_next), -- client to next tag + awful.key({modkey, "Control"}, + "n", + function() + local t = awful.tag.selected() + local s = awful.util.cycle(screen.count(), awful.tag.getscreen(t) + 1) + awful.tag.history.restore() + t = shifty.tagtoscr(s, t) + awful.tag.viewonly(t) + end), + awful.key({modkey}, "a", shifty.add), -- creat a new tag + awful.key({modkey, "Shift"}, "r", shifty.rename), -- rename a tag + awful.key({modkey, "Control"}, "a", act ), + awful.key({modkey, "Shift"}, "a", -- nopopup new tag + function() + shifty.add({nopopup = true}) + end), + + awful.key({ modkey, }, "Tab", + function () + awful.client.focus.byidx( 1) + if client.focus then client.focus:raise() end + end), + awful.key({ modkey, "Shift" }, "Tab", + function () + awful.client.focus.byidx(-1) + if client.focus then client.focus:raise() end + end), +-- + + +--awful.key({ modkey, }, "Tab", +-- function () +-- for c in awful.client.iterate(function (x) return true end) do +-- client.focus = c +-- client.focus:raise() +-- end +-- end), +-- awful.key({ modkey, "Shift" }, "Tab", +-- function () +-- -- awful.client.focus.history.previous() +-- awful.client.focus.byidx(1) +-- +-- if client.focus then +-- +-- client.focus:raise() +-- end + -- end), + awful.key({ modkey, }, "w", function () awful.util.spawn("autoWall") end), + awful.key({ modkey, "Control" }, "w", function () awful.util.spawn_with_shell("setxkbmap -option grab:break_actions") end), + awful.key({ modkey, "Control" }, "w", function () awful.util.spawn("xscreensaver-command --lock") end), + awful.key({ modkey, "Control" }, "x", function () awful.util.spawn("xscreensaver-command --lock") end), + + -- Layout manipulation + awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), + awful.key({ modkey, }, "k", function () awful.util.spawn("xkill") 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), + + -- Standard program + awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + awful.key({ modkey, "Shift" }, "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, }, "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(layouts, 1) + naughty.notify({ title = 'Layout', text = awful.layout.getname(), timeout = 1 }) end), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) + naughty.notify({ title = 'Layout', text = awful.layout.getname(), timeout = 1 }) end), + + 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), + awful.key({ modkey, "Shift" }, "t", function () blockWibox = not blockWibox end), + 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" + } + end), + -- 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), + awful.key({ modkey, }, "c", function (c) + + if c.name == "Lecteur multimédia VLC" then + awful.util.spawn_with_shell('sleep 0.3;xte "keydown Control_L" "keydown v" "keyup v" "keyup Control_L"') + else + c:kill() + end + + + 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, }, "t", function (c) c.ontop = not c.ontop end), + awful.key({ modkey, "Shift" }, "o", function (c) shifty.create_titlebar(c) awful.titlebar(c) c.border_width = 1 end), + 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), + awful.key({ modkey, "Control" }, "p", function () menubar.show() end), + -- 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 + --[[ + local tag = awful.tag.selected() + for i=1, #tag:clients() do + tag:clients()[i].minimized=false + tag:clients()[i]:redraw() + tag:clients()[i]:raise() + list=client.get() + for k, c in pairs(list) do + -- Without this, the following + -- :isvisible() makes no sense + c.minimized = false + -- This will also un-minimize + -- the client, if needed + client.focus = c + c:raise() + end + end + -]] + + end), + awful.key({ modkey, }, "d", + function (c) + c.floating = not c.floating + end), + awful.key({ modkey, }, "m", + function (c) + c.maximized_horizontal = not c.maximized_horizontal + c.maximized_vertical = not c.maximized_vertical + end), + 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 + --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.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) + + +) + +-- SHIFTY: assign client keys to shifty for use in +-- match() function(manage hook) +shifty.config.clientkeys = clientkeys +shifty.config.modkey = modkey + +-- 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, (shifty.config.maxtags or 9) do + globalkeys = awful.util.table.join(globalkeys, + awful.key({ modkey }, "#" .. i + 9, + function () + awful.tag.viewonly(shifty.getpos(i)) + end), + awful.key({ modkey, "Control" }, "#" .. i + 9, + function () + awful.tag.viewtoggle(shifty.getpos(i)) + end), + awful.key({ modkey, "Shift" }, "#" .. i + 9, + function () + if client.focus then + local t = shifty.getpos(i) + awful.client.movetotag(t) + awful.tag.viewonly(t) + end + end), + awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, + function () + if client.focus then + awful.client.toggletag(shifty.getpos(i)) + end + end)) +end + + + +-- {{{ 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) + +-- }}} + + +-- Set keys +root.keys(globalkeys) +-- }}} + + -- awful.util.spawn_with_shell("volumeicon") +--awful.util.spawn_with_shell("nitrogen --restore") + -- awful.util.spawn_with_shell("setxkbmap fr") +-- awful.util.spawn_with_shell("sleep 5; conky &") +awful.util.spawn_with_shell("xbindkeys") +awful.util.spawn_with_shell("autoWall") +awful.util.spawn_with_shell("xcompmgr") +awful.util.spawn_with_shell("setxkbmap -option grab:break_actions") +awful.util.spawn_with_shell("xscreensaver -nosplash &") + -- awful.util.spawn_with_shell("setxkbmap -option grp:menu_toggle 'fr,us, dvorak'") +-- awful.util.spawn_with_shell("sleep 5; conky &") + -- awful.util.spawn_with_shell("setxkbmap fr") + +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) + +-- }}} -- cgit v1.2.3-54-g00ecf