You are not logged in.

#1 2009-10-25 00:39:11

aaaaarch
Member
Registered: 2008-03-05
Posts: 18

How to use Alt-Fn to switch into tty under awesome?

Now I use awesome WM and do not define any Alt+Fn keys for it.
Unlike metacity ( I have used that before ) or other WMs, in which Alt+Fn are defined, Ctrl+Alt+Fn must be used for changing to tty.
So I wanna use Alt+Fn instead of Ctrl+Alt+Fn. Could anyone help me? Thanks a lot!

Offline

#2 2009-10-25 03:04:01

Acecero
Member
Registered: 2008-06-21
Posts: 1,373

Re: How to use Alt-Fn to switch into tty under awesome?

It's possible. I did a fair amount of research, but here is how I did it.

First I use the chvt command to switch to the ttys, but it requires root access. You can give the command suid permission by:

# chmod u+s /usr/bin/chvt

Now you can switch terminal using the chvt command as regular user. To switch you have to type "chvt N" where N is from /dev/ttyN. So if you want to switch to tty1, you type: chvt 1. Pretty simple.

Now comes the next part, xbindkeys. You are going to assign the commands to the Alt+Fn keys. From the wiki here, I used the "xbindkeys -k" to assign a shortcut key by pressing Alt+F1 and got something like this:

"(Scheme function)"
    m:0x8 + c:67
    Alt + F1

You need to add this to the ~/.xbindkeysrc file and replace "(Scheme function)" with the appropriate command to the Fn key, such as "chvt 1" to the "Alt+F1" shortcut:

"chvt 1"
    m:0x8 + c:67
    Alt + F1

You can do this so on for the other shortcuts. Restart X after you're done. Have fun!

Last edited by Acecero (2009-10-25 03:08:25)

Offline

#3 2009-10-25 08:31:19

aaaaarch
Member
Registered: 2008-03-05
Posts: 18

Re: How to use Alt-Fn to switch into tty under awesome?

WOW! Seems very nice!
I will try soon, and I think it can be used to do many other things.
Many thanks!

Offline

Board footer

Powered by FluxBB