about summary refs log tree commit diff
path: root/awesome
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-03-15 20:27:20 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2019-03-15 20:27:20 +0700
commitd96622187e7886c889f04f553e449c4088ea76c0 (patch)
treea823362a2cee411e984a096265a14140b26e3216 /awesome
parent63aa1e7bdc67222bb50ca6029a6d5019c0cb7d4f (diff)
downloaddotfiles-d96622187e7886c889f04f553e449c4088ea76c0.tar.gz
Update 2019-03-15
Diffstat (limited to 'awesome')
-rw-r--r--awesome/.config/awesome/rc.lua21
1 files changed, 18 insertions, 3 deletions
diff --git a/awesome/.config/awesome/rc.lua b/awesome/.config/awesome/rc.lua
index bc67455..d06d343 100644
--- a/awesome/.config/awesome/rc.lua
+++ b/awesome/.config/awesome/rc.lua
@@ -213,14 +213,29 @@ myvolume:buttons(awful.util.table.join(
 ))
 
 -- Create a widget for music player
-local myplayer = wibox.widget.textbox()
+local myplayer_text = wibox.widget.textbox()
 awful.spawn.with_line_callback(
   "playerctl --follow metadata --format ' {{artist}} <{{status}}> {{title}}'",
   {stdout = function (line)
-     myplayer:set_text(line:gsub('<Playing>', '>'):gsub('<.+>', '|'))
+     myplayer_text:set_text(line:gsub('<Playing>', '>'):gsub('<.+>', '|'))
    end}
 )
 
+local function audacious_seeker(time)
+  return function ()
+    awful.spawn(("audtool playback-seek-relative %f"):format(time))
+  end
+end
+
+local myplayer = wibox.container.background(myplayer_text, "#b16286")
+myplayer:buttons(awful.util.table.join(
+  awful.button({}, 1, spawner(audacious_rewind)),
+  awful.button({}, 2, spawner(audacious_play_pause)),
+  awful.button({}, 3, spawner(audacious_forward)),
+  awful.button({}, 4, audacious_seeker(1)),
+  awful.button({}, 5, audacious_seeker(-1))
+))
+
 -- Create a weather widget
 local myweather = wibox.widget.textbox()
 vicious.register(myweather, vicious.widgets.weather,
@@ -323,7 +338,7 @@ awful.screen.connect_for_each_screen(function (s)
       wibox.widget.imagebox(beautiful.arrow4),
       wibox.container.background(myweather, "#458588"),
       wibox.widget.imagebox(beautiful.arrow5),
-      wibox.container.background(myplayer, "#b16286"),
+      myplayer,
       wibox.widget.imagebox(beautiful.arrow6),
       s.mypromptbox
     },