Rebind Alt (mod1) to control when capslock is pressed down

Hey guys, I’ve been using this xmodmap config which rebinds the hjkl keys to the arrow keys when CapsLock is held down, from this site I found. Which can be found by searching for the keyword: System wide vim-style (hjkl) navigation and clicking on the result from the wordpress site called shellhell (I’m not allowed to put links in here because I’m a new user). It works fine, I had no problems with it, but the problem is my left Control key is broken, so I would like to be able to use that config and also be able to use the Control key by holding down Alt while holding down CapsLock (meaning I want Alt to act as Control when I press down CapsLock). I have looked at the ArchWiki page for xmodmap and xkb, but I cannot figure out how to do this, I think it has something to do with both CapsLock and Alt being “special” keys or something. I would love to know if there is a way this can be done, it doesn’t have to be xmodmap, if you know any other program, such as xkb, autokey or anything else. And here what that .Xmodmap file contains:

!remove Caps Lock
clear lock
remove Lock = Caps_Lock
remove Shift = Caps_Lock

!add Mode_switch
keycode 66 = NoSymbol NoSymbol
keycode 66 = Mode_switch

!vim-like and other custom keybindings
keysym h = h H Left NoSymbol NoSymbol NoSymbol
keysym j = j J Down NoSymbol NoSymbol NoSymbol
keysym k = k K Up NoSymbol NoSymbol NoSymbol
keysym l = l L Right NoSymbol lstroke Lstroke
keysym q = q Q Escape NoSymbol NoSymbol NoSymbol

!add CapsLock+Alt as Control
clear Mod1
clear control
add Mod1 = Control_L Control_R
add control = Control_L Control_R

As you can see, I added q as Esc on there, so that works fine, but when I try to add mod1 / Alt it’s kinda difficult, I tried all sorts of things, I looked through the ArchWiki multiple times, and searched for it A LOT, but I can’t find anything!! :frowning:

Would really appreciate it if you guys can help me with this, thank you! :slight_smile: