]> projects.mako.cc - awesome-config/commitdiff
add submodule for volume plus several other changes
authorBenjamin Mako Hill <mako@atdot.cc>
Fri, 9 Oct 2020 16:51:06 +0000 (09:51 -0700)
committerBenjamin Mako Hill <mako@atdot.cc>
Fri, 9 Oct 2020 16:51:06 +0000 (09:51 -0700)
- fixed timezone issues
- added volume widget (with submodule)
- add textclock widget

.gitmodules [new file with mode: 0644]
rc.lua
volume-control [new submodule]

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..1e4a3ee
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "volume-control"]
+       path = volume-control
+       url = https://github.com/deficient/volume-control.git
diff --git a/rc.lua b/rc.lua
index 5d0f4a9421b5ecebed4f0c0ed5d7824b4ef032b7..c2c26c452d52c7a9c5a9b141846263bfc2f3ef51 100644 (file)
--- a/rc.lua
+++ b/rc.lua
@@ -1,3 +1,16 @@
+-- read the timezone from /etc/timezone (this doesn't work, somehow)
+local function read_tz_file(path)
+    local file = io.open(path, "r") -- r read mode and b binary mode
+    if not file then return nil end
+    local content = file:read "*a" -- *a or *all reads the whole file
+    file:close()
+    content = content:gsub("^%s*", "")
+    content = content:gsub("%s*$", "")
+    return content
+end
+
+local tz_string = read_tz_file("/etc/timezone")
+
 -- Standard awesome library
 local gears = require("gears")
 local awful = require("awful")
@@ -11,6 +24,10 @@ local naughty = require("naughty")
 local menubar = require("menubar")
 local hotkeys_popup = require("awful.hotkeys_popup").widget
 
+-- load the volume widget code and set settings
+local volume_control = require("volume-control")
+volumecfg = volume_control({})
+
 -- Load Debian menu entries
 require("debian.menu")
 
@@ -108,7 +125,7 @@ mykeyboardlayout = awful.widget.keyboardlayout()
 
 -- {{{ Wibar
 -- Create a textclock widget
-mytextclock = wibox.widget.textclock()
+mytextclock = wibox.widget.textclock("%a %m %d %H:%M", 60, tz_string)
 
 -- Create a wibox for each screen and add it
 local taglist_buttons = awful.util.table.join(
@@ -208,6 +225,7 @@ awful.screen.connect_for_each_screen(function(s)
             layout = wibox.layout.fixed.horizontal,
             mykeyboardlayout,
             wibox.widget.systray(),
+           -- volumecfg.widget,
             mytextclock,
             s.mylayoutbox,
         },
@@ -215,6 +233,8 @@ awful.screen.connect_for_each_screen(function(s)
 end)
 -- }}}
 
+-- right_layout:add(volumecfg.widget)
+
 -- {{{ Mouse bindings
 root.buttons(awful.util.table.join(
     awful.button({ }, 3, function () mymainmenu:toggle() end),
@@ -425,7 +445,10 @@ for i = 1, 9 do
                           end
                       end
                   end,
-                  {description = "toggle focused client on tag #" .. i, group = "tag"})
+                  {description = "toggle focused client on tag #" .. i, group = "tag"}),
+        awful.key({}, "XF86AudioRaiseVolume", function() volumecfg:up() end),
+        awful.key({}, "XF86AudioLowerVolume", function() volumecfg:down() end),
+        awful.key({}, "XF86AudioMute",        function() volumecfg:toggle() end)
     )
 end
 
diff --git a/volume-control b/volume-control
new file mode 160000 (submodule)
index 0000000..56dee54
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 56dee54d7711a8be619d339bf66747db2e13cd17

Benjamin Mako Hill || Want to submit a patch?