Tag Archives: Awesome

No more TweetDeck for me, on AIR

I changed (once again) to awesome and AIR applications doesn’t work here. One of the apps I heavily use based on AIR is TweetDeck. So I tried old clients that were once an alternative like HootSuite but not having support for both kind of RTs (Native and Quote) is a pain in the ass. Then [...]

awesome’s awful.spawn grr!

Yesterday I was trying to get some of my old keybindings (from awesome 2.x) to work on awesome 3.4 and it was awful the process. With 2.x I worked with awful.spawn and got any bash command I wanted running. Now it changed to awful.util.spawn but if I wanted anything ran on a shell I had [...]

Widget para la batería en awesome con kernel > 2.6.26

Desde hace un buen tiempo que uso awesome y fluxbox de manera intercalada (aún necesito usar aplicaciones en Java como frostwire que awesome no es capaz de hacer funcionar…) sin embargo, la mayoría del tiempo uso awesome pero es un problema tener el gkrellm funcionando sin quebrar el funcionamiento normal de las ventanas tiling por lo que lo más ideal para reemplazarlo son widgets.

Antes se usaba /proc para que acpi dejara todas estas informaciones pero desde 2.6.24 se empezó a usar /sys para esto con lo cuál mi widget dejó de funcionar…

Afortunadamente koniu en #awesome me pasó su configuración y al fin conseguí hacerla funcionar, los pasos son los siguientes (tomando en cuenta que se parte de una configuración base que instala el paquete de debian):

Copiar /etc/xdg/awesome/rc.lua a ~/.config/awesome/
Colocar en ~/.config/awesome/rc.lua:
Modificar la ruta del tema a:

theme_path = "/home/tu-usuario/.config/awesome/default"

Colocar luego de awful.beautiful.register(beautiful) lo siguiente:

configwidgetsspace = "   "
-- format widget output
function widgettext(label, value, labelcolor, valuecolor)
	local lc = labelcolor or beautiful.widget_label
	local vc = valuecolor or beautiful.widget_value
	return 	'' .. label .. ' '  .. value .. '' .. configwidgetsspace
end

--- {{{ WIDGETS/battery1
--------------------------------------------------------------------------
battery0widget = widget({
	type = 'textbox',
	name = 'battery0widget',
	align = 'right',
})

local function get_bat0()
	local color = ''
	local v = ''
	local a = io.open('/sys/class/power_supply/BAT0/status')
	local status = a:read()
	a:close()

	if 	status == "Full" 	then v = widgettext('BAT0', '100%',nil,nil);
	else

		local a = io.open('/sys/class/power_supply/BAT0/energy_full')
		local full = a:read()
		a:close()
		local a = io.open('/sys/class/power_supply/BAT0/energy_now')
		local now = a:read()
		a:close() 

		bat = math.floor(now*100/full)

		if status == "Discharging" then
			if 	bat < 11 then color="#D9544C"
			elseif 	bat < 31 then color="#D9A24C"
			else 		      color="#D9CD4C"
			end
		elseif status == "Charging" then color="#ABD94C"
		end

		v = widgettext('BAT0', bat .. '%',nil,color)
	end

	return v 

end

La lista de widgets de la barra mi estatus debería quedar en algo como:

    mystatusbar[s]:widgets({
        mytaglist,
        mytasklist,
        myiconbox,
        mypromptbox,
	battery0widget,
        mytextbox,
        mylayoutbox[s],
        s == 1 and mysystray or nil
    })
    mystatusbar[s].screen = s

Y al final del archivo colocar esto:

-- Hook for batteries widget
function batteries_widget ()
    battery0widget.text = get_bat0()
end
awful.hooks.timer.register(5, batteries_widget)

Copiar /usr/share/awesome/themes/default hacia ~/.config/awesome/default y agregar las siguiente líneas:

widget_label = #333333
widget_value = #555555

Luego de eso, con sólo reiniciar awesome ya debería mostrar el widget de la batería actualizando cada 5 segundos.

Lo adapté de la configuración de koniu.