From 2b642e582ad79d54c195011f0d51f61f91966ac4 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 13 Dec 2016 14:37:08 +0100 Subject: volume control and more --- config/awesome/rc.lua | 136 ++++++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 66 deletions(-) (limited to 'config/awesome/rc.lua') diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index 6d4c95e..300bf47 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -13,6 +13,8 @@ local menubar = require("menubar") -- Load Debian menu entries require("debian.menu") +require("volume") +-- require("revelation") -- {{{ Error handling -- Check if awesome encountered an error during startup and fell back to @@ -64,7 +66,7 @@ local layouts = awful.layout.suit.tile.bottom, -- awful.layout.suit.tile.top, awful.layout.suit.fair, - -- awful.layout.suit.fair.horizontal, + awful.layout.suit.fair.horizontal, -- awful.layout.suit.spiral, -- awful.layout.suit.spiral.dwindle, awful.layout.suit.max, @@ -185,7 +187,8 @@ for s = 1, screen.count() do mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons) -- Create a tasklist widget - mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) + -- mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) + mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.alltags, mytasklist.buttons) -- Create the wibox mywibox[s] = awful.wibox({ position = "top", screen = s }) @@ -199,6 +202,7 @@ for s = 1, screen.count() do -- 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(volume_widget) right_layout:add(mytextclock) right_layout:add(mylayoutbox[s]) @@ -236,7 +240,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() end), + -- awful.key({ modkey, }, "w", function () mymainmenu:show() end), -- Layout manipulation awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), @@ -253,9 +257,9 @@ globalkeys = awful.util.table.join( end), -- Standard program - awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), + -- 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, "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), @@ -266,7 +270,7 @@ globalkeys = awful.util.table.join( 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, "Control" }, "n", awful.client.restore), -- Prompt -- awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end), @@ -281,14 +285,32 @@ globalkeys = awful.util.table.join( -- weasel awful.key({ modkey }, "`", function () mypromptbox[mouse.screen]:run() end), + awful.key({ "Ctrl", "Mod1" }, "BackSpace", awesome.quit), awful.key({ modkey }, "x", function () awful.util.spawn_with_shell("urxvt") end), awful.key({ modkey }, "m", function () awful.util.spawn_with_shell("xterm-mail") end), awful.key({ modkey, "Shift" }, "m", function () awful.util.spawn_with_shell("xterm-mail-cosy") end), awful.key({ modkey }, "i", function () awful.util.spawn_with_shell("xterm-irc") end), + awful.key({ "Control", "Mod1"}, "l", function () awful.util.spawn_with_shell("xscreensaver-command -lock") end), + awful.key({ modkey, }, "Up" , function () awful.tag.viewidx(-5) end ), awful.key({ modkey, }, "Down", function () awful.tag.viewidx( 5) end ), + + awful.key({ }, "XF86AudioRaiseVolume", function () + awful.util.spawn("amixer -q -D default sset Master 5%+", false) end), + awful.key({ }, "XF86AudioLowerVolume", function () + awful.util.spawn("amixer -q -D default sset Master 5%-", false) end), + awful.key({ "Shift" }, "XF86AudioRaiseVolume", function () + awful.util.spawn("amixer -q -D default sset Master 1%+", false) end), + awful.key({ "Shift" }, "XF86AudioLowerVolume", function () + awful.util.spawn("amixer -q -D default sset Master 1%-", false) end), + awful.key({ }, "XF86AudioMute", function () + awful.util.spawn("amixer -q -D default sset Master toggle", false) end), + + + -- awful.key( {"Ctrl"}, "Tab", revelation), + -- Menubar awful.key({ modkey }, "p", function() menubar.show() end) ) @@ -302,13 +324,34 @@ globalkeys = awful.util.table.join( for i = 1, #tag_keys do globalkeys = awful.util.table.join(globalkeys, -- View tag only. - awful.key({ "Mod3" }, tag_keys[i], function () local screen = mouse.screen local tag = awful.tag.gettags(screen)[i] if tag then awful.tag.viewonly(tag) end end), + awful.key({ "Mod3" }, tag_keys[i], function () + local screen = mouse.screen + local tag = awful.tag.gettags(screen)[i] + if tag then awful.tag.viewonly(tag) end + end), -- Toggle tag. - awful.key({ "Mod3", "Control" }, tag_keys[i], function () local screen = mouse.screen local tag = awful.tag.gettags(screen)[i] if tag then awful.tag.viewtoggle(tag) end end), + awful.key({ "Mod3", "Shift" }, tag_keys[i], function () + local screen = mouse.screen + local tag = awful.tag.gettags(screen)[i] + if tag then awful.tag.viewtoggle(tag) end + end), -- Move client to tag. - awful.key({ "Mod3", "Shift" }, tag_keys[i], function () if client.focus then local tag = awful.tag.gettags(client.focus.screen)[i] if tag then awful.client.movetotag(tag) end end end), + awful.key({ "Mod3", "Control" }, tag_keys[i], function () + if client.focus then + local tag = awful.tag.gettags(client.focus.screen)[i] + if tag then + awful.client.movetotag(tag) + -- awful.tag.viewonly(tag) + end + end + end), -- Toggle tag. - awful.key({ "Mod3", "Control", "Shift" }, tag_keys[i], function () if client.focus then local tag = awful.tag.gettags(client.focus.screen)[i] if tag then awful.client.toggletag(tag) end end end) + awful.key({ "Mod3", "Control", "Shift" }, tag_keys[i], function () + if client.focus then + local tag = awful.tag.gettags(client.focus.screen)[i] + if tag then awful.client.toggletag(tag) end + end + end) ) end @@ -316,12 +359,15 @@ clientkeys = awful.util.table.join( awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end), -- awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end), 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, }, "Return", function (c) c:swap(awful.client.getmaster()) end), awful.key({ modkey, }, "o", awful.client.movetoscreen ), - awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end), + -- awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end), -- weasel - awful.key({ modkey }, "Escape", function (c) c:kill() end), + awful.key({ modkey }, "q", function (c) c.sticky = not c.sticky end), + + + awful.key({ modkey }, "Escape", function (c) c:kill() end) --awful.key({ modkey, }, "n", -- function (c) @@ -329,58 +375,13 @@ clientkeys = awful.util.table.join( -- -- minimized, since minimized clients can't have the focus. -- c.minimized = true -- end), - awful.key({ modkey, }, "m", - function (c) - c.maximized_horizontal = not c.maximized_horizontal - c.maximized_vertical = not c.maximized_vertical - end) + -- awful.key({ modkey, }, "m", + -- function (c) + -- c.maximized_horizontal = not c.maximized_horizontal + -- c.maximized_vertical = not c.maximized_vertical + -- 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, 9 do - globalkeys = awful.util.table.join(globalkeys, - -- View tag only. - awful.key({ modkey }, "#" .. i + 9, - function () - local screen = mouse.screen - 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 - 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 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 then - local tag = awful.tag.gettags(client.focus.screen)[i] - if tag then - awful.client.toggletag(tag) - end - end - end)) -end - clientbuttons = awful.util.table.join( awful.button({ }, 1, function (c) client.focus = c; c:raise() end), awful.button({ "Mod1" }, 1, awful.mouse.client.move), @@ -439,7 +440,8 @@ client.connect_signal("manage", function (c, startup) awful.placement.no_offscreen(c) end - local titlebars_enabled = false + -- local titlebars_enabled = false + local titlebars_enabled = true if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then -- buttons for the titlebar local buttons = awful.util.table.join( @@ -463,9 +465,9 @@ client.connect_signal("manage", function (c, startup) -- 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.maximizedbutton(c)) right_layout:add(awful.titlebar.widget.stickybutton(c)) - right_layout:add(awful.titlebar.widget.ontopbutton(c)) + --right_layout:add(awful.titlebar.widget.ontopbutton(c)) right_layout:add(awful.titlebar.widget.closebutton(c)) -- The title goes in the middle @@ -492,3 +494,5 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n terminal = "urxvt" awful.util.spawn("nm-applet") awful.util.spawn("xscreensaver -no-splash") +awful.util.spawn_with_shell("pkill -x -f clipit; clipit") +awful.util.spawn_with_shell("pkill -x -f 'alsa-volume-monitor hw:0'; alsa-volume-monitor hw:0") -- cgit v1.2.3