You are not logged in.

#1 2023-06-08 06:00:09

knarh
Member
Registered: 2023-03-11
Posts: 58

[SOLVED]xmodmap doesn't work on startup(xinit)

Hello,
I want to use Caps_Lock as a modifier(I redefined Caps as additional Hyper key in xorg.conf), so here's ~/.Xmodmap:

clear mod3
remove mod4 = Hyper_L
add mod3 Hyper_L

When I ran "xmodmap .Xmodmap" from term emulator all works fine, but with xinitrc on startup it doesn't work, .xinitrc:

#!/bin/sh

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

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb $sysresources
fi

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

if [ -f "$userresources" ]; then
    xrdb "$userresoures"
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

DISPLAY=:0.0 fbsetbg -a /home/wallpapers/Wall232.jpg
DISPLAY=:0.1 fbsetbg -a /home/wallpapers/Wall232.jpg
xterm &
exec startfluxbox

xmodmap -pm before moving Caps to mod3

xmodmap:  up to 5 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock      
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Alt_R (0x6c),  Alt_L (0xcc),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3        ISO_Level5_Shift (0xcb)
mod4        Hyper_L (0x42),  Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c)

xmodmap -pm after:

xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock      
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Alt_R (0x6c),  Alt_L (0xcc),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3        Hyper_L (0x42),  Hyper_L (0xcf)
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce)
mod5        ISO_Level3_Shift (0x5c)

Xinitrc doesn't look broken, so where's a mistake? Thanks in advance

Last edited by knarh (2023-06-08 09:25:07)

Offline

#2 2023-06-08 06:38:04

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,237

Re: [SOLVED]xmodmap doesn't work on startup(xinit)

cat ~/.fluxbox/startup

Generally pretty much any call to setxkbmap will nuke the modmap.

Offline

#3 2023-06-08 06:50:00

knarh
Member
Registered: 2023-03-11
Posts: 58

Re: [SOLVED]xmodmap doesn't work on startup(xinit)

#!/bin/sh
#
# fluxbox startup-script:
#
# Lines starting with a '#' are ignored.

# Change your keymap:
xmodmap "/home/trashy/.Xmodmap"

# Applications you want to run with fluxbox.
# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN ''&'' AT THE END.
#
# unclutter -idle 2 &
# wmnd &
# wmsmixer -w &
# idesk &

# And last but not least we start fluxbox.
# Because it is the last app you have to run it with ''exec'' before it.

exec fluxbox
# or if you want to keep a log:
# exec fluxbox -log "/home/trashy/.fluxbox/log"

Generally pretty much any call to setxkbmap will nuke the modmap.

I have

Option "XkbOptions" "grp:alt_shift_toggle,terminate:ctrl_alt_bksp,caps:hyper"

So, I'll try to redefine Caps to modifier by xkb instead, thanks

Offline

#4 2023-06-08 06:56:11

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,237

Re: [SOLVED]xmodmap doesn't work on startup(xinit)

Having that setting in your xorg config should™ be fine, since that gets executed before modmap (unless the keyboard shows up late or again)
That being said: you have the xkb option and call xmodmap twice (in the xinitrc and the  fluxbox startup script …)

Offline

#5 2023-06-08 07:06:01

knarh
Member
Registered: 2023-03-11
Posts: 58

Re: [SOLVED]xmodmap doesn't work on startup(xinit)

I've changed

exec startfluxbox --> exec fluxbox 

So, xmodmap isn't called twice.
And here's 90-keyboard.conf if it helps:

Section "InputClass"
        Identifier      "Keyboard Defaults"
        MatchIsKeyboard "yes"
        Option "XkbLayout" "us,ru"
        Option "XkbOptions" "grp:alt_shift_toggle,terminate:ctrl_alt_bksp,caps:hyper"
EndSection

Last edited by knarh (2023-06-08 07:08:04)

Offline

#6 2023-06-08 07:10:12

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,237

Re: [SOLVED]xmodmap doesn't work on startup(xinit)

You should not be modmapping this at all.
What's the output of "setxkbmap -print -query" and "xev -event keyboard" when you press the capslock key?
Also, what if you use a single layout  only?

Offline

#7 2023-06-08 07:22:15

knarh
Member
Registered: 2023-03-11
Posts: 58

Re: [SOLVED]xmodmap doesn't work on startup(xinit)

xev -event keyboard

Outer window is 0x600002, inner window is 0x600003

KeymapNotify event, serial 25, synthetic NO, window 0x0,
    keys:  130 0   0   0   16  0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

