LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > MEPIS
User Name
Password
MEPIS This forum is for the discussion of MEPIS Linux.

Notices

Reply
 
Search this Thread
Old 05-26-2009, 01:49 PM   #1
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,044

Rep: Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100
How to run xmodmap at the start of an X session?


Using Mepis 8, I'm trying to enable a key on my keyboard that has a keycode but no keysym.

I found a number of online descriptions of the process, such as
http://cweiske.de/howto/xmodmap/allinone.html
or
http://www.mepis.org/docs/en/index.php/Extra_keys

I created both /etc/X11/Xmodmap and ~/.Xmodmap with the keycode lines I need. If I manually give the command
xmodmap ~/.Xmodmap
then those keys work for the rest of that session. But I can't find a way to make it automatic for every session. That Mepis page I linked implies simply having /etc/X11/Xmodmap would make it automatic, but it doesn't.

Many places I looked this up suggest editing various forms of if statement into Xsession to run one of the commands
/usr/bin/xmodmap ~/.Xmodmap
or
/usr/bin/xmodmap /etc/X11/Xmodmap

Xsession isn't any of the places any of those pages say it should be, such as
$KDEDIR/share/config/kdm/Xsession

I am using KDE, but so far as I can tell, there is no $KDEDIR environment variable defined anywhere. I also can't find a share/config/kdm directory anywhere, and I searched the whole hard drive for Xsession files and found only two (one of which invokes the other).

I tried the various if constructs in those files and nothing did anything. Then I removed the if construct (in case that part was wrong) and did a bare
/usr/bin/xmodmap /etc/X11/Xmodmap
and that did nothing. I tried (still in the Xsession file)
/usr/bin/xmodmap /etc/X11/Xmodmap > /etc/X11/Xmodmap.log
to try to see if there was any output to explain the lack of effect. That made graphical login stop working. I'm confused about why, but at least it tells me the Xsession file I'm editing is used during graphical login. (I'm really inept at non GUI Linux use, but I managed to use nano to remove the > /etc/X11/Xmodmap.log and regain GUI login.)

I also tried creating a ~/.bashrc file containing
/usr/bin/xmodmap ~/.Xmodmap
but that made no difference.

Typing that command in a konsole window after each login always enables the keys, but nothing I've found to automate the process does anything.

Last edited by johnsfine; 05-26-2009 at 01:51 PM.
 
Old 05-28-2009, 12:04 PM   #2
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,044

Original Poster
Rep: Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100
Semi solved.

I still don't understand what I did wrong in the earlier ways of trying to make this run automatically. I still don't know how to make it automatic for all users in one place.

I found this thread
http://www.mepislovers.org/forums/sh...hlight=xmodmap

and extrapolating from the instructions there, I created the file
~/.kde/Autostart/xmodmap
with the content
#!/bin/bash
/usr/bin/xmodmap ~/.Xmodmap
I made that file executable, and now it runs correctly each time I login to kde.
 
Old 05-30-2009, 06:41 AM   #3
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 230Reputation: 230Reputation: 230
1st, thanks for being a good LQ citizen & posting your solution.

2nd, good work finding it on your own.

3rd, any chance that putting your xmodmap in /etc/kde3/, or in (a newly created) /etc/kde3/Autostart/, would make it automatic for all users?
 
Old 06-02-2009, 08:24 AM   #4
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,044

Original Poster
Rep: Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100Reputation: 1100
Quote:
Originally Posted by archtoad6 View Post
any chance that putting your xmodmap in /etc/kde3/, or in (a newly created) /etc/kde3/Autostart/, would make it automatic for all users?
Thanks for the suggestions. But they didn't work. I tried a few other places within scripts that I'm sure are run during X startup and it hasn't worked.

I found the spot where I'm pretty sure I didn't add the xmodmap command, but it was there (and doesn't work) so I think that is where Mepis has it that is supposed to allow me to just add the /etc/X11/Xmodmap file without changing any scripts.

I've lost track of all the scripts I've changed. I should have been more organized. At some point I'm going to need to install another copy of Mepis 8 in another partition just to compare all the scripts to what I now have.

Meanwhile, I decided I was doing too much guessing at what constructs mean in existing scripts and what is safe or correct to add. I ought to be able to read though the startup scripts and know what happens when. I need to know the bash language better. I started going through a bash tutorial, but everything is clear as mud. So it may be quite a while before I get back to another attempt to find out why I can't load /etc/X11/Xmodmap for all users.
 
Old 06-02-2009, 09:00 AM   #5
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 230Reputation: 230Reputation: 230
Please keep us "posted".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Upgrade to -12.1 and xmodmap is not run rshepard Slackware - Installation 0 12-09-2008 12:41 PM
How to run a program in an ssh session that will run after you close out the session? dr_zayus69 Linux - Networking 5 03-05-2006 07:15 PM
/etc/X11/xinit/.Xmodmap; run level 4 won't init script Potatopopper Slackware 5 11-27-2005 07:37 PM
Forcing xmodmap to be run on each restart lazymanc Debian 1 05-16-2005 01:01 PM
xmodmap won't run automatically txmjafg Linux - General 3 12-14-2003 09:44 PM


All times are GMT -5. The time now is 07:42 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration