Re: Keyboard widget with layout _and_ variant
Hi, I needed a different combination of keymaps, so I abstracted your solution a bit: -- Keyboard widget kbdcfg = {} kbdcfg.cmd = setxkbmap kbdcfg.layout = function(name, layout, variant) return {name = name, layout = layout or name, variant = variant} end kbdcfg.layouts = { kbdcfg.layout(usd, us, dvp), kbdcfg.layout(de)} kbdcfg.current = 1 -- first is our default layout kbdcfg.widget = widget({ type = textbox, align = right }) kbdcfg.widget.text = kbdcfg.layouts[kbdcfg.current].name kbdcfg.switch = function () kbdcfg.current = kbdcfg.current % #(kbdcfg.layouts) + 1 local t = kbdcfg.layouts[kbdcfg.current] kbdcfg.widget.text = t.name if t.variant then os.execute( kbdcfg.cmd .. t.layout .. .. t.variant ) else os.execute( kbdcfg.cmd .. t.layout) end end -- Mouse bindings kbdcfg.widget:buttons(awful.util.table.join( awful.button({ }, 1, function () kbdcfg.switch() end) )) On Sun, 07 Aug 2011 21:29:03 +0200 manos mano...@gmail.com wrote: Hello, The layouts are working as needed now so i share it. It might be a better solution of course. It is the keyboard widget from awesome wiki but it passes the variant qwerty when the layout is de and it shows the desired text (en, de, ελ) instead of the layout name (us, de, el). It can be changed to pass different variants and show whichever text on the widget! -- Keyboard widget kbdcfg = {} kbdcfg.cmd = setxkbmap kbdcfg.layout = { us, de, el } kbdcfg.current = 1 -- us is our default layout kbdcfg.widget = widget({ type = textbox, align = right }) --kbdcfg.widget.text = .. kbdcfg.layout[kbdcfg.current] .. kbdcfg.widget.text = en kbdcfg.switch = function () kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1 local t = .. kbdcfg.layout[kbdcfg.current] .. local v = qwerty kbdcfg.widget.text = t if t == us then kbdcfg.widget.text = en os.execute( kbdcfg.cmd .. t ) elseif t == de then kbdcfg.widget.text = t os.execute( kbdcfg.cmd .. t .. v ) elseif t == el then kbdcfg.widget.text = ελ os.execute( kbdcfg.cmd .. t ) end end manos~ On 08/07/2011 01:26 PM, manos wrote: Thanks Uli, this works, So the solution is to check: if t == de Patrick, in my system the command works like this: setxkbmap layout variant Going further I try to show en instead of us when english is the language but my code doesn't work I change kbdcfg.widget.text = t with kbdcfg.widget.text = function () if t == us then return en else return t end end When i do that the widget doesn't work, it always show us and the layout is not changing manos~ On 08/06/2011 10:08 AM, Patrick Bethke wrote: The setxkbmap command to set a variant is setxkbmap layout -variant variant for example setxkbmap de -variant deadgraveacute not setxkbmap de deadgraveacute 2011/8/6 Uli Schlachter psyc...@znc.in: On 06.08.2011 04:13, manos wrote: Hello, I am using the keyboard widget from the wiki and try to change it to pass also the variant (i want German qwerty, not qwertz that is the default). Code: kbdcfg = {} kbdcfg.cmd = setxkbmap kbdcfg.layout = { us, de, el } kbdcfg.current = 1 kbdcfg.widget = widget({ type = textbox, align = right }) kbdcfg.widget.text = .. kbdcfg.layout[kbdcfg.current] .. kbdcfg.switch = function () kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1 local t = .. kbdcfg.layout[kbdcfg.current] .. This sets t to e.g. de local v = qwerty kbdcfg.widget.text = t -- the change to the original code is after this line if t == de then -- have tried also en, the previous layout and de is not equal to de. os.execute( kbdcfg.cmd .. t .. v ) else os.execute( kbdcfg.cmd .. t ) end end Any ideas? -- The Angels have the phone box! -- To unsubscribe, send mail to awesome-unsubscr...@naquadah.org. -- To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.
Re: Keyboard widget with layout _and_ variant
Thanks Uli, this works, So the solution is to check: if t == de Patrick, in my system the command works like this: setxkbmap layout variant Going further I try to show en instead of us when english is the language but my code doesn't work I change kbdcfg.widget.text = t with kbdcfg.widget.text = function () if t == us then return en else return t end end When i do that the widget doesn't work, it always show us and the layout is not changing manos~ On 08/06/2011 10:08 AM, Patrick Bethke wrote: The setxkbmap command to set a variant is setxkbmap layout -variant variant for example setxkbmap de -variant deadgraveacute not setxkbmap de deadgraveacute 2011/8/6 Uli Schlachter psyc...@znc.in: On 06.08.2011 04:13, manos wrote: Hello, I am using the keyboard widget from the wiki and try to change it to pass also the variant (i want German qwerty, not qwertz that is the default). Code: kbdcfg = {} kbdcfg.cmd = setxkbmap kbdcfg.layout = { us, de, el } kbdcfg.current = 1 kbdcfg.widget = widget({ type = textbox, align = right }) kbdcfg.widget.text = .. kbdcfg.layout[kbdcfg.current] .. kbdcfg.switch = function () kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1 local t = .. kbdcfg.layout[kbdcfg.current] .. This sets t to e.g. de local v = qwerty kbdcfg.widget.text = t -- the change to the original code is after this line if t == de then -- have tried also en, the previous layout and de is not equal to de. os.execute( kbdcfg.cmd .. t .. v ) else os.execute( kbdcfg.cmd .. t ) end end Any ideas? -- The Angels have the phone box! -- To unsubscribe, send mail to awesome-unsubscr...@naquadah.org. -- To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.
Re: Keyboard widget with layout _and_ variant
Hello, The layouts are working as needed now so i share it. It might be a better solution of course. It is the keyboard widget from awesome wiki but it passes the variant qwerty when the layout is de and it shows the desired text (en, de, ελ) instead of the layout name (us, de, el). It can be changed to pass different variants and show whichever text on the widget! -- Keyboard widget kbdcfg = {} kbdcfg.cmd = setxkbmap kbdcfg.layout = { us, de, el } kbdcfg.current = 1 -- us is our default layout kbdcfg.widget = widget({ type = textbox, align = right }) --kbdcfg.widget.text = .. kbdcfg.layout[kbdcfg.current] .. kbdcfg.widget.text = en kbdcfg.switch = function () kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1 local t = .. kbdcfg.layout[kbdcfg.current] .. local v = qwerty kbdcfg.widget.text = t if t == us then kbdcfg.widget.text = en os.execute( kbdcfg.cmd .. t ) elseif t == de then kbdcfg.widget.text = t os.execute( kbdcfg.cmd .. t .. v ) elseif t == el then kbdcfg.widget.text = ελ os.execute( kbdcfg.cmd .. t ) end end manos~ On 08/07/2011 01:26 PM, manos wrote: Thanks Uli, this works, So the solution is to check: if t == de Patrick, in my system the command works like this: setxkbmap layout variant Going further I try to show en instead of us when english is the language but my code doesn't work I change kbdcfg.widget.text = t with kbdcfg.widget.text = function () if t == us then return en else return t end end When i do that the widget doesn't work, it always show us and the layout is not changing manos~ On 08/06/2011 10:08 AM, Patrick Bethke wrote: The setxkbmap command to set a variant is setxkbmap layout -variant variant for example setxkbmap de -variant deadgraveacute not setxkbmap de deadgraveacute 2011/8/6 Uli Schlachter psyc...@znc.in: On 06.08.2011 04:13, manos wrote: Hello, I am using the keyboard widget from the wiki and try to change it to pass also the variant (i want German qwerty, not qwertz that is the default). Code: kbdcfg = {} kbdcfg.cmd = setxkbmap kbdcfg.layout = { us, de, el } kbdcfg.current = 1 kbdcfg.widget = widget({ type = textbox, align = right }) kbdcfg.widget.text = .. kbdcfg.layout[kbdcfg.current] .. kbdcfg.switch = function () kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1 local t = .. kbdcfg.layout[kbdcfg.current] .. This sets t to e.g. de local v = qwerty kbdcfg.widget.text = t -- the change to the original code is after this line if t == de then -- have tried also en, the previous layout and de is not equal to de. os.execute( kbdcfg.cmd .. t .. v ) else os.execute( kbdcfg.cmd .. t ) end end Any ideas? -- The Angels have the phone box! -- To unsubscribe, send mail to awesome-unsubscr...@naquadah.org. -- To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.
Re: Keyboard widget with layout _and_ variant
On 06.08.2011 04:13, manos wrote: Hello, I am using the keyboard widget from the wiki and try to change it to pass also the variant (i want German qwerty, not qwertz that is the default). Code: kbdcfg = {} kbdcfg.cmd = setxkbmap kbdcfg.layout = { us, de, el } kbdcfg.current = 1 kbdcfg.widget = widget({ type = textbox, align = right }) kbdcfg.widget.text = .. kbdcfg.layout[kbdcfg.current] .. kbdcfg.switch = function () kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1 local t = .. kbdcfg.layout[kbdcfg.current] .. This sets t to e.g. de local v = qwerty kbdcfg.widget.text = t -- the change to the original code is after this line if t == de then -- have tried also en, the previous layout and de is not equal to de. os.execute( kbdcfg.cmd .. t .. v ) else os.execute( kbdcfg.cmd .. t ) end end Any ideas? -- The Angels have the phone box! -- To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.
Re: Keyboard widget with layout _and_ variant
The setxkbmap command to set a variant is setxkbmap layout -variant variant for example setxkbmap de -variant deadgraveacute not setxkbmap de deadgraveacute 2011/8/6 Uli Schlachter psyc...@znc.in: On 06.08.2011 04:13, manos wrote: Hello, I am using the keyboard widget from the wiki and try to change it to pass also the variant (i want German qwerty, not qwertz that is the default). Code: kbdcfg = {} kbdcfg.cmd = setxkbmap kbdcfg.layout = { us, de, el } kbdcfg.current = 1 kbdcfg.widget = widget({ type = textbox, align = right }) kbdcfg.widget.text = .. kbdcfg.layout[kbdcfg.current] .. kbdcfg.switch = function () kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1 local t = .. kbdcfg.layout[kbdcfg.current] .. This sets t to e.g. de local v = qwerty kbdcfg.widget.text = t -- the change to the original code is after this line if t == de then -- have tried also en, the previous layout and de is not equal to de. os.execute( kbdcfg.cmd .. t .. v ) else os.execute( kbdcfg.cmd .. t ) end end Any ideas? -- The Angels have the phone box! -- To unsubscribe, send mail to awesome-unsubscr...@naquadah.org. -- To unsubscribe, send mail to awesome-unsubscr...@naquadah.org.