wo52616111 / capslock-plus

An efficiency tool that provides various functions by enhancing the Caps Lock key into a modifier key.
https://capslox.com/capslock-plus/
GNU General Public License v2.0
1.14k stars 198 forks source link

希望作者能够适配linux #90

Open Delta-in-hub opened 2 years ago

Delta-in-hub commented 2 years ago

linux上没有capslock-plus,太不习惯了.简直不会敲代码了.

Chivier commented 2 years ago

58 这个方案是不是……近似可用?我觉得最主要的功能是移动,这个可以xmodmap实现

dreamph666 commented 2 years ago

也可以使用key-mapper来实现,个人感觉比xmodmap更好用,下面是我的配置截图:

key_mapper-capslock+

如果没有GUI环境,也可以通过编写配置文件的方式来配置,具体配置方法可以查看key-mapper的官方文档,下面是上述配置截图对应的配置文件的内容:

{
    "mapping": {
        "1,58,1+1,32,1": "Down",
        "1,58,1+1,31,1": "Left",
        "1,58,1+1,33,1": "Right",
        "1,58,1+1,17,1": "BackSpace",
        "1,58,1+1,25,1": "Home",
        "1,58,1+1,39,1": "End",
        "1,58,1+1,36,1": "Shift_L+Left",
        "1,58,1+1,23,1": "Shift_L+Up",
        "1,58,1+1,37,1": "Shift_L+Down",
        "1,58,1+1,38,1": "Shift_L+Right",
        "1,58,1+1,51,1": "Alt_L+Shift_L+Right",
        "1,58,1+1,35,1": "Control_L+Shift_L+Left",
        "1,58,1+1,49,1": "Control_L+Shift_L+Right",
        "1,58,1+1,34,1": "Control_L+Right",
        "1,58,1+1,30,1": "Control_L+Left",
        "1,58,1+1,18,1": "Up",
        "1,58,1": "if_single(key(KEY_CAPSLOCK), , timeout=300)",
        "1,58,1+1,14,1": "k(Home).m(Shift_L, k(End)).k(BackSpace)"
    }
}
Delta-in-hub commented 2 years ago

也可以使用key-mapper来实现,个人感觉比xmodmap更好用,下面是我的配置截图: key_mapper-capslock+ 如果没有GUI环境,也可以通过编写配置文件的方式来配置,具体配置方法可以查看key-mapper的官方文档,下面是上述配置截图对应的配置文件的内容:

{
    "mapping": {
        "1,58,1+1,32,1": "Down",
        "1,58,1+1,31,1": "Left",
        "1,58,1+1,33,1": "Right",
        "1,58,1+1,17,1": "BackSpace",
        "1,58,1+1,25,1": "Home",
        "1,58,1+1,39,1": "End",
        "1,58,1+1,36,1": "Shift_L+Left",
        "1,58,1+1,23,1": "Shift_L+Up",
        "1,58,1+1,37,1": "Shift_L+Down",
        "1,58,1+1,38,1": "Shift_L+Right",
        "1,58,1+1,51,1": "Alt_L+Shift_L+Right",
        "1,58,1+1,35,1": "Control_L+Shift_L+Left",
        "1,58,1+1,49,1": "Control_L+Shift_L+Right",
        "1,58,1+1,34,1": "Control_L+Right",
        "1,58,1+1,30,1": "Control_L+Left",
        "1,58,1+1,18,1": "Up",
        "1,58,1": "if_single(key(KEY_CAPSLOCK), , timeout=300)",
        "1,58,1+1,14,1": "k(Home).m(Shift_L, k(End)).k(BackSpace)"
    }
}

十分感谢,我去试试

yar2001 commented 2 years ago

After trying Xmodmap and Autokey, the key-mapper (which now is called input-remapper) seems to be the best to simulate capslock-plus function. However, the config @dreamph666 provide is outdated for the new version, the following config is up to date and add more function:

{
    "mapping": {
        "1,58,1+1,32,1": [
            "Down",
            "keyboard"
        ],
        "1,58,1+1,31,1": [
            "Left",
            "keyboard"
        ],
        "1,58,1+1,33,1": [
            "Right",
            "keyboard"
        ],
        "1,58,1+1,17,1": [
            "BackSpace",
            "keyboard"
        ],
        "1,58,1+1,25,1": [
            "Home",
            "keyboard"
        ],
        "1,58,1+1,39,1": [
            "End",
            "keyboard"
        ],
        "1,58,1+1,36,1": [
            "Shift_L+Left",
            "keyboard"
        ],
        "1,58,1+1,23,1": [
            "Shift_L+Up",
            "keyboard"
        ],
        "1,58,1+1,37,1": [
            "Shift_L+Down",
            "keyboard"
        ],
        "1,58,1+1,38,1": [
            "Shift_L+Right",
            "keyboard"
        ],
        "1,58,1+1,51,1": [
            "Alt_L+Shift_L+Right",
            "keyboard"
        ],
        "1,58,1+1,35,1": [
            "Control_L+Shift_L+Left",
            "keyboard"
        ],
        "1,58,1+1,30,1": [
            "Control_L+Left",
            "keyboard"
        ],
        "1,58,1+1,34,1": [
            "Control_L+Right",
            "keyboard"
        ],
        "1,58,1+1,18,1": [
            "Up",
            "keyboard"
        ],
        "1,58,1+1,14,1": [
            "k(Home).m(Shift_L, k(End)).k(BackSpace)",
            "keyboard"
        ],
        "1,58,1": [
            "if_single(key(Control_L), , timeout=300)",
            "keyboard"
        ],
        "1,58,1+1,22,1": [
            "Shift_L+Home",
            "keyboard"
        ],
        "1,58,1+1,24,1": [
            "Shift_L+End",
            "keyboard"
        ],
        "1,58,1+1,52,1": [
            "Control_L+Shift_L+Right",
            "keyboard"
        ],
        "1,58,1+1,57,1": [
            "KEY_ENTER",
            "keyboard"
        ],
        "1,58,1+1,12,1": [
            "Control_L+KEY_PAGEUP",
            "keyboard"
        ],
        "1,58,1+1,13,1": [
            "Control_L+KEY_PAGEDOWN",
            "keyboard"
        ],
        "1,58,1+1,46,1": [
            "Control_L+c",
            "keyboard"
        ],
        "1,58,1+1,47,1": [
            "Control_L+v",
            "keyboard"
        ],
        "1,58,1+1,45,1": [
            "Control_L+x",
            "keyboard"
        ],
        "1,58,1+1,44,1": [
            "Control_L+z",
            "keyboard"
        ]
    }
}

