]> git.rmz.io Git - dotfiles.git/blobdiff - awesome/rc.lua
add a shutdown menu
[dotfiles.git] / awesome / rc.lua
index 454d441eba005940dfdf16d5d082c41a6a056607..cd9fb2d64919d7e2d94dbf7be2d0f74c236745ae 100644 (file)
@@ -67,6 +67,12 @@ end
 -- }}}
 
 -- {{{ Menu
 -- }}}
 
 -- {{{ Menu
+-- Setup global menu keys
+awful.menu.menu_keys.up    = { "k", "Up"}
+awful.menu.menu_keys.down  = { "j", "Down"}
+awful.menu.menu_keys.enter = { "l", "Right"}
+awful.menu.menu_keys.back  = { "h", "Left"}
+
 -- Create a laucher widget and a main menu
 myawesomemenu = {
    { "manual", terminal .. " -e man awesome" },
 -- Create a laucher widget and a main menu
 myawesomemenu = {
    { "manual", terminal .. " -e man awesome" },
@@ -83,6 +89,12 @@ mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesom
 mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
                                      menu = mymainmenu })
 
 mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
                                      menu = mymainmenu })
 
+myshutdownmenu = awful.menu({ items = { { "shutdown", "systemctl poweroff" },
+                                        { "restart",  "systemctl restart"  },
+                                        { "suspend",  "systemctl suspend"  },
+                                      }
+                            })
+
 -- Menubar configuration
 menubar.utils.terminal = terminal -- Set the terminal for applications that require it
 -- }}}
 -- Menubar configuration
 menubar.utils.terminal = terminal -- Set the terminal for applications that require it
 -- }}}
@@ -122,6 +134,7 @@ mytasklist.buttons = awful.util.table.join(
                                                   c:raise()
                                               end
                                           end),
                                                   c:raise()
                                               end
                                           end),
+                     awful.button({ }, 2, function (c) c:kill() end),
                      awful.button({ }, 3, function ()
                                               if instance then
                                                   instance:hide()
                      awful.button({ }, 3, function ()
                                               if instance then
                                                   instance:hide()
@@ -185,26 +198,8 @@ end
 -- Mouse/Key Bindings
 require("bindings")
 
 -- Mouse/Key Bindings
 require("bindings")
 
--- {{{ Rules
-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,
-                     keys = clientkeys,
-                     buttons = clientbuttons } },
-    { rule = { class = "MPlayer" },
-      properties = { floating = true } },
-    { rule = { class = "pinentry" },
-      properties = { floating = true } },
-    { rule = { class = "gimp" },
-      properties = { floating = true } },
-    -- Set Firefox to always map on tags number 2 of screen 1.
-    -- { rule = { class = "Firefox" },
-    --   properties = { tag = tags[1][2] } },
-}
--- }}}
+-- Rules
+require("rules")
 
 -- {{{ Signals
 -- Signal function to execute when a new client appears.
 
 -- {{{ Signals
 -- Signal function to execute when a new client appears.
@@ -228,51 +223,6 @@ client.connect_signal("manage", function (c, startup)
             awful.placement.no_offscreen(c)
         end
     end
             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)
 
 client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
 end)
 
 client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)