Hello,
Dear Alexis,
At first sorry for late, my delay has three reasons: 1. I went to
Ahvaz city for native FreeSoftware conference at
http://scu-opensource.ir/ and you search my name in Persian
language: محسن
پهلوان زاده in main page of site. 2. I'm
reading lua language. 3. I have to write a script for my friends
with python.
But your suggesstion: I load your rc.lua and i got bad argumet ar
445 and 446
I migrate to awesome 3.5 and maybe it's related to version of
awesome,
But i changed wiki giude at my rc.lua to :
///////////////////////////////////////////////////////////////////////////
-- Keyboard map indicator and changer by Mohsen
kbdcfg = {}
kbdcfg.cmd = "setxkbmap"
kbdcfg.layout = { "us", "fa" }
kbdcfg.current = 1
-- us is our default layout
-- kbdcfg.widget = widget({ type = "textbox", align = "right" })
kbdcfg.widget = wibox.widget.textbox()
kbdcfg.widget.text = " " .. kbdcfg.layout[kbdcfg.current] .. " "
kbdcfg.switch = function ()
kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1
local t = " " .. kbdcfg.layout[kbdcfg.current] .. " "
kbdcfg.widget.text = t
os.execute( kbdcfg.cmd .. t )
end
-- Alt + Right Shift switches the current keyboard layout
awful.key({ "Mod1" }, "Shift_R", function () kbdcfg.switch()
end)
-- Mouse bindings
kbdcfg.widget:buttons(awful.util.table.join(
awful.button({ }, 1, function () kbdcfg.switch() end)
))
-- end by Mohsen
////////////////////////////////////////////////
According to above code, I used: wibox.widget.textbox() , it's
related to 3.5 ,
Also i have some question according to lack of documentation for
widget and awful.I hope to can help to awesome community.
If i can change my rc.lua , sure i change wiki.
Regard,
Mohsen
On 12/02/2014 11:37 AM, Alexis Brenon
wrote:
Hi Mohsen,
The { Mod1 }, Shift_R stand for the Alt modifier plus the Shift
key, but the right one, not the left one.
To make sure that the right keys are detected, you can use
the xev program (see the
ArchLinux wiki page for a quick guide). You can also add
a notification in your switch function to see if it is called :
kbdcfg.switch = function ()
naughty.notify({text = "Keyboard layout switch"})
kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1
local t = " " .. kbdcfg.layout[kbdcfg.current] .. " "
kbdcfg.widget.text = t
os.execute( kbdcfg.cmd .. t )
end
Regards,
Alexis
Le Mon Dec 01 2014 at 20:43:52, Mohsen
Pahlevanzadeh < [email protected]>
a écrit :
On 12/01/2014 11:49 AM, Alexis Brenon wrote:
Hi Mohsen,
Frome here, I don't see any particular error in your
code or anything. But maybe you can start by remove some
useless parts which can interact with others or
whatever.
Firstly, in your xorg.conf file, remove the line :
> Option "XkbOptions" "grp:shifts_toggle"
I commented at xorg.
This line, allow you to switch layouts with the
shift keys, but without any interaction with Awesome
(so your widget will not be updated), it's not what
you want, but it can interfere.
Then, as you define your layout in the xorg.conf
file, you don't need to use
> setxkbmap
us,fa
in
your xinit.rc file. When X starts, it reads the
xorg.conf file and so this line is useless.
I remove it from ~/.xinitrc
Finally,
you say that you can't change to persian language,
but I see 3 layouts in your kbdcfg.layouts. Can you
change between us and fa, but not to Persian, or you
can't change at all. In both cases, try to execute
manually the commands in your terminal, maybe
setxkbmap will report you an error (missing the
-layout option, unrecognized layout name, etc.).
Just
to finnish ; it's now recommended to not use the
xorg.conf file, but the xorg.conf.d/ folder with one
file for each device.
Hopping
that it will help you.
Regards,
Alexis
Le Mon Dec 01 2014 at 03:21:46,
Mohsen Pahlevanzadeh < [email protected]> a
écrit :
Dear all,
I migrate to awesome, But may be awesome depend on
X, At first i provided xorg.conf with:
Xorg -configure
Then i changed InputClass such as :
///////////////////////////////////
Section "InputClass"
Identifier "keyboard0"
Driver "evdev"
#MatchIsKeyboard "on"
Option "XkbModel" "evdev"
# Switch between layouts by pressing both shift keys
Option "XkbLayout" "us,fa"
Option "XkbOptions" "grp:shifts_toggle"
EndSection
////////////////////////////////
Then :
cp /etc/xdg/awesome/rc.lua ~/.config/awesome/
Add the following change to it:
//////////////////////////////////////////////////
-- Keyboard map indicator and changer
kbdcfg = {}
kbdcfg.cmd = "setxkbmap"
kbdcfg.layout = { "us", "fa", "Persian" }
I change abobe line to :
kbdcfg.layout = { "us", "fa"}
kbdcfg.current = 1 -- us is
our default layout
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] .. " "
kbdcfg.widget.text = t
os.execute( kbdcfg.cmd .. t )
end
-- Alt + Right Shift switches the current
keyboard layout
awful.key({ "Mod1" }, "Shift_R", function ()
kbdcfg.switch() end),
-- Mouse bindings
kbdcfg.widget:buttons(awful.util.table.join(
awful.button({ }, 1, function ()
kbdcfg.switch() end)
))
-- end by me
////////////////////////////////////////////////////////
Also i add the folloiwoing section to layout:
/////////////////////////
right_layout:add(kbdcfg.widget)
//////////////////////////////////////////
Then i create a ~.xinitrc and pu into it:
//////////////////////////////////
#!/bin/sh
setxkbmap us,fa
///////////////////////////////
Also i put into the following code in rc.lua:
////////////////////////////////////////////
awful.key({ "Mod1" }, "Shift_R", function () kbdcfg.switch() end),
//////////////////////////////////////////////
I "have to" learn lua, But i don't know above line (define
hot key,) What's key binding for changing layout?
mod+shift+R?
How can i find out which hotkey active is?
--Regard
Mohsen
But i can't change my keyboard language to persian language, how can i do it?
Where's my problem?
Please give me a link from key codes....
--Regards
Mohsen
-- To unsubscribe, send mail to [email protected].
--
To unsubscribe, send mail to [email protected].
|