You are not logged in.

#1 2008-12-10 04:56:23

rasmusx
Member
Registered: 2008-12-10
Posts: 3

Awesome WM problem

Hi!

I'm trying to make a widget for awesome what shows the current keyboard layout by

setxkbmap -print | grep xkb_symbols | sed 's|.*+\([^"]\+\)+inet(.*|\1|'

which returns "ee" or "us" (estonian and us). The problem is it just doesn't show it (because I don't know lua properly).

Anyway here is my widget code what I tried to do:

-- Language
language_widget = widget({
    type = "textbox",
    name = "language_widget",
    align = "right"
})

wicked.register(language_widget, "function", function (widgets, args)
    local cmd = "setxkbmap -print | grep xkb_symbols | sed 's|.*+\([^\"]\\+\\)+inet(.*|\\1|\'"
    local f = io.popen(cmd)
    local l = f:read()
    f:close()
    return string.find(l)
end, 1);

Could someone help me out? smile

Offline

#2 2008-12-11 10:21:36

vaquerito
Member
Registered: 2008-04-09
Posts: 32

Re: Awesome WM problem

Hi, even if this is not the one you were going, a way is to go trough awesome-client, i.e.

1- create a textbox as you were already doing

language_widget = widget({
    type = "textbox",
    name = "language_widget",
})

2- put it wherever you want by placing it in the correct order in the wibox for, right after the clock maybe

-- Add widgets to the wibox - order matters
    mywibox[s].widgets = { mylauncher,
                           mytaglist[s],
                           mytasklist[s],
               mypromptbox[s],
               gmailbox,
                           mytextbox,
                           language_widget,
                           mylayoutbox[s],
                           s == 1 and mysystray or nil }
    mywibox[s].screen = s
end

3) put in a script something like

echo language_widget.text = \" $(setxkbmap -print | grep xkb_symbols | sed 's|.*+\([^"]\+\)+inet(.*|\1|') \" | awesome-client

Hope it helps wink
Federico

Last edited by vaquerito (2008-12-11 10:23:29)

Offline

Board footer

Powered by FluxBB