You are not logged in.

#1 2019-12-29 09:51:28

archinco
Member
From: Germany
Registered: 2019-10-20
Posts: 34

[SOLVED] Xmodmap on xinitrc doesnt take any effect

hello @all,

thats the conent of my ~/.Xmodmap:

clear lock
keycode 66 = Super_L
add mod4 = Super_L

i changed my .xinitrc to load the settings on startup

xrdb $HOME/.Xresources
xmodmap $HOME/.Xmodmap
xbindkeys
exec i3

Cmd "xmodmap ~/.Xmodmap" works perfectly.
On startup nothing seems to work.
I also tried to exec via i3....

Seems like i3 (or some other startup process) force the standard keys and ignore my xmodmap....
I've read about a solution with setxkbmap ... but that's too complex
Any suggesions?

Last edited by archinco (2019-12-29 22:16:01)


current arch installation
Please leave comments on gist.

Offline

#2 2019-12-29 13:54:24

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,729
Website

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

How do you start x (DM, or manually startx or xinit from tty, etc)?

Is that the full content of your xinitrc?  If so, it is incomplete, check the wiki.  If not, please post the complete xinitrc.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2019-12-29 14:27:18

archinco
Member
From: Germany
Registered: 2019-10-20
Posts: 34

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

Thanks for your reply.

