]> git.madduck.net Git - etc/awesome.git/blobdiff - .config/awesome/rc.lua

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Flameshot shortcut
[etc/awesome.git] / .config / awesome / rc.lua
index 3c7cdf34cc7c8944c1d4038fe845460d63e9d0f3..5e9a765f2d8455bca40d370b28f91c97cc6386f6 100644 (file)
@@ -24,6 +24,7 @@ local has_fdo, freedesktop = pcall(require, "freedesktop")
 -- Other libraries
 local lain = require("lain")
 local ccwidgets = require("cryptocoin_widgets")
 -- Other libraries
 local lain = require("lain")
 local ccwidgets = require("cryptocoin_widgets")
+local fxwidgets = require("forex_widgets")
 local clocksarray = require("clocksarray")
 local dbg = require("debugfunc")
 local th = require("taghelpers")
 local clocksarray = require("clocksarray")
 local dbg = require("debugfunc")
 local th = require("taghelpers")
@@ -77,7 +78,9 @@ cmdkey = "Mod3"
 -- Table of layouts to cover with awful.layout.inc, order matters.
 local layouts = {
     default = awful.layout.suit.fair,
 -- Table of layouts to cover with awful.layout.inc, order matters.
 local layouts = {
     default = awful.layout.suit.fair,
+    default_horiz = awful.layout.suit.fair.horizontal,
     tiled = awful.layout.suit.tile,
     tiled = awful.layout.suit.tile,
+    tiled_horiz = awful.layout.suit.tile.top,
     floating = awful.layout.suit.floating,
     maximised = awful.layout.suit.max
 }
     floating = awful.layout.suit.floating,
     maximised = awful.layout.suit.max
 }
@@ -86,6 +89,8 @@ awful.layout.layouts = {
     layouts.tiled,
     layouts.maximised,
     layouts.floating,
     layouts.tiled,
     layouts.maximised,
     layouts.floating,
+    layouts.default_horiz,
+    layouts.tiled_horiz,
 }
 -- }}}
 
 }
 -- }}}
 
@@ -115,11 +120,18 @@ local function set_wallpaper(s)
     end
 end
 
     end
 end
 
-local function centre_mouse_on_area(a)
-    mouse.coords({
-        x = a.x + a.width/2,
-        y = a.y + a.height/2,
-    }, true)
+local function move_mouse_to_area(a)
+    local coords = mouse.coords()
+    if (coords.x < a.x or
+        coords.x > (a.x+a.width) or
+        coords.y < a.y or
+        coords.y > (a.y+a.height)) then
+
+        mouse.coords({
+            x = a.x + a.width/2,
+            y = a.y + a.height/2,
+        }, true)
+    end
 end
 
 -- }}}
 end
 
 -- }}}
@@ -166,8 +178,11 @@ menubar.utils.terminal = terminal -- Set the terminal for applications that requ
 --    forced_width = 4,
 --    widget = wibox.widget.separator
 --}
 --    forced_width = 4,
 --    widget = wibox.widget.separator
 --}
-local spacer = wibox.widget.textbox()
-spacer:set_text(" │ ")
+local function make_spacer(text)
+    local spacer = wibox.widget.textbox()
+    spacer:set_text(text or " │ ")
+    return spacer
+end
 
 -- Keyboard map indicator and switcher
 mykeyboardlayout = awful.widget.keyboardlayout()
 
 -- Keyboard map indicator and switcher
 mykeyboardlayout = awful.widget.keyboardlayout()
