From 0ef6adccc7a9bcbff99fbe093593aa95a8eae7fa Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 8 Feb 2017 17:46:11 +0100 Subject: m 5 awesomecfg: everything literally exploded with awesome4.0 https://github.com/awesomeWM/awesome/issues/967 --- makefu/5pkgs/awesomecfg/full.cfg | 242 +++++++++++++++++++++++---------------- 1 file changed, 142 insertions(+), 100 deletions(-) (limited to 'makefu/5pkgs/awesomecfg/full.cfg') diff --git a/makefu/5pkgs/awesomecfg/full.cfg b/makefu/5pkgs/awesomecfg/full.cfg index f42aea003..d780e2a03 100644 --- a/makefu/5pkgs/awesomecfg/full.cfg +++ b/makefu/5pkgs/awesomecfg/full.cfg @@ -68,7 +68,7 @@ vicious.register(mailwidget, vicious_mails,only_new ,60,"~/Mail/localhost") --mdirwidget = wibox.widget.textbox() --vicious.register(mdirwidget, vicious.widgets.mdir, ) -cpuwidget = awful.widget.graph() +cpuwidget = wibox.widget.graph() -- Graph properties cpuwidget:set_width(50) cpuwidget:set_background_color("#494B4F") @@ -82,23 +82,10 @@ vicious.register(batwidget, vicious.widgets.bat, "$2%", 61, "BAT0") -- {{{ Variable definitions -- Themes define colours, icons, and wallpapers --- beautiful.init("/usr/share/awesome/themes/default/theme.lua") - --- @awesome@/share/awesome/lib/beautiful.lua --- beautiful.init("@awesome@/share/awesome/themes/default/theme.lua") -- Find the default theme -function find_default_theme() - -- find the default lua theme in the package path - for path in package.path:gmatch('([^;]+);') do - if path:match('awesome.*share') then - theme_path = path:match('^([^?]*)') .. '../themes/default/theme.lua' - if awful.util.file_readable(theme_path) then return theme_path end - end - end -end -beautiful.init(find_default_theme()) +beautiful.init(awful.util.get_themes_dir() .. "default/theme.lua") 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) @@ -116,7 +103,7 @@ browser = "firefox" modkey = "@modkey@" -- Table of layouts to cover with awful.layout.inc, order matters. -local layouts = +awful.layout.layouts = { awful.layout.suit.tile, -- awful.layout.suit.tile.left, @@ -128,8 +115,9 @@ local layouts = -- awful.layout.suit.spiral, -- awful.layout.suit.spiral.dwindle, awful.layout.suit.max, - awful.layout.suit.max.fullscreen --- awful.layout.suit.magnifier + awful.layout.suit.max.fullscreen, +-- awful.layout.suit.magnifier, + awful.layout.suit.corner.nw } -- }}} @@ -146,7 +134,6 @@ end tags = {} for s = 1, screen.count() do -- Each screen has its own tag table. - tags[s] = awful.tag({ "tmp", "news", "www", "im", "work1","work2","net","misc","remote" }, s, layouts[1]) end -- }}} @@ -174,11 +161,10 @@ menubar.utils.terminal = terminal -- Set the terminal for applications that requ -- {{{ Wibox -- Create a textclock widget -mytextclock = awful.widget.textclock() +mytextclock = wibox.widget.textclock() -- Create a wibox for each screen and add it mywibox = {} -mypromptbox = {} mylayoutbox = {} mytaglist = {} mytaglist.buttons = awful.util.table.join( @@ -224,49 +210,67 @@ mytasklist.buttons = awful.util.table.join( if client.focus then client.focus:raise() end end)) -for s = 1, screen.count() do +local function set_wallpaper(s) + -- Wallpaper + if beautiful.wallpaper then + local wallpaper = beautiful.wallpaper + -- If wallpaper is a function, call it with the screen + if type(wallpaper) == "function" then + wallpaper = wallpaper(s) + end + gears.wallpaper.maximized(wallpaper, s, true) + end +end + +awful.screen.connect_for_each_screen(function(s) + -- Wallpaper + set_wallpaper(s) + + -- Each screen has its own tag table. + awful.tag({ "tmp", "news", "www", "im", "work1","work2","net","misc","remote" }, s, awful.layout.layouts[1]) + -- Create a promptbox for each screen - mypromptbox[s] = awful.widget.prompt() + s.mypromptbox = 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) - mylayoutbox[s]:buttons(awful.util.table.join( - awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), - awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), - awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), - awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) + 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))) -- Create a taglist widget - mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons) + s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons) -- Create a tasklist widget - mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) + s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons) -- Create the wibox - mywibox[s] = awful.wibox({ position = "top", screen = s }) - - -- 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() - right_layout:add(mailwidget) - if s == 1 then right_layout:add(wibox.widget.systray()) end - right_layout:add(cpuwidget) - right_layout:add(batwidget) - 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 + s.mywibox = awful.wibar({ position = "top", screen = s }) + + -- Add widgets to the wibox + s.mywibox:setup { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + mylauncher, + s.mytaglist, + s.mypromptbox, + }, + s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + mykeyboardlayout, + mailwidget, + wibox.widget.systray(), + cpuwidget, + batwidget, + mytextclock, + s.mylayoutbox, + }, + } +end) + -- }}} -- {{{ Mouse bindings @@ -310,20 +314,41 @@ globalkeys = awful.util.table.join( end), -- Standard program - awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), - awful.key({ modkey, "Control" }, "r", awesome.restart), - awful.key({ modkey, "Shift" }, "q", awesome.quit), - - awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), - awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), - awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), - awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), - awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), - awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), - awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), - awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), - - awful.key({ modkey, "Control" }, "n", awful.client.restore), + awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, + {description = "open a terminal", group = "launcher"}), + awful.key({ modkey, "Control" }, "r", awesome.restart, + {description = "reload awesome", group = "awesome"}), + awful.key({ modkey, "Shift" }, "q", awesome.quit, + {description = "quit awesome", group = "awesome"}), + + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end, + {description = "increase master width factor", group = "layout"}), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end, + {description = "decrease master width factor", group = "layout"}), + awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end, + {description = "increase the number of master clients", group = "layout"}), + awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end, + {description = "decrease the number of master clients", group = "layout"}), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, + {description = "increase the number of columns", group = "layout"}), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, + {description = "decrease the number of columns", group = "layout"}), + awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, + {description = "select next", group = "layout"}), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end, + {description = "select previous", group = "layout"}), + awful.key({ modkey, "Control" }, "n", + function () + local c = awful.client.restore() + -- Focus restored client + if c then + client.focus = c + c:raise() + end + end, + {description = "restore minimized", group = "client"}), + + awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer set Master 5%+", false) end), awful.key({ }, "XF86AudioLowerVolume", function () @@ -332,18 +357,23 @@ globalkeys = awful.util.table.join( awful.util.spawn("amixer -q -D default sset Master toggle", false) end), -- Prompt - awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end), + awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, + {description = "run prompt", group = "launcher"}), -- awful.key({ modkey }, "r", function () awful.util.spawn( "dmenu_run" ) end ), awful.key({ modkey,"Control" }, "BackSpace", function () awful.util.spawn("xlock -mode blank") end), awful.key({ }, "XF86ScreenSaver", function () awful.util.spawn("xlock -mode blank") end), - awful.key({ modkey }, "x", - function () - awful.prompt.run({ prompt = "Run Lua code: " }, - mypromptbox[mouse.screen].widget, - awful.util.eval, nil, - awful.util.getdir("cache") .. "/history_eval") - end), + awful.key({ modkey }, "x", + 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 = "lua execute prompt", group = "awesome"}), + -- Menubar awful.key({ modkey }, "p", function() menubar.show() end) ) @@ -370,43 +400,55 @@ clientkeys = awful.util.table.join( -- 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 screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + tag:view_only() end - end), + end, + {description = "view tag #"..i, group = "tag"}), + -- Toggle tag display. awful.key({ modkey, "Control" }, "#" .. i + 9, function () - local screen = mouse.screen - if tags[screen][i] then - awful.tag.viewtoggle(tags[screen][i]) + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + awful.tag.viewtoggle(tag) end - end), + end, + {description = "toggle tag #" .. i, group = "tag"}), + -- 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 - end), + 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 and tags[client.focus.screen][i] then - awful.client.toggletag(tags[client.focus.screen][i]) + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:toggle_tag(tag) + end end - end)) + end, + {description = "toggle focused client on tag #" .. i, group = "tag"}) + ) 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), -- cgit v1.2.3