My startx is defined in the .zprofile:
[[ ! $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx -- vt1

Yeah, it's the full content. I just get rid of unnessecary stuff...
I compared to the /etc/X11... and don't see something important missing.
Even in the wiki I don't see what you mean, can you clarify?

Last edited by archinco (2019-12-29 14:28:22)


current arch installation
Please leave comments on gist.

Offline

#4 2019-12-29 14:29:03

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

https://wiki.archlinux.org/index.php/Xinit#xinitrc
Make sure to read the second note.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#5 2019-12-29 14:50:09

archinco
Member
From: Germany
Registered: 2019-10-20
Posts: 34

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

Thank you, i've added the missing block.
I've exprimented with two different ways to insert xmodmap:

xrdb $HOME/.Xresources
1. xmodmap $HOME/.Xmodmap
xbindkeys

# 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

2. xmodmap ~/.Xmodmap &

exec i3

But it does not solve my issue.
After reboot the custom keybinding does not work.


current arch installation
Please leave comments on gist.

Offline

#6 2019-12-29 15:44:03

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,729
Website

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

Hmm.  I don't know why that could be then.  But if I were in your place my next diagnostic step would be to (temporarily) replace `exec i3` with `exec xterm` or some other simple terminal.  Then when X starts you'll have just a terminal window and you can check whether the modmap changes have been applied.  This could narrow down whether or not i3 may be changing something.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2019-12-29 16:21:05

seth
Member
Registered: 2012-09-03
Posts: 53,214

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

Don't fork xmodmap.

My guess would be  that somewhen later (through the i3 config?) setxkbmap is invoked (eg. to alter the layout) - which is going to reset the map.

Offline

#8 2019-12-29 18:06:26

archinco
Member
From: Germany
Registered: 2019-10-20
Posts: 34

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

Trilby wrote:

Hmm.  I don't know why that could be then.  But if I were in your place my next diagnostic step would be to (temporarily) replace `exec i3` with `exec xterm` or some other simple terminal.  Then when X starts you'll have just a terminal window and you can check whether the modmap changes have been applied.  This could narrow down whether or not i3 may be changing something.

I've followed your advice.
I3 is not responsible.
Even in xterm, the keybinding doesn't work after startup.

But i don't know how to blame the evil process.
Any suggestions?


current arch installation
Please leave comments on gist.

Offline

#9 2019-12-29 18:37:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,729
Website

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

The only possibility left would be something in your shell config(s).  Please post/link-to your shell profile/rc.

You suggest you are using zsh.  Wild guess, are you using OMZ?  If so, I'd bet on that being the problem.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#10 2019-12-29 19:14:04

archinco
Member
From: Germany
Registered: 2019-10-20
Posts: 34

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

I've already posted the one line in my .zprofile.
Here is my current .zshrc:
Actually, i removed OMZ today. Just take what i want via source...

# Enable colors
autoload -U colors && colors

# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
autoload -U up-line-or-beginning-search
autoload -U down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "^[[A" up-line-or-beginning-search # Up
bindkey "^[[B" down-line-or-beginning-search # Down


# Basic auto/tab complete:
autoload -Uz compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots)		# Include hidden files.

# Vi Mode
# --------------------------------------------------------------
bindkey -v
bindkey 'jk' vi-cmd-mode

# Change cursor shape for different vi modes.
function zle-keymap-select {
  if [[ ${KEYMAP} == vicmd ]] ||
     [[ $1 = 'block' ]]; then
    echo -ne '\e[1 q'
  elif [[ ${KEYMAP} == main ]] ||
       [[ ${KEYMAP} == viins ]] ||
       [[ ${KEYMAP} = '' ]] ||
       [[ $1 = 'beam' ]]; then
    echo -ne '\e[5 q'
  fi
}
zle -N zle-keymap-select
zle-line-init() {
    zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
    echo -ne "\e[5 q"
}
zle -N zle-line-init
echo -ne '\e[5 q' # Use beam shape cursor on startup.
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.

# Use lf to switch directories and bind it to ctrl-o
lfcd () {
    tmp="$(mktemp)"
    lf -last-dir-path="$tmp" "$@"
    if [ -f "$tmp" ]; then
        dir="$(cat "$tmp")"
        rm -f "$tmp"
        [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
    fi
}
bindkey -s '^o' 'lfcd\n'

# Use vim keys in tab complete menu:
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -v '^?' backward-delete-char

# system information
neofetch --config ~/.config/neofetch

# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"

# Preferred editor for local and remote sessions
export EDITOR='nvim'

# git alias for dotfiles
alias config='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'

# add syntax highlighting
# install zsh-syntax-highlighting (pacman)
source ~/.config/zsh/fsh/fast-syntax-highlighting.plugin.zsh

# add a custom theme based on gnzh
source ~/.config/zsh/gnzh.zsh-theme

# add asynch task handling
source ~/.config/zsh/zsh-async/async.zsh

# use fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

current arch installation
Please leave comments on gist.

Offline

#11 2019-12-29 19:21:51

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,729
Website

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

That zshrc doesn't mean much without the content of all those sourced files (and anything they source).  But it sounds like OMZ may be the culprit here.  Try again with an empty zshrc.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#12 2019-12-29 19:30:28

archinco
Member
From: Germany
Registered: 2019-10-20
Posts: 34

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

Doesn't work with empty .zshrc, too.
Is it possible to somehow debug the startup process related to keybinding?


current arch installation
Please leave comments on gist.

Offline

#13 2019-12-29 20:16:00

seth
Member
Registered: 2012-09-03
Posts: 53,214

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

After reboot the custom keybinding does not work.

Hold on, what does that mean? How do you actually determine that "xmodmap doesn't work"?
What's the output of

xmodmap -pke | grep "keycode  66"

right after starting X11?

Offline

#14 2019-12-29 20:46:00

archinco
Member
From: Germany
Registered: 2019-10-20
Posts: 34

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

Hold on, what does that mean? How do you actually determine that "xmodmap doesn't work"?

Just press CapsLock+X to check if the new keybinding works like Super_L+X.


What's the output of

xmodmap -pke | grep "keycode  66"

right after starting X11?

After reboot: (Capslock+X, does not work)

keycode  66 = Super_L NoSymbol Super_L

When i run:

xmodmap ~/.Xmodmap

the output doesn't change. But then Capslock+X works...

Last edited by archinco (2019-12-29 20:52:05)


current arch installation
Please leave comments on gist.

Offline

#15 2019-12-29 21:25:22

seth
Member
Registered: 2012-09-03
Posts: 53,214

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

Which process binds capslock+x?
Also using setxkmap (or an Xorg configlet) isn't very hard, use the "caps:super" option.
https://wiki.archlinux.org/index.php/Xo … tion_files

Offline

#16 2019-12-29 21:34:17

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,729
Website

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

Worst case, you could likely use something like this at the end of your xinitrc:

(sleep 1; xmodmap ~/.Xmodmap) &
exec i3

But that's pretty ugly.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#17 2019-12-29 22:07:39

archinco
Member
From: Germany
Registered: 2019-10-20
Posts: 34

Re: [SOLVED] Xmodmap on xinitrc doesnt take any effect

Which process binds capslock+x?
Also using setxkmap (or an Xorg configlet) isn't very hard, use the "caps:super" option.
https://wiki.archlinux.org/index.php/Xo … tion_files

This works for me:

etc/X11/xorg.conf.d/10-super.conf
__________________________________
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "de"
        Option "XkbModel" "pc105"
        Option "XkbVariant" "nodeadkeys"
        Option "XkbOptions" "caps:super"
EndSection

@Trilby, i really don't like sleep actions in my configs wink

Thanks for all your help smile

Last edited by archinco (2019-12-29 22:14:05)


current arch installation
Please leave comments on gist.

Offline

Board footer

Powered by FluxBB