How to get autotimer to work?
Hi @madprops I found your github page from the reddit post. I am interested to get it working on my setup.
I added the files to the root folder of my awesome configs
https://github.com/madprops/awesome-setup/blob/master/madwidgets/autotimer/autotimer.lua https://github.com/madprops/awesome-setup/blob/master/madwidgets/multibutton/multibutton.lua https://github.com/madprops/awesome-setup/blob/master/madwidgets/utils.lua
And this local autotimer = require("autotimer") and edited the autotimer.lua pointing path's of multibutton and utils to point in the root folder, so it can call them.
But I am unsure how to continue?
Idea is to get pomodoro type of timer, to start a counter and then stop and trigger a soundfile. I am now unsure how to get it to my widget bar or even how to trigger it. Adding earlier mentioned files to my theme.lua just causes error.
Hi !
First of all, it might be cleaner if you just have a "madwigets" directory in your root and place the files there, so you don't have to modify the code of the files. I would just git clone the repo somewhere and copy the madwigets directory to the root.
To place the widget in the panel I do this:
First import it near the top:
local autotimer = require("madwidgets/autotimer/autotimer")
Next I start it like this:
autotimer.create({
left = " ",
fontcolor = Globals.niceblue,
separator = "|", separator_color = Globals.nicedark
})
The colors like Globals.niceblue are my own variables I define somewhere, you can just use whatever or not specify them at all.
left = " " tells it to place an empty space at the left of the widget (right would be the same but opposite).
separator = "|" is the character to use between multiple active timers.
I then insert the widget in the layout of the panel, at the right side:
right = {
layout = wibox.layout.fixed.horizontal(),
autotimer
}
To see for yourself how I do it check this file:
https://github.com/madprops/awesome-setup/blob/master/modules/screens.lua
Let me know if that helps, cheers.
Oh and I forgot to show how to use it.
I use it through these functions:
local autotimer = require("madwidgets/autotimer/autotimer")
function Utils.timer(title, minutes)
autotimer.start_timer(title, minutes, function()
Utils.msg("Timer ended")
end)
end
function Utils.counter(title)
autotimer.start_counter(title)
end
As I do in this file: https://github.com/madprops/awesome-setup/blob/master/modules/utils.lua
You can do whatever when the timer ends.
For instance change
Utils.msg("Timer ended")
To whatever you want through lua.
Also remember that you can call awesome functions from your system through awesome-client.
I use something like this on a script:
awesome-client 'Utils.timer("#{title}", #{t})'
Just read an article on HN and tried to follow this setup. There are also dependencies in multiclick, and if you defined the colors there, then there is a missing function in drill.
Well, it would be nice if it were standalone, but this is your personal setup, so I don't expect you to work on this. It's a damn fine idea!