Xfce Forum

Sub domains
 

You are not logged in.

#1 2011-11-14 06:52:19

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Compose key

In Gnome I configured the Windows key to be a Compose key. E.g., you hit the Compose key, then a punctuation key, then the letter you want and, depending on which punctuation key you use you get the letter with any of hundreds of possible diacritics (assuming your font contains the combination). This works on any plain US English keyboard, without having to switch to a keyboard for another language It's a real timesaver for typing in languages other than English.

Although I had it configured and working fine in Gnome, it does not work in xfce. I have searched the forums and found nothing. Can someone please point me to the secret way to configure a Compose key in xfce?


Linguistics on Linux!

Offline

#2 2011-11-14 07:26:47

ManOfSteel
Member
Registered: 2005-10-06
Posts: 104

Re: Compose key

There are two ways: setxkbmap and xmodmap. See here.

Offline

#3 2011-11-14 08:19:53

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Re: Compose key

ManOfSteel wrote:

There are two ways: setxkbmap and xmodmap. See here.

Thanks. I think I got part of it. I used setxkbmap -option compose:lwin to set it to the left win button. That worked.

But the instructions in the link said:

       Add this command to your X startup in ~/.xinitrc, ~/.xsession, etc.

But I don't have either of those files. I haven't tried logging out and back in again, but I suspect that the setting will go away unless I place the command in one of the X startup files mentioned above.


Linguistics on Linux!

Offline

#4 2011-11-14 12:25:35

ManOfSteel
Member
Registered: 2005-10-06
Posts: 104

Re: Compose key

How do you run Xfce (startxfce, xinit, startx, desktop manager)?

Yes, you can create a .xinitrc file in your home directory and place the command there.

Offline

#5 2011-11-14 17:46:44

jeromeg
Member
From: France
Registered: 2010-11-11
Posts: 131
Website

Re: Compose key

Or just add this command to the list of autostarted applications in the Xfce session settings.

Offline

#6 2011-11-14 19:41:55

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Re: Compose key

jeromeg wrote:

Or just add this command to the list of autostarted applications in the Xfce session settings.

How do I do this, exactly? I found an application called Session and Startup, and it has a place to specify which applications to run at startup, but I don't see a startup script where I can enter this command.

Meantime, I have made an .initrc file and put the command in it. Later today I will log out and back in to see if it is working.


Linguistics on Linux!

Offline

#7 2011-11-15 02:37:44

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Re: Compose key

John_Jason_Jordan wrote:

... I have made an .initrc file and put the command in it. Later today I will log out and back in to see if it is working.

It didn't work. The file is .xinitrc and it is located in ~/. The contents are:


     #this command sets the compose button to the left
     #Windows button on login

     setxkbmap -option compose:lwin

The command does work from the command line once I am logged in to XFCE.


Linguistics on Linux!

Offline

#8 2011-11-15 07:21:25

ManOfSteel
Member
Registered: 2005-10-06
Posts: 104

Re: Compose key

~/.xinitrc is used when you run Xorg through xinit or startx. And you must follow any command with a command that runs your window manager.
In other words it should be something like:

setxkbmap -option compose:lwin
# any other command here
/usr/bin/startxfce4
# any additional program (e.g. terminal emulator) here

If you don't run xinit or startx, then the file is not used.

Hence why I asked you how you run Xfce.

Last edited by ManOfSteel (2011-11-15 07:27:35)

Offline

#9 2011-11-15 08:48:06

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Re: Compose key

ManOfSteel wrote:

~/.xinitrc is used when you run Xorg through xinit or startx. And you must follow any command with a command that runs your window manager.
In other words it should be something like:

setxkbmap -option compose:lwin
# any other command here
/usr/bin/startxfce4
# any additional program (e.g. terminal emulator) here

If you don't run xinit or startx, then the file is not used.

Hence why I asked you how you run Xfce.

I run XFCE from the login screen. The login screen calls the script /usr/bin/startxfce4. The contents of the script are:

#!/bin/sh
<comments snipped>
if test "x$XDG_CONFIG_HOME" = "x"
then
  BASEDIR="$HOME/.config/xfce4/"
else
  BASEDIR="$XDG_CONFIG_HOME/xfce4"
fi

if test "x$XDG_DATA_DIRS" = "x"
then
  XDG_DATA_DIRS="/usr/local/share:/usr/share:/usr/share"
else
  XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share"
fi
export XDG_DATA_DIRS

if test "x$DISPLAY" = "x"
then
  echo "$0: Starting X server"
  prog=xinit
else
  echo "$0: X server already running on display $DISPLAY"
  prog=/bin/sh
fi

