Farhavens fish widget
From awesome
Farhavens fish widget
Introduction
This widget places a little moving turquoise ASCII fish into your wiboxes, which, once clicked, displays a fortune using naughty. Naturally, you need to include naughty with require("naughty") into your config file and you also need GNU fortune installed.
Widget Code
Paste the following code somewhere before your wibox definition into your rc.lua
fish = { }
fish.widget = widget({ type = "textbox", align = "right" })
fish.state = 1
fish.states = { "<°}))o»«", "<°)})o>«", "<°))}o»<" }
fish.widget:buttons({
button({ }, 1, function () fish.fortune() end ) })
function fish.fortune()
local fh = io.popen("fortune -n 100 -s")
local fortune = fh:read("*all")
fh:close()
naughty.notify({ text = fortune, timeout = 7 })
end
function fish.update()
local t = ""
t = t .. awful.util.escape(fish.states[fish.state])
t = t .. ""
fish.widget.text = t
fish.state = (fish.state + 1) % #(fish.states) + 1
end
fish.update()
awful.hooks.timer.register(0.5, fish.update)
Then, add fish.widget to your wibox and restart Awesome. Enjoy the fish :)