-- 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") local lfs = require('lfs') local uselessfair = require("lib.uselessfair") awful.screen = require("awful.screen") local hotkeys = require("awful.hotkeys_popup") local hotkeys_popup = require("awful.hotkeys_popup").widget -- Lain local lain = require("lain") local awmodoro = require("awmodoro") local io = require("io") -- {{{ 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 -- Kill supervise before quiting _awesome_quit = awesome.quit awesome.quit = function() os.execute("loginctl terminate-session $(loginctl session-status | head -n 1 | awk '{print $1}')") _awesome_quit() end function guess_wifi(d) for file in lfs.dir(d) do if lfs.attributes(d .. file,"mode") == "directory" then local ok = "" for l in lfs.dir("/sys/class/net/" .. file) do if l == "wireless" then return file end end end end 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 = "kitty" 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" lain.layout.cascade.offset_x = 64 lain.layout.cascade.offset_y = 20 -- Table of layouts to cover with awful.layout.inc, order matters. awful.layout.layouts = { -- uselessfairnogap, --3 uselessfair, --3 lain.layout.cascade, --3 lain.layout.cascade.tile, --3 awful.layout.suit.tile, --1 awful.layout.suit.floating, --1 awful.layout.suit.fair, --1 } -- }}} -- {{{ 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 }) pomowibox = awful.wibox({ position = "top", screen = 1, height=4}) qPomowibox = awful.wibox({ position = "top", screen = 1, height=4}) pomowibox.visible = false qPomowibox.visible = false local pomodoro = awmodoro.new({ minutes = 25, do_notify = false, active_bg_color = '#313131', paused_bg_color = '#7746D7', fg_color = {type = "linear", from = {0,0}, to = {pomowibox.width, 0}, stops = {{0, "#AECF96"},{0.5, "#88A175"},{1, "#FF5656"}}}, width = pomowibox.width, height = pomowibox.height, begin_callback = function() for s = 1, screen.count() do mywibox[s].visible = false end pomowibox.visible = true end, finish_callback = function() for s = 1, screen.count() do mywibox[s].visible = true end pomowibox.visible = false end}) pomowibox:set_widget(pomodoro) local quickPomodoro = awmodoro.new({ minutes = 1, do_notify = false, active_bg_color = '#313131', paused_bg_color = '#7746D7', fg_color = {type = "linear", from = {0,0}, to = {qPomowibox.width, 0}, stops = {{0, "#AECF96"},{0.5, "#88A175"},{1, "#FF5656"}}}, width = qPomowibox.width, height = qPomowibox.height, begin_callback = function() for s = 1, screen.count() do mywibox[s].visible = false end qPomowibox.visible = true end, finish_callback = function() for s = 1, screen.count() do mywibox[s].visible = true end qPomowibox.visible = false end}) qPomowibox:set_widget(quickPomodoro) -- 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.widget.cal { attach_to = {mytextclock}, } -- CPU cpuwidget = lain.widget.cpu({ settings = function() int_cpu_usage = tonumber(cpu_now.usage) widget:set_text("⚙️ ".. cpu_now.usage .. "%") end, timeout=10}) -- MPD -- mpdwidget = lain.widget.mpd() gputemp = wibox.widget.textbox() vicious.register(gputemp, vicious.widgets.thermal, {"sys"}, 5) 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, 5 ) -- MEM memwidget = lain.widget.mem({ settings = function() int_mem_now_used = tonumber(mem_now.used) local perc_total = math.floor((mem_now.used + mem_now.swapused) / (mem_now.total + mem_now.swap) * 100) widget:set_markup(markup.fg.color("#dda", "🐏 " .. mem_now.used .. "M (" .. perc_total .. "%)")) if notify_ram and mem_now.perc_total >= 85 then naughty.notify({ preset = naughty.config.presets.critical, title = "Niveau de RM", text = "L'utilisation de la RAM dépasse 85%", bg="#EEAA55"}) end end, timeout=5 }) -- ALSA volume volumewidget = lain.widget.alsa({ settings = function() header = " " int_volume_level = tonumber(volume_now.level) if int_volume_level == 100 then vlevel = "100" elseif int_volume_level == 0 then vlevel = "0" else vlevel = volume_now.level end volume_emoji = "📢 " if int_volume_level == 0 then volume_emoji = "🔇 " elseif int_volume_level < 30 then volume_emoji = "🔈 " elseif int_volume_level < 50 then volume_emoji = "🔉 " elseif int_volume_level < 90 then volume_emoji = "🔊 " end if volume_now.status == "off" then vlevel = vlevel .. "#" volume_emoji = "🔇" else vlevel = vlevel .. "%" end widget:set_markup(markup.fg.color("#ccaacc", volume_emoji .. vlevel)) end , timeout=3}) -- Separators first = wibox.widget.textbox(markup.font("Terminus 4", " ")) spr = wibox.widget.textbox(' ⌁ ') myemailwidget = wibox.widget.textbox() mybatwidget = wibox.widget.textbox ('') mysysctlwidget = wibox.widget.textbox ('') mynetworkwidget = wibox.widget.textbox ('') notify_bat = true notify_ram = true notify_email = true local lastIp = '' local lastInt = '' local lastEssid = '' function fuckingAct() local list=client.get() for k, c in pairs(list) do awful.client.shape.update.all(c) awful.client.shape.update.bounding(c) awful.client.shape.update.clip(c) end awful.tag.viewnext() awful.tag.viewnext() gears.timer.delayed_call(awful.tag.viewnext) act() gears.timer.start_new (0.05, awful.tag.viewprev) gears.timer.start_new (0.05, awful.tag.viewprev) end 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 color = "#19DF1D" elseif nPercent > 10 then color = "#E28126" else color = "#FF8080" end mybatwidget:set_markup_silently( markup(color, "🔋 " .. nPercent) .. "%") if notify_bat then if nPercent < 22 and nPercent >= 18 then naughty.notify({ preset = naughty.config.presets.normal, title = "Niveau de batterie", text = "Niveau de batterie inquiétant." .. "Pensez à trouver une prise" }) end if nPercent < 12 and nPercent >= 7 then naughty.notify({ preset = naughty.config.presets.critical, title = "Alerte niveau de batterie", text = "Niveau de batterie faible," .. "pensez à charger le portable" }) end if nPercent < 4 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 nPercent = tonumber(string.sub(percent,2,a-1)) mybatwidget:set_text ("🔌 " .. nPercent .. "%") end end) end end) textStat = " / " --{{ systemctl status awful.spawn.easy_async("pidof wpa_supplicant", function(out, a, reason, exit_code) textStat = "" if exit_code == 0 then textStat = textStat .. "📡 | " end mysysctlwidget:set_text ( textStat ) end ) awful.spawn.easy_async("systemctl status bluetooth", function(out, _, reason, exit_code) if exit_code == 0 then textStat = textStat .. "💎 | " end mysysctlwidget:set_text ( textStat ) end ) awful.spawn.easy_async("systemctl status sshd", function(out, _, reason, exit_code) if exit_code == 0 then textStat = textStat .. "🐚 | " end mysysctlwidget:set_text ( textStat ) 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_default, stderr, reason, exit_code) if not ( interface_default == "" or interface_default == "\n") then interface_default = string.gsub(interface_default, "\n", "") if not (interface_default == lastInt) then if not lastInt == "" then naughty.notify({ preset = naughty.config.presets.normal, title = "ip change", text = "Changement d'interface par defaut " .. lastInt .. " par " .. interface_default, timeout=20}) else naughty.notify({ preset = naughty.config.presets.normal, title = "new ip", text = "Connection à " .. interface_default, timeout=20}) end lastInt = interface_default end awful.spawn.easy_async("bash -c \"ip r | grep 'dev " .. interface_default .. "' | 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 if not lastIp == "" then naughty.notify({ preset = naughty.config.presets.normal, title = "ip route", text = "Changement de route " .. lastIp .. " vers " .. ip, timeout=20}) else naughty.notify({ preset = naughty.config.presets.normal, title = "ip route", text = "Initialisation de la route par defaut vers " .. ip, timeout=20}) end lastIp = ip end end toShow = toShow .. interface_default interface_wifi = guess_wifi("/sys/class/net/") if interface_wifi ~= "" then awful.spawn.easy_async("bash -c \"printf '%b' $(iwconfig " .. interface_wifi .." 2>&1 | grep -v 'no wireless' | grep ESSID | grep -v 'off/any' | tail -n 1 | cut -d'\\\"' -f 2)\"", function(essid, stderr2, reason2, exit_code2) if essid ~= "" then essid = string.gsub(essid, "\n", "") if interface_wifi ~= interface_default then toShow = toShow .. " ⏸️" else toShow = toShow .. " ▶️" end toShow = toShow .. "[" .. essid .. "]" mynetworkwidget:set_text ( toShow ) if essid ~= lastEssid then naughty.notify({ preset = naughty.config.presets.normal, title = "Connection Wifi", text = "Connecté à " .. essid .. " !", timeout=20}) lastEssid = essid end awful.spawn.easy_async("bash -c \"iwconfig wlan0 2>&1 | grep -i quality | grep -v 'no wireless' | cut -d'=' -f 2 | cut -d' ' -f1\"", function(signal, stderr3, reason3, exit_code3) if signal ~= "" then signal = string.gsub(signal, "\n", "") toShow = toShow .. "(📶" .. signal .. ")" mynetworkwidget:set_text ( toShow ) end end ) end end ) end mynetworkwidget:set_text ( toShow ) end ) else mynetworkwidget:set_markup("") 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" or notify_email == false then myemailwidget:set_text ( "" ) elseif res == "" then myemailwidget:set_text ( "☠" ) else myemailwidget:set_text ( "📧" .. res) 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", act) -- 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(mysysctlwidget) right_layout:add(mynetworkwidget) right_layout:add(spr) right_layout:add(cpuwidget.widget) right_layout:add(spr) right_layout:add(memwidget.widget) right_layout:add(spr) right_layout:add(volumewidget.widget) 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 function hideNotification() 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, "Mod1" }, "#43", hotkeys_popup.show_help, {description="Show help", group="awesome"}), awful.key({ modkey, }, "#9", awful.tag.history.restore --[[, {description = "go back", group = "tag"} --]]), -- Layout manipulation awful.key({ modkey, "Shift" }, "#44", function () awful.client.swap.byidx( 1) end, {description = "Swap with next client by index", group = "client"}), awful.key({ modkey, "Shift" }, "#45", function () awful.client.swap.byidx( -1) end, {description = "Swap with previous client by index", group = "client"}), awful.key({ modkey, }, "#30", awful.client.urgent.jumpto, {description = "Jump to urgent client", group = "client"}), -- Raccourcis perso awful.key({ }, "#123", function () awful.util.spawn("pamixer -i 2") end), awful.key({ }, "#122", function () awful.util.spawn("pamixer -d 2") end), awful.key({ }, "#121", function () awful.util.spawn("pamixer -t") end), awful.key({ }, "#96", function () awful.util.spawn("pamixer -i 2") end), awful.key({ }, "#76", function () awful.util.spawn("pamixer -d 2") end), awful.key({ }, "#95", function () awful.util.spawn("pamixer -t") end), awful.key({ }, "#172", function () awful.util.spawn("mpc toggle") end), awful.key({ }, "#171", function () awful.util.spawn("mpc next") end), awful.key({ }, "#173", function () awful.util.spawn("mpc prev") end), awful.key({ "Control" }, "#95", function () awful.util.spawn("mpc toggle") end), awful.key({ "Control" }, "#96", function () awful.util.spawn("mpc next") end), awful.key({ "Control" }, "#76", function () awful.util.spawn("mpc prev") end), awful.key({ modkey }, "#95", function () awful.util.spawn("pavucontrol") end), awful.key({ modkey}, "#67", function () awful.util.spawn("kitty -e ncmpcpp") end, {description = "MPD", group = "awesome"}), awful.key({ modkey, "Mod1" }, "#68", function () awful.util.spawn("kitty -e mutt") end, {description = "mutt", group = "awesome"}), awful.key({ modkey, "Control" }, "#69", function () naughty.destroy_all_notifications(nil,naughty.notificationClosedReason.dismissedByUser) end), awful.key({ modkey, "Mod1"}, "#41", 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"}, "#27", function () awful.util.spawn_with_shell("kitty -e 'ranger'") end, {description = "Ranger", group = "awesome"}), awful.key({ modkey, "Control"}, "#27", function () awful.util.spawn("caja") end), awful.key({ modkey, }, "#39", function () awful.util.spawn("bash -c \"maim -u | xclip -selection clipboard -t image/png\"") naughty.notify({ title = 'Maim', text = 'New screenshot taken', timeout = 3 }) end, {description = "Screenshot", group = "awesome"}), awful.key({ modkey, "Shift" }, "#54", function () awful.util.spawn("xsel -x") naughty.notify({ title = 'Maim', text = 'New screenshot taken', timeout = 3 }) end, {description = "Switch PRIMARY and SECONDARY clipboard", group = "awesome"}), awful.key({ modkey, "Control" }, "#54", function () awful.spawn.easy_async("clip2file", function(res, stderr, reason, exit_code) if exit_code == 0 then naughty.notify({title='Maim', text='Clipboard saved !', timeout=3}) else naughty.notify({preset=naughty.config.presets.critical, title='Maim', text=stderr, timeout=3 }) end end ) end, {description = "Save clipboard to file", group = "awesome"}), awful.key({ modkey, "Shift"}, "#39", function () awful.util.spawn("bash -c \"maim -u -s | xclip -selection clipboard -t image/png\"") naughty.notify({ title = 'Maim', text = 'New screenshot taken', timeout = 3 }) end, {description = "Screenshot of selectionned area", group = "awesome"}), awful.key({ modkey, "Control" }, "#39", function () awful.util.spawn("bash -c \"maim -u -i $(xdotool getactivewindow) | xclip -selection clipboard -t image/png\"") naughty.notify({ title = 'Maim', text = 'Screenshot of focused windows', timeout = 2 }) end, {description = "Screenshot of focused windows", group = "awesome"}), awful.key({ modkey, }, "#113", function () local screen = awful.screen.focused() local tag = screen.tags[1] local lastTag = screen.tags[9] if tag == awful.tag.selected(1) then lastTag:view_only() else awful.tag.viewprev() end end, {description = "Previous", group = "tag"}), awful.key({ modkey, }, "#114", function () local screen = awful.screen.focused() local tag = screen.tags[9] local firstTag = screen.tags[1] if tag == awful.tag.selected(1) then firstTag:view_only() else awful.tag.viewnext() end end, {description = "Next", group = "tag"}), awful.key({ modkey, "Control" }, "#113", function() awful.screen.focus_relative(-1) end, {description = "Next screen", group = "awesome"}), awful.key({ modkey, "Control" }, "#114", function() awful.screen.focus_relative( 1) end, {description = "Previous screen", group = "awesome"}), awful.key({ modkey, }, "#9", fuckingAct), awful.key({ modkey, }, "#23", function () awful.client.focus.byidx( 1) if client.focus then client.focus:raise() end end, {description = "Next client", group = "client"}), awful.key({ modkey, "Shift" }, "#23", function () awful.client.focus.byidx(-1) if client.focus then client.focus:raise() end end,{description = "Previous client", group = "client"}), awful.key({ modkey, }, "#52", function () awful.util.spawn("autoWall") end, {description = "Switch wallpaper", group = "awesome"}), awful.key({ modkey, "Control" }, "#52", function () act() end, {description = "Actualise Wibox", group = "awesome"}), awful.key({ modkey, "Shift" }, "#52", function () awful.util.spawn("passmenu --type -matching fuzzy -theme gruvbox-dark-hard") end, {description = "🔑 Passwd promt", group = "awesome"}), awful.key({ modkey, "Mod1" }, "#52", function () awful.util.spawn("passmenu --type") end, {description = "🔑 Passwd promt alt", group = "awesome"}), awful.key({ modkey, "Control" }, "#53", function () awful.util.spawn("locker") end, {description = "Lock screen", group = "awesome"}), -- Layout manipulation awful.key({ modkey, "Mod1" }, "#45", function () awful.util.spawn("xkill") end, {description = "xkill", group = "awesome"}), awful.key({ modkey, "Control" }, "#44", function () awful.screen.focus_relative( 1) end), awful.key({ modkey, "Control" }, "#45", function () awful.screen.focus_relative(-1) end), awful.key({ modkey, }, "#30", awful.client.urgent.jumpto), -- Standard program awful.key({ modkey, }, "#36", function () awful.util.spawn(terminal) end, {description = "new term", group = "awesome"}), awful.key({ modkey, "Shift" }, "#27", awesome.restart, {description = "restart", group = "awesome"}), awful.key({ modkey, "Shift" }, "#38", awesome.quit,{description = "quit", group = "awesome"}), awful.key({ modkey, }, "#46", function () awful.tag.incmwfact( 0.05) end), awful.key({ modkey, }, "#43", function () awful.tag.incmwfact(-0.05) end), awful.key({ modkey, }, "#44", function () awful.client.incwfact( 0.05) end), awful.key({ modkey, }, "#45", function () awful.client.incwfact(-0.05) end), awful.key({ modkey, "Shift" }, "#43", function () awful.tag.incnmaster( 1) end), awful.key({ modkey, "Shift" }, "#46", function () awful.tag.incnmaster(-1) end), awful.key({ modkey, "Control" }, "#43", function () awful.tag.incncol( 1) end), awful.key({ modkey, "Control" }, "#46", function () awful.tag.incncol(-1) end), awful.key({ modkey, }, "#65", 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" }, "#65", 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" }, "#114", function () awful.tag.incmwfact( 0.01) end), awful.key({ modkey, "Mod1" }, "#113", function () awful.tag.incmwfact(-0.01) end), awful.key({ modkey, "Mod1" }, "#116", function () awful.client.incwfact( 0.01) end), awful.key({ modkey, "Mod1" }, "#111", function () awful.client.incwfact(-0.01) end), awful.key({ modkey, "Control" }, "#57", awful.client.restore), awful.key({ modkey, }, "#28", showHideWibox, {description = "Toogle Wibox", group = "awesome"}), awful.key({ modkey, "Shift" }, "#28", function () blockWibox = not blockWibox end, {description = "Lock Wibox", group = "awesome"}), awful.key({ modkey, "Shift" }, "#56", 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" }, "#56", function () notify_ram = not notify_ram naughty.notify({ preset = naughty.config.presets.normal, timeout=1, text = "Notification de ressource RAM: " .. ( notify_ram and "activée" or "désactivée" )}) end, {description = "Toggle RAM limite warning 🚨", group = "awesome"}), awful.key({ modkey, "Shift" }, "#26", function () notify_email = not notify_email naughty.notify({ preset = naughty.config.presets.normal, timeout=1, text = "Notification d'email : " .. ( notify_email and "activée" or "désactivée" )}) end, {description = "Toggle email warning 🚨", group = "awesome"}), awful.key({ modkey, "Control" }, "#28", showHideWibox), -- Prompt -- awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, -- {description = "run prompt", group = "launcher"}), awful.key({ modkey }, "#53", 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 -matching fuzzy") end,{description = "Run rofi prompt", group = "awesome"}), awful.key({ modkey }, "#51", 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,{description = "Run Lua code", group = "awesome"}), awful.key({ modkey, "Shift" }, "#61", function () awful.util.spawn("xset s off") awful.util.spawn("xset s 0 0 0") awful.util.spawn("xset -dpms") end,{description = "🔐 lock screen", group = "awesome"}), awful.key({ modkey }, "#61", function () awful.util.spawn("loginctl lock-session") end,{description = "🔐 lock screen", group = "awesome"}), awful.key({ modkey }, "#60", function () awful.util.spawn("splatmoji type /home/ache/.config/splatmoji/perso_emoji_list.tsv /home/ache/.config/splatmoji/kaomoji.tsv") end,{description = "emoji picker", group = "awesome"}), -- Menubar awful.key({ modkey }, "#33", 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, }, "#41", function (c) c.fullscreen = not c.fullscreen end, {description = "Set active client fullscreen", group = "client"}), awful.key({ modkey, "Mod1" }, "#28", function (c) c.ontop = not c.ontop end, {description = "Set active client on top", group = "client"}), awful.key({ modkey, }, "#54", function (c) c:kill() end), awful.key({ modkey, }, "#55", function (c) awful.util.spawn("xdotool click 2") end), awful.key({ modkey, "Control" }, "#65", awful.client.floating.toggle, {description = "Set floating layout", group = "client"}), awful.key({ modkey, "Control" }, "#36", function (c) c:swap(awful.client.getmaster()) end), awful.key({ modkey, }, "#32", awful.client.movetoscreen ), awful.key({ modkey, }, "#57", 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" }, "#33", function () menubar.show() end, {description = "Maximize all clients", group = "awesome"}), -- all minimized clients are restored awful.key({ modkey, }, "#56", function(c) --[[ for c in awful.client.iterate(function (x) x:raise() return true end) do c.minimized=false end --]] 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, }, "#40", function (c) c.floating = not c.floating end, {description = "Set floating", group = "client"}), awful.key({ modkey, }, "#47", 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" }, "#47", 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"}--]]), awful.key({ modkey, "Mod1"}, "p", function () if not pomowibox.visible then pomodoro:toggle() end end), awful.key({ modkey, "Ctrl"}, "p", function () if not pomowibox.visible then quickPomodoro:toggle() end end), awful.key({ modkey, "Shift" }, "p", function () pomodoro:finish(); quickPomodoro:finish() end) ) end globalkeys = awful.util.table.join(globalkeys, -- Move only last tag. awful.key({ modkey }, "Delete", function () local screen = awful.screen.focused() local tag = screen.tags[10] if tag then tag:view_only() end end ), -- Move client to tag. awful.key({ modkey, "Shift" }, "Delete", function () if client.focus then local tag = client.focus.screen.tags[10] if tag then client.focus:move_to_tag(tag) end end 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("autoWall") -- Have to be here, to write other the fucking wallpaper of awesome. -- awful.util.spawn_with_shell("xbindkeys") -- awful.util.spawn_with_shell("setxkbmap -option grab:break_actions") -- awful.util.spawn_with_shell("xss-lock -n /usr/lib/xsecurelock/dimmer -l -- /usr/bin/xsecurelock") -- -- All moved to .xinitrc. 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)