(Sorry, I haven't installed pinyin keyboard in my Linux yet :(

KAGEYAM4 commented 1 year ago

After trying Xmodmap and Autokey, the key-mapper (which now is called input-remapper ) seems to be the best to simulate capslock-plus function. However, the config @dreamph666 provide is outdated for the new version, the following config is up to date and add more function:

{
    "mapping": {
        "1,58,1+1,32,1": [
            "Down",
            "keyboard"
        ],
        "1,58,1+1,31,1": [
            "Left",
            "keyboard"
        ],
        "1,58,1+1,33,1": [
            "Right",
            "keyboard"
        ],
        "1,58,1+1,17,1": [
            "BackSpace",
            "keyboard"
        ],
        "1,58,1+1,25,1": [
            "Home",
            "keyboard"
        ],
        "1,58,1+1,39,1": [
            "End",
            "keyboard"
        ],
        "1,58,1+1,36,1": [
            "Shift_L+Left",
            "keyboard"
        ],
        "1,58,1+1,23,1": [
            "Shift_L+Up",
            "keyboard"
        ],
        "1,58,1+1,37,1": [
            "Shift_L+Down",
            "keyboard"
        ],
        "1,58,1+1,38,1": [
            "Shift_L+Right",
            "keyboard"
        ],
        "1,58,1+1,51,1": [
            "Alt_L+Shift_L+Right",
            "keyboard"
        ],
        "1,58,1+1,35,1": [
            "Control_L+Shift_L+Left",
            "keyboard"
        ],
        "1,58,1+1,30,1": [
            "Control_L+Left",
            "keyboard"
        ],
        "1,58,1+1,34,1": [
            "Control_L+Right",
            "keyboard"
        ],
        "1,58,1+1,18,1": [
            "Up",
            "keyboard"
        ],
        "1,58,1+1,14,1": [
            "k(Home).m(Shift_L, k(End)).k(BackSpace)",
            "keyboard"
        ],
        "1,58,1": [
            "if_single(key(Control_L), , timeout=300)",
            "keyboard"
        ],
        "1,58,1+1,22,1": [
            "Shift_L+Home",
            "keyboard"
        ],
        "1,58,1+1,24,1": [
            "Shift_L+End",
            "keyboard"
        ],
        "1,58,1+1,52,1": [
            "Control_L+Shift_L+Right",
            "keyboard"
        ],
        "1,58,1+1,57,1": [
            "KEY_ENTER",
            "keyboard"
        ],
        "1,58,1+1,12,1": [
            "Control_L+KEY_PAGEUP",
            "keyboard"
        ],
        "1,58,1+1,13,1": [
            "Control_L+KEY_PAGEDOWN",
            "keyboard"
        ],
        "1,58,1+1,46,1": [
            "Control_L+c",
            "keyboard"
        ],
        "1,58,1+1,47,1": [
            "Control_L+v",
            "keyboard"
        ],
        "1,58,1+1,45,1": [
            "Control_L+x",
            "keyboard"
        ],
        "1,58,1+1,44,1": [
            "Control_L+z",
            "keyboard"
        ]
    }
}

(Sorry, I haven't installed pinyin keyboard in my Linux yet :(

Are you still using Input Remapper, i just migrated completely to Linux and trying to find alternative to Capslock+. If you are still on this can you please provide latest config if you have made some additions.

Also can you please where should i paste this settings. I went into /home/user_name/.config/input-remapper-2/presets/AT Translated Set 2 keyboard/ , there is a json file but its totally different from what you pasted. This is how it looks for me after i added some mappings ->

[
    {
        "input_combination": [
            {
                "type": 1,
                "code": 58,
                "origin_hash": "18ab2ccaa82365e4b599de26f5f8fce3"
            }
        ],
        "target_uinput": "keyboard",
        "output_symbol": "Escape",
        "mapping_type": "key_macro"
    },
    {
        "input_combination": [
            {
                "type": 1,
                "code": 58,
                "origin_hash": "18ab2ccaa82365e4b599de26f5f8fce3"
            },
            {
                "type": 1,
                "code": 17,
                "origin_hash": "18ab2ccaa82365e4b599de26f5f8fce3"
            }
        ],
        "target_uinput": "keyboard",
        "output_symbol": "KEY_BACKSPACE",
        "mapping_type": "key_macro"
    },
    {
        "input_combination": [
            {
                "type": 1,
                "code": 58,
                "origin_hash": "18ab2ccaa82365e4b599de26f5f8fce3"
            },
            {
                "type": 1,
                "code": 19,
                "origin_hash": "18ab2ccaa82365e4b599de26f5f8fce3"
            }
        ],
        "target_uinput": "keyboard",
        "output_symbol": "Delete",
        "mapping_type": "key_macro"
    }