You are not logged in.

#1 2024-04-06 14:50:17

ZALMT
Member
Registered: 2023-10-19
Posts: 32

[SOLVED] Move ~/.Xmodmap out of the home directory?

I want to remap my keyboard, and want to try doing that by using xmodmap. I generated the .Xmodmap file, and it's looking fine. The problem is when I try and move the .Xmodmap file out of the home directory. I have (obviously) changed my xinitrc file to match the location of the new Xmodmap file. I can run the command

 xmodmap /path/to/Xmodmap/file 

on my terminal just fine. In fact, I copied it from the my xinit file just to make sure, and it worked fine. I then put the file and changed my xinit file back and forth a few times, and the result was always the same, it works fine so only when the xmodmap file is in the home directory.

I have checked the Wiki, and it doesn't say (at least that I could see) that the file needed to be in the home directory, so I'm not sure where I got it wrong.

Manually sourcing the xinit file also works.

Thank you so much btw

Last edited by ZALMT (2024-04-06 17:11:36)

Offline

#2 2024-04-06 15:48:06

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

Are you sure your xinitrc is sourced? How do you start X11? startx? xinit? Some DM?

loginctl session-status

Offline

#3 2024-04-06 15:59:44

ZALMT
Member
Registered: 2023-10-19
Posts: 32

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

seth wrote:

Are you sure your xinitrc is sourced? How do you start X11? startx? xinit? Some DM?

loginctl session-status

I'm fairly sure that it's sourced, because if the .Xmodmap file is in the home directory then it xmodmap runs just fine

loginctl session status
1 - zeus (1000)
  Since: Sun 2024-04-07 02:55:31 AEDT; 3min 29s ago
  State: active
 Leader: 709 (ly-dm)
   Seat: seat0; vc2
    TTY: tty2
 Remote: no
Service: ly
   Type: x11
  Class: user
Desktop: qtile
   Idle: no
   Unit: session-1.scope
         ├─ 709 /usr/bin/ly-dm
         ├─ 971 /usr/bin/ly-dm
         ├─ 975 /usr/lib/Xorg :0 vt2
         ├─ 986 /usr/bin/python /sbin/qtile start
         ├─1038 lxsession
         ├─1039 greenclip daemon
         ├─1040 /usr/bin/python /sbin/udiskie
         ├─1041 syncthing --no-browser
         ├─1042 xss-lock -- i3lock -ei /home/zeus/.config/qtile/lock
         ├─1081 /usr/bin/syncthing --no-browser
         ├─1117 lxpolkit
         ├─1119 lxclipboard
         ├─1123 /usr/bin/python3 /usr/share/system-config-printer/applet.py
         ├─1127 /usr/lib/geoclue-2.0/demos/agent
         ├─1131 /usr/bin/fcitx5
         ├─1139 /usr/bin/ssh-agent -s
         ├─2379 /bin/sh /sbin/xdg-open "https://bbs.archlinux.org/viewtopic.php?pid=2163013#p2163013"
         ├─2453 /usr/lib/firefox/firefox "https://bbs.archlinux.org/viewtopic.php?pid=2163013#p2163013"
         ├─2529 /usr/lib/firefox/firefox -contentproc -parentBuildID 20240402224902 -prefsLen 38178 -prefMapSize 2>
         ├─2568 /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 29557 -prefMapSize 240431>
         ├─2656 /usr/lib/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 43257 -prefMapSize 240431>
         ├─2714 /usr/lib/firefox/firefox -contentproc -parentBuildID 20240402224902 -sandboxingKind 0 -prefsLen 43>
         ├─2756 /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 34685 -prefMapSize 240431>
         ├─2787 /usr/lib/firefox/firefox -contentproc -childID 5 -isForBrowser -prefsLen 34685 -prefMapSize 240431>
         ├─2794 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -prefsLen 43350 -prefMapSize 240431>
         ├─3238 /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -prefsLen 34929 -prefMapSize 240431>
         ├─3243 /usr/lib/firefox/firefox -contentproc -childID 8 -isForBrowser -prefsLen 34929 -prefMapSize 240431>
         ├─4062 alacritty
         ├─4072 /usr/bin/bash
         ├─4282 loginctl session-status
         └─4283 less