KeyPress event, serial 29, synthetic NO, window 0x600002,
    root 0x380, subw 0x0, time 9948159, (-589,353), root:(818,371),
    state 0x0, keycode 66 (keysym 0xffed, Hyper_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 29, synthetic NO, window 0x1e00002,
    root 0x380, subw 0x0, time 10402610, (-645,590), root:(661,608),
    state 0x40, keycode 66 (keysym 0xffed, Hyper_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

setxkbmap -print -query

Couldn't interpret _XKB_RULES_NAMES property
Use defaults: rules - 'base' model - 'pc105' layout - 'us'
xkb_keymap {
        xkb_keycodes  { include "xfree86+aliases(qwerty)"       };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us+inet(pc105)"     };
        xkb_geometry  { include "pc(pc105)"     };
};
rules:      base
model:      pc105
layout:     us

With single layout nothing has changed

Last edited by knarh (2023-06-08 07:24:58)

Offline

#8 2023-06-08 07:41:12

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,237

Re: [SOLVED]xmodmap doesn't work on startup(xinit)

It /is/ producing the hyper key?
What's the actual issue here?

Couldn't interpret _XKB_RULES_NAMES property

 xprop -root _XKB_RULES_NAMES

And please post your Xorg log, https://wiki.archlinux.org/title/Xorg#General

Offline

#9 2023-06-08 08:00:01

knarh
Member
Registered: 2023-03-11
Posts: 58

Re: [SOLVED]xmodmap doesn't work on startup(xinit)

xprop -root _XKB_RULES_NAMES

_XKB_RULES_NAMES:  not found

Xorg.0.log:
http://0x0.st/HcKq.txt

It /is/ producing the hyper key?

Didn't get the point, but capslock producing hyper key, caps is redifined to be additional hyper key

What's the actual issue here?

Didn't understand the question

Offline

#10 2023-06-08 08:04:23

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,237

Re: [SOLVED]xmodmap doesn't work on startup(xinit)

The xkbmap might only apply to one of the displays.

DISPLAY=:0.0 setxkbmap -print -query
DISPLAY=:0.0 xprop -root _XKB_RULES_NAMES
DISPLAY=:0.1 setxkbmap -print -query
DISPLAY=:0.1 xprop -root _XKB_RULES_NAMES

Didn't get the point, but capslock producing hyper key, caps is redifined to be additional hyper key

Yes. That's what xev says.

Didn't understand the question

What do you expect to happen, what does happen and what is your metric (test case)?

Edit: hold on, there's only one GPU.
Do you actually intend to run the server w/ independend screens?

Last edited by seth (2023-06-08 08:06:43)

Offline

#11 2023-06-08 08:16:12

knarh
Member
Registered: 2023-03-11
Posts: 58

Re: [SOLVED]xmodmap doesn't work on startup(xinit)

DISPLAY=:0.0 setxkbmap -print -query

xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us+ru:2+inet(evdev)+group(alt_shift_toggle)+capslock(hyper)+terminate(ctrl_alt_bksp)"       };
        xkb_geometry  { include "pc(pc105)"     };
};
rules:      evdev
model:      pc105
layout:     us,ru
options:    grp:alt_shift_toggle,terminate:ctrl_alt_bksp,caps:hyper

DISPLAY=:0.0 xprop -root _XKB_RULES_NAMES

_XKB_RULES_NAMES(STRING) = "evdev", "pc105", "us,ru", "", "grp:alt_shift_toggle,terminate:ctrl_alt_bksp,caps:hyper"

DISPLAY=:0.1 setxkbmap -print -query

Couldn't interpret _XKB_RULES_NAMES property
Use defaults: rules - 'base' model - 'pc105' layout - 'us'
xkb_keymap {
        xkb_keycodes  { include "xfree86+aliases(qwerty)"       };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us+inet(pc105)"     };
        xkb_geometry  { include "pc(pc105)"     };
};
rules:      base
model:      pc105
layout:     us

DISPLAY=:0.1 xprop -root _XKB_RULES_NAMES

_XKB_RULES_NAMES: not found

What do you expect to happen, what does happen and what is your metric (test case)?

I have a hotkey in fluxbox
Mod3(Capslock as hyper key) + h executes urxvt

Do you actually intend to run the server w/ independend screens?

Yes, as I understood this is the only way to use different Xresoureces for different monitors(maybe I'm an idiot)

Offline

#12 2023-06-08 08:23:41

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,237

Re: [SOLVED]xmodmap doesn't work on startup(xinit)

DISPLAY=:0.1 setxkbmap -print -query

The keymap isn't applied to that display.

DISPLAY=:0.1 setxkbmap -rules evdev -layout us,ru -option grp:alt_shift_toggle,terminate:ctrl_alt_bksp,caps:hyper

Do you also run two fluxbox instances, resp. xinit on either $DISPLAY?

this is the only way to use different Xresoureces for different monitors

This is correct, what's the purpose of that?
(The dual screen setup is at the core of your issues and makes your life harder than it maybe needs to be…)

Offline

#13 2023-06-08 08:44:18

knarh
Member
Registered: 2023-03-11
Posts: 58

Re: [SOLVED]xmodmap doesn't work on startup(xinit)

DISPLAY=:0.1 setxkbmap -rules evdev -layout us,ru -option grp:alt_shift_toggle,terminate:ctrl_alt_bksp,caps:hyper

Can I put something like that to xorg.conf? Anyway I'll try do this by xorg.conf, thanks!

Do you also run two fluxbox instances, resp. xinit on either $DISPLAY?

I don't know how to check it, but ps axu | grep flux shows only 1 process:

trashy      9425  0.0  0.0  26064 14592 tty1     S    17:53   0:00 fluxbox

This is correct, what's the purpose of that?

Monitors aren't the same(size and resolution --> dpi),so I want to have different font size for each other

(The dual screen setup is at the core of your issues and makes your life harder than it maybe needs to be…)

True...

Last edited by knarh (2023-06-08 08:46:53)

Offline

Board footer

Powered by FluxBB