@@ -186,7 +201,7 @@ local lain_bat = lain.widget.bat({
 clocksarray = clocksarray.get_clocksarray("%a %d %b %H:%M:%S %Z", {
         ["NZ"] = "Pacific/Auckland",
         ["DE"] = "Europe/Berlin"
 clocksarray = clocksarray.get_clocksarray("%a %d %b %H:%M:%S %Z", {
         ["NZ"] = "Pacific/Auckland",
         ["DE"] = "Europe/Berlin"
-    }, spacer)
+    }, make_spacer())
 
 -- Create a wibox for each screen and add it
 local taglist_buttons = gears.table.join(
 
 -- Create a wibox for each screen and add it
 local taglist_buttons = gears.table.join(
@@ -279,34 +294,33 @@ awful.screen.connect_for_each_screen(function(s)
 
     -- Add widgets to the wibox
     local right_widgets = gears.table.join(clocksarray, {
 
     -- Add widgets to the wibox
     local right_widgets = gears.table.join(clocksarray, {
-        spacer,
-        --spacing = 4,
-        --spacing_widget = spacer,
+        make_spacer(" "),
+        wibox.widget.systray(),
         s.mylayoutbox,
         layout = wibox.layout.fixed.horizontal,
     })
 
         s.mylayoutbox,
         layout = wibox.layout.fixed.horizontal,
     })
 
-    if s == screen.primary then
+--    if s == screen.primary then
         right_widgets = gears.table.join({
         right_widgets = gears.table.join({
-            wibox.widget.systray(),
-            spacer,
+            make_spacer(" "),
             ccwidgets.btc_widget,
             ccwidgets.btc_widget,
-            spacer,
+            make_spacer(),
             ccwidgets.eth_widget,
             ccwidgets.eth_widget,
-            spacer,
+            make_spacer(),
+            fxwidgets.ecb_widget,
+            make_spacer(),
             lain_bat.widget,
             lain_bat.widget,
-            spacer,
+            make_spacer(),
         }, right_widgets)
         }, right_widgets)
-    end
+--    end
 
     s.mywibox:setup {
         layout = wibox.layout.align.horizontal,
         { -- Left widgets
 
     s.mywibox:setup {
         layout = wibox.layout.align.horizontal,
         { -- Left widgets
-            spacing = 4,
-            spacing_widget = spacer,
             layout = wibox.layout.fixed.horizontal,
             --s.namebox,
             s.mytaglist,
             layout = wibox.layout.fixed.horizontal,
             --s.namebox,
             s.mytaglist,
+            make_spacer(" "),
             s.mypromptbox,
         },
         s.mytasklist, -- Middle widget
             s.mypromptbox,
         },
         s.mytasklist, -- Middle widget
@@ -315,9 +329,10 @@ awful.screen.connect_for_each_screen(function(s)
 end) -- }}}
 
 -- {{{ autorandr integration
 end) -- }}}
 
 -- {{{ autorandr integration
-local function find_screen_by_name(name)
+local function find_screen_by_pattern(pattern)
     for s in screen do
     for s in screen do
-        if s.name == name then
+        print(s.name .. " :: " .. pattern)
+        if s.name:match(pattern) then
             return s
         end
     end
             return s
         end
     end
@@ -336,7 +351,7 @@ local function get_target_screen_for_tag(tag)
     if tag.targets then
         if type(tag.targets) == "table" then
             for _,target in ipairs(tag.targets) do
     if tag.targets then
         if type(tag.targets) == "table" then
             for _,target in ipairs(tag.targets) do
-                local s = find_screen_by_name(target)
+                local s = find_screen_by_pattern(target:gsub('%-', '%%-'))
                 if s then
                     print("  → screen " .. s.name)
                     return s
                 if s then
                     print("  → screen " .. s.name)
                     return s
@@ -373,7 +388,7 @@ tag.connect_signal("request::screen", function(t)
     end
     naughty.notify({
         title = "Screen removed",
     end
     naughty.notify({
         title = "Screen removed",
-        text = "Salvaged tab " .. t.name .. " onto screen " .. t.screen.name,
+        text = "Salvaged tab " .. t.name,
     })
 end)
 
     })
 end)
 
@@ -402,10 +417,11 @@ end
 
 local function initialise_to_autorandr_profile()
     local profile
 
 local function initialise_to_autorandr_profile()
     local profile
+    profile = nil
 
     local function process_line(line)
         if profile then return end
 
     local function process_line(line)
         if profile then return end
-        local match = string.match(line, "^([^%s]+) %(detected%)$")
+        local match = string.match(line, "^([^%s]+) %(detected%)")
         if match then
             profile = match
         end
         if match then
             profile = match
         end
@@ -426,7 +442,7 @@ local function initialise_to_autorandr_profile()
     end
 
     awful.spawn.with_line_callback('autorandr', {
     end
 
     awful.spawn.with_line_callback('autorandr', {
-        stderr = process_line,
+        stdout = process_line,
         output_done = output_done,
         exit = handle_exit
     })
         output_done = output_done,
         exit = handle_exit
     })
@@ -463,9 +479,9 @@ default_tags = gears.table.join(default_tags, {
     master_width_factor = 0.33,
     layout      = layouts.tiled,
     selected    = true,
     master_width_factor = 0.33,
     layout      = layouts.tiled,
     selected    = true,
-    exec_once   = { terminal .. " -name irc -e env MOSH_TITLE_NOPREFIX=true mosh -4 -- irc-host tmux new -As irc irssi" },
+    exec_once   = { terminal .. " -name irc -e env MOSH_TITLE_NOPREFIX=true mosh --family=all -- irc-host tmux new -As irc irssi" },
     instance    = { "irc" },
     instance    = { "irc" },
-    targets     = { "catalyst/eDP1", "mtvic/eDP1" },
+    targets     = { "catalyst1?/eDP-?1", "mtvic1?/eDP-?1", "gauting/eDP-?1", "lehel/DisplayPort-2" },
   },
   {
     name        = "[m]",
   },
   {
     name        = "[m]",
@@ -473,10 +489,10 @@ default_tags = gears.table.join(default_tags, {
     exclusive   = true,
     master_width_factor = 0.67,
     layout      = layouts.tiled,
     exclusive   = true,
     master_width_factor = 0.67,
     layout      = layouts.tiled,
-    selected    = true,
+    selected    = false,
     exec_once   = { "revolt" },
     instance    = { "Revolt" },
     exec_once   = { "revolt" },
     instance    = { "Revolt" },
-    targets     = { "catalyst/eDP1", "mtvic/eDP1" },
+    targets     = { "catalyst1?/eDP-?1", "mtvic1?/eDP-?1", "gauting/eDP-?1", "lehel/DisplayPort-2" },
   },
   {
     name        = "dflt",
   },
   {
     name        = "dflt",
@@ -492,8 +508,8 @@ default_tags = gears.table.join(default_tags, {
     exclusive   = true,
     layout      = layouts.default,
     exec_once   = { "thunderbird" },
     exclusive   = true,
     layout      = layouts.default,
     exec_once   = { "thunderbird" },
-    class       = { "Thunderbird" },
-    targets     = { "catalyst/HDMI1", "mtvic/eDP1" },
+    class       = { "thunderbird" },
+    targets     = { "catalyst1?/DP-?[12]-1", "mtvic1?/eDP-?1", "gauting/eDP-?1", "lehel/DisplayPort-1" },
   },
   {
     name        = "chr",
   },
   {
     name        = "chr",
@@ -502,7 +518,7 @@ default_tags = gears.table.join(default_tags, {
     layout      = layouts.default,
     exec_once   = { "chromium" },
     class       = { "Chromium" },
     layout      = layouts.default,
     exec_once   = { "chromium" },
     class       = { "Chromium" },
-    targets     = { "catalyst/HDMI1", "mtvic/eDP1" },
+    targets     = { "catalyst1?/DP-?[12]-1", "mtvic1?/eDP-?1", "gauting/eDP-?1", "lehel/DisplayPort-1", "present/HDMI.*" },
   },
   {
     name        = "ffx",
   },
   {
     name        = "ffx",
@@ -511,7 +527,7 @@ default_tags = gears.table.join(default_tags, {
     layout      = layouts.default,
     exec_once   = { "firefox" },
     class       = { "Firefox" },
     layout      = layouts.default,
     exec_once   = { "firefox" },
     class       = { "Firefox" },
-    targets     = { "catalyst/HDMI1", "mtvic/eDP1" },
+    targets     = { "catalyst1?/DP-?[12]-1", "mtvic1?/eDP-?1", "gauting/eDP-?1", "lehel/DisplayPort-1", "present/HDMI.*" },
   },
 })
 
   },
 })
 
@@ -597,6 +613,10 @@ globalkeys = gears.table.join(
               {description = "view previous", group = "tag"}),
     awful.key({ modkey,           }, "Right",  awful.tag.viewnext,
               {description = "view next", group = "tag"}),
               {description = "view previous", group = "tag"}),
     awful.key({ modkey,           }, "Right",  awful.tag.viewnext,
               {description = "view next", group = "tag"}),
+    awful.key({ modkey, "Shift" }, "Left", function () awful.screen.focus_relative( 1) end,
+              {description = "focus the next screen", group = "screen"}),
+    awful.key({ modkey, "Shift" }, "Right", function () awful.screen.focus_relative(-1) end,
+              {description = "focus the previous screen", group = "screen"}),
     awful.key({ modkey,           }, "Escape", awful.tag.history.restore,
               {description = "go back", group = "tag"}),
 
     awful.key({ modkey,           }, "Escape", awful.tag.history.restore,
               {description = "go back", group = "tag"}),
 
@@ -688,6 +708,7 @@ globalkeys = gears.table.join(
                     bg_cursor    = '#ff0000',
                     textbox      = widget,
                     history_path = awful.util.get_cache_dir() .. "/history",
                     bg_cursor    = '#ff0000',
                     textbox      = widget,
                     history_path = awful.util.get_cache_dir() .. "/history",
+                    completion_callback = awful.completion.shell,
                     hooks = {
                         -- Replace the 'normal' Return with a custom one
                         {{         }, 'Return', function(command)
                     hooks = {
                         -- Replace the 'normal' Return with a custom one
                         {{         }, 'Return', function(command)
@@ -746,11 +767,11 @@ globalkeys = gears.table.join(
     awful.key({ modkey,           }, "d", th.delete_tag,
               {description = "delete the current tag", group = "tag"}),
     awful.key({ modkey, "Shift",           }, "a", function()
     awful.key({ modkey,           }, "d", th.delete_tag,
               {description = "delete the current tag", group = "tag"}),
     awful.key({ modkey, "Shift",           }, "a", function()
-        move_to_new_tag(nil,nil,true,true,true)
+        th.move_to_new_tag(nil, nil, { layout = layouts.maximised },true,true,true)
     end,
               {description = "add a volatile tag with the focused client", group = "tag"}),
     awful.key({ modkey, "Shift", "Control" }, "a", function()
     end,
               {description = "add a volatile tag with the focused client", group = "tag"}),
     awful.key({ modkey, "Shift", "Control" }, "a", function()
-        move_to_new_tag(nil,nil,false,true,true)
+        th.move_to_new_tag(nil, nil, { layout = layouts.maximised },false,true,true)
     end,
               {description = "add a permanent tag with the focused client", group = "tag"}),
     awful.key({ modkey, "Mod1"   }, "a", th.copy_tag,
     end,
               {description = "add a permanent tag with the focused client", group = "tag"}),
     awful.key({ modkey, "Mod1"   }, "a", th.copy_tag,
@@ -870,14 +891,15 @@ clientbuttons = gears.table.join(
 -- misc apps
 globalkeys = awful.util.table.join(globalkeys,
 awful.key({ cmdkey }, "n", function () awful.spawn("firefox") end),
 -- misc apps
 globalkeys = awful.util.table.join(globalkeys,
 awful.key({ cmdkey }, "n", function () awful.spawn("firefox") end),
-awful.key({ cmdkey }, "m", function () awful.spawn("chromium --enable-remote-extensions") end),
-awful.key({ cmdkey }, "y", function () awful.spawn(terminal .. " -e python") end),
-awful.key({ cmdkey }, "c", function () awful.spawn("thunderbird") end),
+awful.key({ cmdkey }, "c", function () awful.spawn("chromium --enable-remote-extensions") end),
+awful.key({ cmdkey }, "y", function () awful.spawn(terminal .. " -e ipython3") end),
+awful.key({ cmdkey }, "m", function () awful.spawn(terminal .. " -name mutt -e mutt") end),
+awful.key({ cmdkey }, "t", function () awful.spawn("thunderbird") end),
 awful.key({ cmdkey }, "g", function () awful.spawn("gscan2pdf") end),
 awful.key({ cmdkey }, "v", function () awful.spawn("virt-manager") end),
 awful.key({ cmdkey }, "l", function () awful.spawn("libreoffice") end),
 awful.key({ cmdkey }, "g", function () awful.spawn("gscan2pdf") end),
 awful.key({ cmdkey }, "v", function () awful.spawn("virt-manager") end),
 awful.key({ cmdkey }, "l", function () awful.spawn("libreoffice") end),
-awful.key({ cmdkey }, "f", function () awful.spawn("thunar") end),
-awful.key({ cmdkey }, "i", function () awful.spawn(terminal .. " -name irc -e env MOSH_TITLE_NOPREFIX=true mosh -4 -- irc-host tmux new -As irc irssi") end),
+awful.key({ cmdkey }, "p", function () awful.spawn("pavucontrol") end),
+awful.key({ cmdkey }, "i", function () awful.spawn(terminal .. " -name irc -e env MOSH_TITLE_NOPREFIX=true mosh --family=all -- irc-host tmux new -As irc irssi") end),
 awful.key({ cmdkey }, "x", function ()
     awful.spawn("/usr/bin/xscreensaver -no-capture-stderr")
     os.execute("sleep 5")
 awful.key({ cmdkey }, "x", function ()
     awful.spawn("/usr/bin/xscreensaver -no-capture-stderr")
     os.execute("sleep 5")
@@ -885,26 +907,52 @@ awful.key({ cmdkey }, "x", function ()
 end),
 awful.key({ cmdkey, "Shift" }, "x", function () awful.spawn("xscreensaver-command -exit") end),
 
 end),
 awful.key({ cmdkey, "Shift" }, "x", function () awful.spawn("xscreensaver-command -exit") end),
 
+awful.key({ cmdkey }, "BackSpace", function () awful.spawn("pkill -USR1 offlineimap") end),
+
 -- function keys
 awful.key(nil, "XF86ScreenSaver", function () awful.spawn("xset dpms force off") end),
 -- function keys
 awful.key(nil, "XF86ScreenSaver", function () awful.spawn("xset dpms force off") end),
-awful.key(nil, "XF86AudioMute", function () awful.spawn("pactl set-sink-mute 0 toggle") end),
-awful.key({ cmdkey }, "End", function () awful.spawn("pactl set-sink-mute 0 toggle") end),
-awful.key(nil, "XF86AudioLowerVolume", function () awful.spawn("pactl set-sink-volume 0 -2%") end),
-awful.key({ cmdkey }, "Next", function () awful.spawn("pactl set-sink-volume 0 -2%") end),
-awful.key(nil, "XF86AudioRaiseVolume", function () awful.spawn("pactl set-sink-volume 0 +2%") end),
-awful.key({ cmdkey }, "Prior", function () awful.spawn("pactl set-sink-volume 0 +2%") end),
-awful.key(nil, "XF86AudioMicMute", function () awful.spawn("pactl set-source-mute 1 toggle") end),
-awful.key({ cmdkey }, "Home", function () awful.spawn("pactl set-source-mute 1 toggle") end),
+awful.key(nil, "XF86AudioMute", function () awful.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle") end),
+awful.key({ cmdkey }, "End", function () awful.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle") end),
+awful.key(nil, "XF86AudioLowerVolume", function () awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ -2%") end),
+awful.key({ cmdkey }, "Next", function () awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ -2%") end),
+awful.key(nil, "XF86AudioRaiseVolume", function () awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ +2%") end),
+awful.key({ cmdkey }, "Prior", function () awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ +2%") end),
+awful.key(nil, "XF86AudioMicMute", function () awful.spawn("pactl set-source-mute @DEFAULT_SOURCE@ toggle") end),
+awful.key({ cmdkey }, "Home", function () awful.spawn("pactl set-source-mute @DEFAULT_SOURCE@ toggle") end),
+awful.key({ cmdkey }, "Insert", function () awful.spawn("pa_cycle_default source") end),
+awful.key({ cmdkey }, "Delete", function () awful.spawn("pa_cycle_default sink") end),
 awful.key(nil, "XF86MonBrightnessDown", function () awful.spawn("xbacklight -dec 5%") end),
 awful.key(nil, "XF86MonBrightnessUp", function () awful.spawn("xbacklight -inc 5%") end),
 awful.key(nil, "XF86MonBrightnessDown", function () awful.spawn("xbacklight -dec 5%") end),
 awful.key(nil, "XF86MonBrightnessUp", function () awful.spawn("xbacklight -inc 5%") end),
-awful.key(nil, "XF86Display", function () awful.spawn("") end),
+awful.key(nil, "XF86Display", function () awful.spawn("autorandr --change --force"); initialise_to_autorandr_profile() end),
 awful.key(nil, "XF86WLAN", function () awful.spawn("") end),
 awful.key(nil, "XF86Tools", function () awful.spawn("") end),
 awful.key(nil, "XF86Search", function () awful.spawn("") end),
 awful.key(nil, "XF86LaunchA", function () awful.spawn("") end),
 awful.key(nil, "XF86WLAN", function () awful.spawn("") end),
 awful.key(nil, "XF86Tools", function () awful.spawn("") end),
 awful.key(nil, "XF86Search", function () awful.spawn("") end),
 awful.key(nil, "XF86LaunchA", function () awful.spawn("") end),
-awful.key(nil, "XF86Explorer", function () awful.spawn("") end)
+awful.key(nil, "XF86Explorer", function () awful.spawn("") end),
+awful.key(nil, "XF86Favorites", function () awful.spawn("systemctl suspend") end),
+
+awful.key({ cmdkey }, "Multi_key", function () run_output_notify("flameshot gui") end),
+
+awful.key({ cmdkey }, "Up", function () awful.spawn("pap prev") end),
+awful.key({ cmdkey }, "Left", function () awful.spawn("pap seek -10") end),
+awful.key({ cmdkey, "Shift" }, "Left", function () awful.spawn("pap seek -60") end),
+awful.key({ cmdkey }, "Down", function () awful.spawn("pap next") end),
+awful.key({ cmdkey }, "Right", function () awful.spawn("pap seek +10") end),
+awful.key({ cmdkey, "Shift" }, "Right", function () awful.spawn("pap seek +60") end),
+awful.key({ cmdkey }, "space", function () awful.spawn("pap pause") end),
+awful.key({ cmdkey }, "\\", function () run_output_notify("pap info") end),
+awful.key({ cmdkey }, "]", function () run_output_notify("pap list") end)
 )
 
 )
 
+function run_output_notify(cmd)
+    awful.spawn.easy_async(cmd, function(stdout, stderr, reason, exit_code)
+        naughty.notify({
+            preset = naughty.config.presets.low,
+            title = "Playlist",
+            text = stdout})
+        end)
+end
+
 -- Set keys
 root.keys(globalkeys)
 -- }}}
 -- Set keys
 root.keys(globalkeys)
 -- }}}
@@ -950,7 +998,8 @@ awful.rules.rules = {
                      buttons = clientbuttons,
                      screen = awful.screen.preferred,
                      placement = awful.placement.no_overlap+awful.placement.no_offscreen,
                      buttons = clientbuttons,
                      screen = awful.screen.preferred,
                      placement = awful.placement.no_overlap+awful.placement.no_offscreen,
-                     --floating = false
+                     floating = false,
+                     maximized = false,
                  },
     },
     { rule = { type = "dialog" },
                  },
     },
     { rule = { type = "dialog" },
@@ -966,40 +1015,59 @@ awful.rules.rules = {
     { rule = { class = "URxvt" },
       properties = { size_hints_honor = false, }
     },
     { rule = { class = "URxvt" },
       properties = { size_hints_honor = false, }
     },
-    { rule = { instance =  "irc" },
+    { rule = { instance = "irc" },
       callback = move_to_tag_by_name(nil, "irc"),
     },
       callback = move_to_tag_by_name(nil, "irc"),
     },
-    { rule = { class = "Revolt" },
-      callback = move_to_tag_by_name(nil, "[m]"),
-    },
-    { rule = { class = "Firefox" },
+    { rule_any = { class = { "Firefox", "firefox" } },
       callback = move_to_tag_by_name(nil, "ffx"),
     },
     { rule = { class = "Chromium" },
       callback = move_to_tag_by_name(nil, "chr"),
     },
       callback = move_to_tag_by_name(nil, "ffx"),
     },
     { rule = { class = "Chromium" },
       callback = move_to_tag_by_name(nil, "chr"),
     },
-    { rule = { class = "Thunderbird" },
+    { rule_any = { class = { "thunderbird", "Thunderbird" } },
       callback = move_to_tag_by_name(nil, "cal"),
     },
       callback = move_to_tag_by_name(nil, "cal"),
     },
+    { rule = { instance = "mutt" },
+      properties = {
+          new_tag = {
+              name = "mutt",
+              layout = awful.layout.suit.fair.horizontal,
+              volatile = true
+          },
+          switchtotag = true,
+      },
+    },
     { rule_any = { class = {
     { rule_any = { class = {
-        "MuPDF",
-        "Wicd-client.py",
+        "Gxmessage",
+        "Pinentry"
+    }},
+      properties = { floating = true,
+                     maximized = false,
+                     focus = true,
+                     placement = awful.placement.centered,
+                   },
+    },
+    { rule_any = { instance = {
+        "tridactyl-edit",
+        "pdfshuffler"
     }},
       properties = { floating = true,
     }},
       properties = { floating = true,
+                     maximized = false,
                      focus = true,
                      focus = true,
-                     placement = function(c)
-                         float_client_in_the_middle_with_margins(c, 50, 25)
-                     end,
+                     placement = awful.placement.centered,
                    },
     },
     { rule_any = { class = {
                         "Gscan2pdf",
                         "Gimp",
                    },
     },
     { rule_any = { class = {
                         "Gscan2pdf",
                         "Gimp",
+                        "Inkscape",
+                        "Pitivi",
                     },
                     instance = {
                         "libreoffice",
                     }
                 },
                     },
                     instance = {
                         "libreoffice",
                     }
                 },
+      except_any = { type = { "dialog" } },
       properties = { new_tag = {
                         layout = layouts.maximised,
                         volatile = true,
       properties = { new_tag = {
                         layout = layouts.maximised,
                         volatile = true,
@@ -1044,6 +1112,12 @@ client.connect_signal("manage", function (c)
     -- Set the windows at the slave,
     -- i.e. put it at the end of others instead of setting it master.
     -- if not awesome.startup then awful.client.setslave(c) end
     -- Set the windows at the slave,
     -- i.e. put it at the end of others instead of setting it master.
     -- if not awesome.startup then awful.client.setslave(c) end
+    if not awesome.startup then
+        local t = awful.screen.focused().selected_tag
+        if t.name == "xmutt" then
+            awful.client.setslave(c)
+        end
+    end
 
     if awesome.startup and
       not c.size_hints.user_position
 
     if awesome.startup and
       not c.size_hints.user_position
@@ -1131,10 +1205,10 @@ client.connect_signal("request::activate", function(c, context, hints)
     }, context) then
         gears.timer.delayed_call(function()
             -- we need a delayed call so that we execute *after layout changes
     }, context) then
         gears.timer.delayed_call(function()
             -- we need a delayed call so that we execute *after layout changes
-            centre_mouse_on_area(client.focus)
+            if hints.raise and c == client.focus and client.focus:isvisible() then
+                move_mouse_to_area(client.focus)
+            end
         end)
         end)
-    else
-        dbg.dump(c, context, hints)
     end
 end)
 
     end
 end)