diff options
Diffstat (limited to 'config/awesome')
-rw-r--r-- | config/awesome/rc.lua | 136 | ||||
-rw-r--r-- | config/awesome/themes/weasel/theme.lua | 70 | ||||
-rw-r--r-- | config/awesome/volume.lua | 80 |
3 files changed, 220 insertions, 66 deletions
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") diff --git a/config/awesome/themes/weasel/theme.lua b/config/awesome/themes/weasel/theme.lua index 32e9bb7..09914b6 100644 --- a/config/awesome/themes/weasel/theme.lua +++ b/config/awesome/themes/weasel/theme.lua @@ -1,7 +1,19 @@ theme = {} + +theme.font = "sans 8" + theme.bg_normal = "#222222" theme.bg_focus = "#666d8c" +theme.bg_urgent = "#ff0000" +theme.bg_systray = theme.bg_normal + +theme.fg_normal = "#aaaaaa" +theme.fg_focus = "#ffffff" +theme.fg_urgent = "#ffffff" + +theme.bg_minimize = "#000000" +theme.fg_minimize = "#555555" theme.border_width = 1 theme.border_normal = "#222222" @@ -9,6 +21,64 @@ theme.border_focus = "#009966" theme.wallpaper = "/usr/share/wallpapers/joy/contents/images/1920x1200.png" + + +---- Display the taglist squares +theme.taglist_squares_sel = "/usr/share/awesome/themes/default/taglist/squarefw.png" +theme.taglist_squares_unsel = "/usr/share/awesome/themes/default/taglist/squarew.png" + +theme.layout_fairh = "/usr/share/awesome/themes/default/layouts/fairhw.png" +theme.layout_fairv = "/usr/share/awesome/themes/default/layouts/fairvw.png" +theme.layout_floating = "/usr/share/awesome/themes/default/layouts/floatingw.png" +theme.layout_magnifier = "/usr/share/awesome/themes/default/layouts/magnifierw.png" +theme.layout_max = "/usr/share/awesome/themes/default/layouts/maxw.png" +theme.layout_fullscreen = "/usr/share/awesome/themes/default/layouts/fullscreenw.png" +theme.layout_tilebottom = "/usr/share/awesome/themes/default/layouts/tilebottomw.png" +theme.layout_tileleft = "/usr/share/awesome/themes/default/layouts/tileleftw.png" +theme.layout_tile = "/usr/share/awesome/themes/default/layouts/tilew.png" +theme.layout_tiletop = "/usr/share/awesome/themes/default/layouts/tiletopw.png" +theme.layout_spiral = "/usr/share/awesome/themes/default/layouts/spiralw.png" +theme.layout_dwindle = "/usr/share/awesome/themes/default/layouts/dwindlew.png" + + + +--theme.border_marked = "#91231c" +theme.border_marked = "#00ff00" + +---- Variables set for theming the menu: +---- menu_[bg|fg]_[normal|focus] +---- menu_[border_color|border_width] +--theme.menu_submenu_icon = "/usr/share/awesome/themes/default/submenu.png" +--theme.menu_height = 15 +--theme.menu_width = 100 + +---- Define the image to load +theme.titlebar_close_button_normal = "/usr/share/awesome/themes/default/titlebar/close_normal.png" +theme.titlebar_close_button_focus = "/usr/share/awesome/themes/default/titlebar/close_focus.png" + +theme.titlebar_ontop_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/ontop_normal_inactive.png" +theme.titlebar_ontop_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/ontop_focus_inactive.png" +theme.titlebar_ontop_button_normal_active = "/usr/share/awesome/themes/default/titlebar/ontop_normal_active.png" +theme.titlebar_ontop_button_focus_active = "/usr/share/awesome/themes/default/titlebar/ontop_focus_active.png" + +theme.titlebar_sticky_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/sticky_normal_inactive.png" +theme.titlebar_sticky_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/sticky_focus_inactive.png" +theme.titlebar_sticky_button_normal_active = "/usr/share/awesome/themes/default/titlebar/sticky_normal_active.png" +theme.titlebar_sticky_button_focus_active = "/usr/share/awesome/themes/default/titlebar/sticky_focus_active.png" + +theme.titlebar_floating_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/floating_normal_inactive.png" +theme.titlebar_floating_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/floating_focus_inactive.png" +theme.titlebar_floating_button_normal_active = "/usr/share/awesome/themes/default/titlebar/floating_normal_active.png" +theme.titlebar_floating_button_focus_active = "/usr/share/awesome/themes/default/titlebar/floating_focus_active.png" + +theme.titlebar_maximized_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/maximized_normal_inactive.png" +theme.titlebar_maximized_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/maximized_focus_inactive.png" +theme.titlebar_maximized_button_normal_active = "/usr/share/awesome/themes/default/titlebar/maximized_normal_active.png" +theme.titlebar_maximized_button_focus_active = "/usr/share/awesome/themes/default/titlebar/maximized_focus_active.png" + +theme.awesome_icon = "/usr/share/awesome/icons/awesome16.png" +theme.icon_theme = nil + -- XX -- -- XX --theme.font = "sans 8" -- XX -- diff --git a/config/awesome/volume.lua b/config/awesome/volume.lua new file mode 100644 index 0000000..bd1d1fb --- /dev/null +++ b/config/awesome/volume.lua @@ -0,0 +1,80 @@ +-- from https://awesome.naquadah.org/wiki/Volume_control_and_display +-- 2016-12-13 + +--local wibox = require("wibox") +--local awful = require("awful") +-- +--volume_widget = wibox.widget.textbox() +--volume_widget:set_align("right") +-- +--function update_volume(widget) +-- local fd = io.popen("amixer sget Master") +-- local status = fd:read("*all") +-- fd:close() +-- +-- local volume = tonumber(string.match(status, "(%d?%d?%d)%%")) / 100 +-- -- volume = string.format("% 3d", volume) +-- +-- status = string.match(status, "%[(o[^%]]*)%]") +-- +-- -- starting colour +-- local sr, sg, sb = 0x3F, 0x3F, 0x3F +-- -- ending colour +-- local er, eg, eb = 0xDC, 0xDC, 0xCC +-- +-- local ir = math.floor(volume * (er - sr) + sr) +-- local ig = math.floor(volume * (eg - sg) + sg) +-- local ib = math.floor(volume * (eb - sb) + sb) +-- interpol_colour = string.format("%.2x%.2x%.2x", ir, ig, ib) +-- if string.find(status, "on", 1, true) then +-- volume = " <span background='#" .. interpol_colour .. "'> </span>" +-- else +-- volume = " <span color='red' background='#" .. interpol_colour .. "'> M </span>" +-- end +-- widget:set_markup(volume) +--end +-- +--update_volume(volume_widget) +-- +--mytimer = timer({ timeout = 1 }) +--mytimer:connect_signal("timeout", function () update_volume(volume_widget) end) +--mytimer:start() +local wibox = require("wibox") +local awful = require("awful") + +volume_widget = wibox.widget.textbox() +volume_widget:set_align("right") + +function update_volume(widget) + local fd = io.popen("amixer sget Master") + local status = fd:read("*all") + fd:close() + + -- local volume = tonumber(string.match(status, "(%d?%d?%d)%%")) / 100 + local volume = string.match(status, "(%d?%d?%d)%%") + volume = string.format("% 3d", volume) + + status = string.match(status, "%[(o[^%]]*)%]") + + if string.find(status, "on", 1, true) then + -- For the volume numbers + volume = volume .. "%" + else + -- For the mute button + volume = "<span color='red'>" .. volume .. "%</span>" + end + widget:set_markup(volume) +end + +update_volume(volume_widget) + +-- mytimer = timer({ timeout = 0.2 }) +-- mytimer:connect_signal("timeout", function () update_volume(volume_widget) end) +-- mytimer:start() + +dbus.request_name("session", "com.ch1p.avm") +dbus.add_match("session", "interface='com.ch1p.avm',member='valueChanged'") +dbus.connect_signal("com.ch1p.avm", function() + update_volume(volume_widget) + end +) |