From: root Samara Date: Tue, 9 Feb 2016 17:34:51 +0000 (+0100) Subject: saving uncommitted changes in /etc prior to emerge run X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=39ed6fb679e41f0ebe515b57be5db5c8a37367cf;p=config%2Fsamara%2Fetc.git saving uncommitted changes in /etc prior to emerge run --- diff --git a/xdg/awesome/rc.lua b/xdg/awesome/rc.lua index c8f0a92..b318328 100644 --- a/xdg/awesome/rc.lua +++ b/xdg/awesome/rc.lua @@ -1,11 +1,15 @@ -- Standard awesome library -require("awful") +local gears = require("gears") +local awful = require("awful") +awful.rules = require("awful.rules") require("awful.autofocus") -require("awful.rules") +-- Widget and layout library +local wibox = require("wibox") -- Theme handling library -require("beautiful") +local beautiful = require("beautiful") -- Notification library -require("naughty") +local naughty = require("naughty") +local menubar = require("menubar") -- {{{ Error handling -- Check if awesome encountered an error during startup and fell back to @@ -19,7 +23,7 @@ end -- Handle runtime errors after startup do local in_error = false - awesome.add_signal("debug::error", function (err) + 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 @@ -33,7 +37,7 @@ end -- }}} -- {{{ Variable definitions --- Themes define colours, icons, and wallpapers +-- Themes define colours, icons, font and wallpapers. beautiful.init("/usr/share/awesome/themes/default/theme.lua") -- This is used later as the default terminal and editor to run. @@ -49,7 +53,7 @@ editor_cmd = terminal .. " -e " .. editor modkey = "Mod4" -- Table of layouts to cover with awful.layout.inc, order matters. -layouts = +local layouts = { awful.layout.suit.floating, awful.layout.suit.tile, @@ -66,6 +70,14 @@ layouts = } -- }}} +-- {{{ Wallpaper +if beautiful.wallpaper then + for s = 1, screen.count() do + gears.wallpaper.maximized(beautiful.wallpaper, s, true) + end +end +-- }}} + -- {{{ Tags -- Define a tag table which hold all screen tags. tags = {} @@ -89,16 +101,16 @@ mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesom } }) -mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), +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({ align = "right" }) - --- Create a systray -mysystray = widget({ type = "systray" }) +mytextclock = awful.widget.textclock() -- Create a wibox for each screen and add it mywibox = {} @@ -110,8 +122,8 @@ mytaglist.buttons = awful.util.table.join( awful.button({ modkey }, 1, awful.client.movetotag), awful.button({ }, 3, awful.tag.viewtoggle), awful.button({ modkey }, 3, awful.client.toggletag), - awful.button({ }, 4, awful.tag.viewnext), - awful.button({ }, 5, awful.tag.viewprev) + 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( @@ -119,6 +131,9 @@ mytasklist.buttons = awful.util.table.join( 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 @@ -133,7 +148,9 @@ mytasklist.buttons = awful.util.table.join( instance:hide() instance = nil else - instance = awful.menu.clients({ width=250 }) + instance = awful.menu.clients({ + theme = { width = 250 } + }) end end), awful.button({ }, 4, function () @@ -147,7 +164,7 @@ mytasklist.buttons = awful.util.table.join( for s = 1, screen.count() do -- Create a promptbox for each screen - mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright }) + mypromptbox[s] = awful.widget.prompt() -- Create an imagebox widget which will contains an icon indicating which layout we're using. -- We need one layoutbox per screen. mylayoutbox[s] = awful.widget.layoutbox(s) @@ -157,29 +174,33 @@ for s = 1, screen.count() do awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) -- Create a taglist widget - mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons) + mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons) -- Create a tasklist widget - mytasklist[s] = awful.widget.tasklist(function(c) - return awful.widget.tasklist.label.currenttags(c, s) - end, mytasklist.buttons) + mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) -- Create the wibox mywibox[s] = awful.wibox({ position = "top", screen = s }) - -- Add widgets to the wibox - order matters - mywibox[s].widgets = { - { - mylauncher, - mytaglist[s], - mypromptbox[s], - layout = awful.widget.layout.horizontal.leftright - }, - mylayoutbox[s], - mytextclock, - s == 1 and mysystray or nil, - mytasklist[s], - layout = awful.widget.layout.horizontal.rightleft - } + + -- 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(mytextclock) + right_layout:add(mylayoutbox[s]) + + -- 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 -- }}} @@ -207,7 +228,7 @@ globalkeys = awful.util.table.join( awful.client.focus.byidx(-1) if client.focus then client.focus:raise() end end), - awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end), + awful.key({ modkey, }, "w", function () mymainmenu:show() end), -- Layout manipulation awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), @@ -248,7 +269,9 @@ globalkeys = awful.util.table.join( mypromptbox[mouse.screen].widget, awful.util.eval, nil, awful.util.getdir("cache") .. "/history_eval") - end) + end), + -- Menubar + awful.key({ modkey }, "p", function() menubar.show() end) ) clientkeys = awful.util.table.join( @@ -257,7 +280,6 @@ clientkeys = awful.util.table.join( 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, "Shift" }, "r", function (c) c:redraw() end), awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end), awful.key({ modkey, }, "n", function (c) @@ -272,41 +294,47 @@ clientkeys = awful.util.table.join( end) ) --- Compute the maximum number of digit we need, limited to 9 -keynumber = 0 -for s = 1, screen.count() do - keynumber = math.min(9, math.max(#tags[s], keynumber)); -end - -- 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, keynumber do +for i = 1, 9 do globalkeys = awful.util.table.join(globalkeys, + -- View tag only. awful.key({ modkey }, "#" .. i + 9, function () local screen = mouse.screen - if tags[screen][i] then - awful.tag.viewonly(tags[screen][i]) + local tag = awful.tag.gettags(screen)[i] + if tag then + awful.tag.viewonly(tag) end end), + -- Toggle tag. awful.key({ modkey, "Control" }, "#" .. i + 9, function () local screen = mouse.screen - if tags[screen][i] then - awful.tag.viewtoggle(tags[screen][i]) + local tag = awful.tag.gettags(screen)[i] + if tag then + awful.tag.viewtoggle(tag) end end), + -- Move client to tag. awful.key({ modkey, "Shift" }, "#" .. i + 9, function () - if client.focus and tags[client.focus.screen][i] then - awful.client.movetotag(tags[client.focus.screen][i]) - end + if client.focus then + local tag = awful.tag.gettags(client.focus.screen)[i] + if tag then + awful.client.movetotag(tag) + end + end end), + -- Toggle tag. awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, function () - if client.focus and tags[client.focus.screen][i] then - awful.client.toggletag(tags[client.focus.screen][i]) + if client.focus then + local tag = awful.tag.gettags(client.focus.screen)[i] + if tag then + awful.client.toggletag(tag) + end end end)) end @@ -321,12 +349,14 @@ 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 = true, + focus = awful.client.focus.filter, + raise = true, keys = clientkeys, buttons = clientbuttons } }, { rule = { class = "MPlayer" }, @@ -343,12 +373,9 @@ awful.rules.rules = { -- {{{ Signals -- Signal function to execute when a new client appears. -client.add_signal("manage", function (c, startup) - -- Add a titlebar - -- awful.titlebar.add(c, { modkey = modkey }) - +client.connect_signal("manage", function (c, startup) -- Enable sloppy focus - c:add_signal("mouse::enter", function(c) + 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 @@ -366,8 +393,53 @@ client.add_signal("manage", function (c, startup) 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.add_signal("focus", function(c) c.border_color = beautiful.border_focus end) -client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) +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) -- }}}