I use ly as my display manager

Last edited by ZALMT (2024-04-06 16:00:20)

Offline

#4 2024-04-06 16:07:32

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

Because something else (ly, maybe sourcing xprofile)  gets it from there.
https://wiki.archlinux.org/title/Displa … _a_session

Please post yout xinitrc and try to use it to autostart an xterm just to make sure it's souced at all.
(Because xinit isn't invoked here)

Offline

#5 2024-04-06 16:22:21

ZALMT
Member
Registered: 2023-10-19
Posts: 32

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

seth wrote:

Because something else (ly, maybe sourcing xprofile)  gets it from there.
https://wiki.archlinux.org/title/Displa … _a_session

Please post yout xinitrc and try to use it to autostart an xterm just to make sure it's souced at all.
(Because xinit isn't invoked here)

xinitrc:

#!/bin/sh

userresources=$XDG_CONFIG_HOME/.Xresources
usermodmap=$HOME/.config/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
# sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then







    xrdb -merge $sysresources

fi

#if [ -f $sysmodmap ]; then
#
#    xmodmap $sysmodmap
#fi

if [ -f "$userresources" ]; then


    xrdb -merge "$userresources"

fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

twm &
xclock -geometry 50x50-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
exec xterm -geometry 80x66+0+0 -name login

I have this variable in my bash_profile

echo $XINITRC
/home/zeus/.config/X11/xinitrc

I tried to launch xinit as a session, but it just threw me straight back to the login screen. I don't know if it was because I didn't specify a WM in my xinit or was there a problem with the file

Offline

#6 2024-04-06 16:37:38

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

I have this variable in my bash_profile

That's horrible - remove that. The only reason why this has (probalby) not cross-fucked you is because your xinitrc is most likely not set executable.

The xinitrc is the default one, ie. it'll start twm, xclock and a bunc of xterms - nothing of that is in your session, it's safe to say that the file isn't used at all.
https://wiki.archlinux.org/title/LXDE#Autostart - but you preferably want this happen even before the session starts, ie. through "ly"
Many DMs source ~/.xprofile, so I'd start there.
https://github.com/fairyglade/ly/blob/m … tup.sh#L55

nb. that ly is not a very good choice as DM because of its poor integration w/ logind.
https://github.com/fairyglade/ly/issues … issue+dbus

Offline

#7 2024-04-06 16:42:54

ZALMT
Member
Registered: 2023-10-19
Posts: 32

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

seth wrote:

I have this variable in my bash_profile

That's horrible - remove that. The only reason why this has (probalby) not cross-fucked you is because your xinitrc is most likely not set executable.

The xinitrc is the default one, ie. it'll start twm, xclock and a bunc of xterms - nothing of that is in your session, it's safe to say that the file isn't used at all.
https://wiki.archlinux.org/title/LXDE#Autostart - but you preferably want this happen even before the session starts, ie. through "ly"
Many DMs source ~/.xprofile, so I'd start there.
https://github.com/fairyglade/ly/blob/m … tup.sh#L55

nb. that ly is not a very good choice as DM because of its poor integration w/ logind.
https://github.com/fairyglade/ly/issues … issue+dbus

Oh, I thought since it it's supported here it'll be alright. I did set it executable using chmod so idk.

Offline

#8 2024-04-06 16:47:10

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

Don't. Even if this works and just luckily gets inored enought or whatever, that's a horrible stanza.
If the bash_profile was ever involved by a login shell it'd try to replace bash w/ xterm what's for sure not going to work on the console.

If at all you'd have a coditional startx/xinit in your bash profile.
https://wiki.archlinux.org/title/Getty# … al_console
https://wiki.archlinux.org/title/Xinit# … X_at_login

But not w/ a DM

Offline

#9 2024-04-06 16:50:51

ZALMT
Member
Registered: 2023-10-19
Posts: 32

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

Hmm, if I remove that variable and put .xinitrc in my home directory then everything works fine, at least before that's what happened before.

Thanks btw smile

Offline

#10 2024-04-06 20:02:42

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

What?
Nothing of that makes any sense - whatever you do to that file, your xinitrc isn't sourced by ly and even if it was, that xinitrc there get you twm (which you likely don't have installed) any a bunch of xterms, but no proper session.
If you want to run some specific xmodmap, do that from your ~/.xprofile as that gets sourced by ly.

Offline

#11 2024-04-07 17:10:04

ZALMT
Member
Registered: 2023-10-19
Posts: 32

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

seth wrote:

What?
Nothing of that makes any sense - whatever you do to that file, your xinitrc isn't sourced by ly and even if it was, that xinitrc there get you twm (which you likely don't have installed) any a bunch of xterms, but no proper session.
If you want to run some specific xmodmap, do that from your ~/.xprofile as that gets sourced by ly.