if test ! "x$*" = "x"
then
  OPT=$*
  if test "x${OPT#*--}" = "x${OPT}"
  then
    CLIENTRC=${OPT}
  else
    SERVERRC=${OPT#*-- }
    CLIENTRC=${OPT% --*}
  fi
fi

if [ -f "$HOME/.xserverrc" ]; then
  SERVERRC="$HOME/.xserverrc $SERVERRC"
elif [ -f /etc/X11/xinit/xserverrc ]; then
  SERVERRC="/etc/X11/xinit/xserverrc $SERVERRC"
fi

if test ! "x$SERVERRC" = "x"
then
  SERVERRC="-- $SERVERRC"
fi

if [ -f $BASEDIR/xinitrc ]; then
  exec $prog $BASEDIR/xinitrc $CLIENTRC $SERVERRC
elif [ -f $HOME/.xfce4/xinitrc ]; then
  mkdir -p $BASEDIR
  cp $HOME/.xfce4/xinitrc $BASEDIR/
  exec $prog $BASEDIR/xinitrc $CLIENTRC $SERVERRC
else
  exec $prog /etc/xdg/xfce4/xinitrc $CLIENTRC $SERVERRC
fi 


I don't know much about scripts, so I don't know exactly how the script works or where to put the command.


Linguistics on Linux!

Offline

#10 2011-11-15 12:41:29

ManOfSteel
Member
Registered: 2005-10-06
Posts: 104

Re: Compose key

John_Jason_Jordan wrote:

I run XFCE from the login screen. The login screen calls the script /usr/bin/startxfce4.

Different distributions use different login managers. Since you're talking about GNOME in your first post, I guess you're using GDM. You might want to check the documentation of GDM for how to run additional commands (if that's even possible).

If you insist on modifying the startup script, then you can add the command after the comments, before the first if statement.

Offline

#11 2011-11-15 18:10:04

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Re: Compose key

ManOfSteel wrote:

If you insist on modifying the startup script, then you can add the command after the comments, before the first if statement.

Google turned up some documentation for GDM, but I couldn't find anything specific about how to do it. Apparently there are several scripts, and it appeared that the init script might be appropriate. But rather than do that I just followed your instructions above, putting it just before the first if statement. Then I logged out and back in again, and here I am with it working: á, ü, ñ, etc.

Thanks for your help and patience!


Linguistics on Linux!

Offline

#12 2011-11-15 18:23:27

jeromeg
Member
From: France
Registered: 2010-11-11
Posts: 131
Website

Re: Compose key

Session and Startup -> Application Autostart then Add and just paste the command in the "Command" field, give a name and here you go.

Offline

#13 2011-11-16 03:00:12

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Re: Compose key

jeromeg wrote:

Session and Startup -> Application Autostart then Add and just paste the command in the "Command" field, give a name and here you go.

Too bad I didn't see the Add button when you first suggested this. I just went to the Session and Startup > Application Autostart, didn't see anything that looked like a terminal, and decided it wouldn't work. sad

It might have been easier than adding the command to the startfxce4 script. Oh well. Noted here for archiving another way to solve the problem for the next user who needs a Compose key.


Linguistics on Linux!

Offline

#14 2012-02-09 19:11:32

mrinvader
Member
Registered: 2012-02-09
Posts: 1

Re: Compose key

Thank You!!!
I pasted

setxkbmap -option compose:lwin

into a new startup application entry [+Add ] in

Session and Startup -> Application Autostart

Thanks!! I am tall only because I stand on the backs of giants!

-Tom!!

Offline

#15 2014-02-10 02:19:44

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Re: Compose key

Well, I had it working fine for a couple of years on my old laptop, but now I have a new one and it is broken. The new laptop is a System76 Bonobo Extreme, acquired December, 2013 and on which I immediately installed Xubuntu 13.10, currently up to date. The keyboard is US English.

I went into Settings Manager, Keyboard, selected the Layout tab, and set the compose key to Left Win (which pysically has an Ubuntu logo on it, since System76 is a Linux laptop seller). The compose key works, but erratically. Sometimes I have to try several times before it will give me the letter with the diacritic. The erratic behavior happens in all applications, and after logging out and back in and even restarting. I have spent over a month trying to figure out what is wrong, but I am stumped. I have also tried setting it to a key other than Left Win, but the problem remains. (At least this proves that it is not a physically defective key.)

I also tried "setxkbmap -option compose:lwin" from the command line but, although the command executed without error, it made no difference.

The maddening part is that it is erratic. Things should either work or not work. I need suggestions. Even if you don't have the right answer, your suggestion might prompt me or someone else to think of something.


Linguistics on Linux!

Offline

#16 2014-08-20 07:12:55

John_Jason_Jordan
Member
From: USA, left coast
Registered: 2011-11-13
Posts: 107

Re: Compose key

I discovered that the erratic behavior of the compose key was related to the key repeat function. The compose key worked perfectly after I disabled key repeat.

However, I recently had to do a fresh install of Xubuntu 14.04.1 and now the compose key is broken again. Even with the repeat key set to off and even after running setxkbmap -option compose:lwin from the command line as well as putting the command in the startup options. I mean that now it doesn't work at all, not even once in a while.

I need some clues.


Linguistics on Linux!

Offline

#17 2014-08-22 12:45:28

poltiser
Member
Registered: 2011-05-14
Posts: 23

Re: Compose key

I have similar problem - I want to have level3 on both alt keys while typing in Polish, I found 2 solutions:

PolishChar.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Polish fonts
Comment=
Exec=setxkbmap -option lv3:alt_switch
Icon=accessories-character-map
Path=
Terminal=false
StartupNotify=true
GenericName=

which can be placed in /home/myuser/.local/share/applications/
it will place an icon accessories-character-map in menu to activate an option on the keyboard

or

it is possible to activate it permanently adding

XKBOPTIONS="lv3:alt_switch"

in /etc/default/keyboard
you might edit it as root to change your option...

Be careful, make backup before...

I hope it will help.

Offline

#18 2015-09-21 10:07:15

yuridg
Member
Registered: 2015-09-21
Posts: 1

Re: Compose key

Applications Menu -> Settings -> Keyboard
select "Layout" tab.
Un-tick "Use system defaults" to un-grey the options below it.
One of the options is "Compose key" which has a drop-down box to choose which key you want eg left win

Offline

Board footer

Powered by FluxBB