From b9b48a10ff85141066dc62daf488c00568e33304 Mon Sep 17 00:00:00 2001 From: ache Date: Wed, 27 Mar 2019 15:46:58 +0100 Subject: Kill session --- rc.lua | 81 ++++++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 34 deletions(-) diff --git a/rc.lua b/rc.lua index ca8ac45..6d58ff6 100644 --- a/rc.lua +++ b/rc.lua @@ -28,6 +28,15 @@ if awesome.startup_errors then 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 + + + -- Handle runtime errors after startup do local in_error = false @@ -79,7 +88,7 @@ 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), @@ -87,8 +96,6 @@ awful.screen.connect_for_each_screen(function(s) 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 @@ -134,25 +141,25 @@ cpuwidget = lain.widgets.cpu({ 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) +-- 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({ @@ -331,8 +338,8 @@ function act() act() mytimer = timer { timeout = 60 } -mytimer:connect_signal("timeout", function() act() end) - +mytimer:connect_signal("timeout", act) + -- Create a wibox for each screen and add it mywibox = {} mypromptbox = {} @@ -431,7 +438,7 @@ end wp_timer = timer { timeout = 15 } -wp_timer:connect_signal("timeout", function() showHideWibox() end) +wp_timer:connect_signal("timeout", function() showHideWibox() end) blockWibox = true @@ -449,7 +456,10 @@ function showHideWibox() end function showHide() - + +end + +function hideNotification() end local rule_any2 = {class={"Weechat", "weechat"}} @@ -563,9 +573,12 @@ awful.key({ modkey, "Shift" }, "s", hotkeys_popup.show_help, {descriptio 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.key({ modkey, "Mod1" }, "F2", function () awful.util.spawn("roxterm -e fish -c mutt") end, {description = "mutt", group = "awesome"}), + awful.key({ "Control" }, "F3", function () + naughty.destroy_all_notifications(nil,naughty.notificationClosedReason.dismissedByUser) + end), awful.key({ modkey, "Mod1"}, "f", function () awful.util.spawn("firefox") end, {description = "Firefox", group = "awesome"}), @@ -650,19 +663,19 @@ awful.key({ modkey, "Shift" }, "s", hotkeys_popup.show_help, {descriptio --~ awful.key({ modkey, "Control" }, "n", awful.client.restore), - awful.key({ modkey, }, "t", function () showHideWibox() end, + awful.key({ modkey, }, "t", showHideWibox, {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 () + 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), - + awful.key({ modkey, "Control" }, "t", showHideWibox), + -- Prompt -- awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, @@ -680,7 +693,7 @@ awful.key({ modkey, "Shift" }, "s", hotkeys_popup.show_help, {descriptio awful.util.spawn("rofi -show run -modi run") end,{description = "Run rofi prompt", group = "awesome"}), -- Menubar - awful.key({ modkey }, "p", function() + awful.key({ modkey }, "p", function() local list=client.get() for k, c in pairs(list) do -- Without this, the following @@ -728,8 +741,8 @@ awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.ful 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", + -- all minimized clients are restored + awful.key({ modkey, }, "b", function() for c in awful.client.iterate(function (x) x:raise() return true -- cgit v1.2.3