I wanted as little "dot" files/directories in my home directory as possible, so I thought exporting that variable would do the trick. Apparently that it didn't, so I just put .xinitrc in home and now it works. I think I would just leave it at that at the moment, I will probably investigate later when I have the time.

Offline

#12 2024-04-07 19:24:46

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

Again: your xinitrc isn't sourced.
And if it was, you'd not start an lxde session but a bunch xterms and probably not twm (not installed, I guess?)

Are you conflating it w/ ~/.xprofile (cause that gets sourced) or ~/.Xmodmap (which we know is loaded at some stage)?

Offline

#13 2024-04-07 19:27:49

ZALMT
Member
Registered: 2023-10-19
Posts: 32

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

seth wrote:

Again: your xinitrc isn't sourced.
And if it was, you'd not start an lxde session but a bunch xterms and probably not twm (not installed, I guess?)

Are you conflating it w/ ~/.xprofile (cause that gets sourced) or ~/.Xmodmap (which we know is loaded at some stage)?

You guessed right, I did not install twm. I don't even have an ~/.xprofile, but ~/.xinitrc got sourced when I did not do anything to the variables or anything.

Offline

#14 2024-04-07 19:43:38

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

Add something obvious to the xinitrc, eg. start xeyes there.
Does xeyes start with your session then?

Offline

#15 2024-04-07 20:34:51

ZALMT
Member
Registered: 2023-10-19
Posts: 32

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

Sadly, no. I'm fairly sure by now my ~/.xinitrc wasn't read at all. I'm fairly sure I didn't make a typo or something, but this is is pasted out:

#!/bin/sh

xeyes

Now I'm confused. It was working before. I guess I can get something like input-remapper or keyd as a service and do what I want, but the problem now is my xinit system is kinda fucked.

Offline

#16 2024-04-07 20:40:36

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

I'm fairly sure by now my ~/.xinitrc wasn't read at all.

If only somebody had told you tongue

Run whatever you want to happen in ~/.xprofile
If you wanted to get rid of that, ly sources /etc/X11/xinit/xinitrc.d/* so you could add a script there that in turn sources eg. $HOME/.config/xprofile

Offline

#17 2024-04-07 21:06:30

ZALMT
Member
Registered: 2023-10-19
Posts: 32

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

seth wrote:

I'm fairly sure by now my ~/.xinitrc wasn't read at all.

If only somebody had told you tongue

Run whatever you want to happen in ~/.xprofile
If you wanted to get rid of that, ly sources /etc/X11/xinit/xinitrc.d/* so you could add a script there that in turn sources eg. $HOME/.config/xprofile

Oh I didn't know that. I'm not sure if it was in the wiki tho, cuz I did read the wiki, but then again, I could have totaly missed it lmao. If it wasn't it should be somewhere in the wiki. After a few tries and errors, I changed the script to end in .sh and make it executable, not sure if the latter is needed but hey, it works smile

Thank you so much

Offline

#18 2024-04-07 21:11:01

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

It's not in the wiki but in the script I previously linked, specifically https://github.com/fairyglade/ly/blob/m … tup.sh#L59
Since ly doesn't filter for suffixes you don't need it to end in .sh but b/c of the [ -x ] it has to be executable

Offline

#19 2024-04-07 21:17:02

ZALMT
Member
Registered: 2023-10-19
Posts: 32

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

seth wrote:

It's not in the wiki but in the script I previously linked, specifically https://github.com/fairyglade/ly/blob/m … tup.sh#L59
Since ly doesn't filter for suffixes you don't need it to end in .sh but b/c of the [ -x ] it has to be executable

Ahh I see, but I'm not "there" yet. if I put things like alacritty or xeyes in the xprofile file it works just fine, so the file is being sourced at least, but when I try xmodmap ~/.config/x11/Xmodmap, it didn't do anything. Again, I can do it from the terminal, but for some reason it didn't run in xprofile file?

Offline

#20 2024-04-07 21:22:10

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

Probalby overridden afterwards, notably setxkbmap would reset the modmap - if lxsession does anything like that to set the keyboard layout, you lose the modmap changes.
=> https://wiki.archlinux.org/title/LXDE#Autostart

Offline

#21 2024-04-07 21:37:17

ZALMT
Member
Registered: 2023-10-19
Posts: 32

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

seth wrote:

Probalby overridden afterwards, notably setxkbmap would reset the modmap - if lxsession does anything like that to set the keyboard layout, you lose the modmap changes.
=> https://wiki.archlinux.org/title/LXDE#Autostart

I'll have a read (obviously), but when I copy Xmodmap to ~/.Xmodmap, it works. A bit wierd.

Edit: I have a ~/.config/lxsession/LXDE/autostart file, but it's empty atm, should I just add xmodmap there or do something else?

Last edited by ZALMT (2024-04-07 21:38:22)

Offline

#22 2024-04-08 06:34:35

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

Yup.
Though bn. that if lxsession executes ~/.Xmodmap automatically, it'll probably do so at the right moment (after setting the keyboard layout, but before starting anything) - running it manually from autostart could result in it not being used for eg. global shortcuts.

Offline

#23 2024-04-08 12:12:43

ZALMT
Member
Registered: 2023-10-19
Posts: 32

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

seth wrote:

Yup.
Though bn. that if lxsession executes ~/.Xmodmap automatically, it'll probably do so at the right moment (after setting the keyboard layout, but before starting anything) - running it manually from autostart could result in it not being used for eg. global shortcuts.

Ah, I see, but since I'm not actually using a DE (I'm using Qtile), can I just install the polkit package and have lxsession not run at startup? I'm sort of fuzzy on what is polkit doing, I thought permission is controlled by the users and groups?

Offline

#24 2024-04-08 14:54:20

seth
Member
Registered: 2012-09-03
Posts: 51,684

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

Nothing of any of this has anything to do w/ polkit.

         ├─ 986 /usr/bin/python /sbin/qtile start
         ├─1038 lxsession

lxsession doesn't seem to be a dependency of qtile, idk why it's started.

Offline

#25 2024-04-08 15:07:50

ZALMT
Member
Registered: 2023-10-19
Posts: 32

Re: [SOLVED] Move ~/.Xmodmap out of the home directory?

seth wrote:

Nothing of any of this has anything to do w/ polkit.

         ├─ 986 /usr/bin/python /sbin/qtile start
         ├─1038 lxsession

lxsession doesn't seem to be a dependency of qtile, idk why it's started.


That's because I had it in an autostart file that qtile started, along with things like my wallpaper  and whatnot. I use lxappearance to change my gtk theme, so I'm not sure if I need lxappearance for it to work, the guy that I copied the config file from had it so I just went with it

Offline

Board footer

Powered by FluxBB