Code Monkey home page Code Monkey logo

Comments (13)

ajanon avatar ajanon commented on August 29, 2024 1

What is the difference between

hyper + f
  jumpapp firefox

and

capslock + f
  jumpapp firefox

in your case? If I understand correctly, this is exactly what you want: map the caps lock physical key to a command (which is what it means for swhkd).

swhkd reads input at a lower level than X11 libraries, so your custom rebind (with xmodmap, setxbkmap or any other) should not impact it in any way. (please correct me if I am wrong @angelofallars @EdenQwQ @Shinyzenith)

I think you should even be able to keep your custom config in X or wayland and both swhkd binds and your custom mappings should work together.

from swhkd.

simonwiles avatar simonwiles commented on August 29, 2024 1

@ajanon -- thank you for the suggestion. With just:

capslock + f
  jumpapp firefox

I just get:

[... ERROR swhkd] Config Error: Error parsing config file "/etc/swhkd/swhkdrc". Invalid modifier at line 1.

This is similar to sxhkd, which why capslock has to be mapped to the hyper modifier first.

from swhkd.

xircon avatar xircon commented on August 29, 2024 1

Yup, caps lock is not a "modifier" I get exactly the same. You can however use the hyper modifier in sway, so that is the route I took.

from swhkd.

Shinyzenith avatar Shinyzenith commented on August 29, 2024 1

swhkd reads input at a lower level than X11 libraries, so your custom rebind

@ajanon You are correct!

from swhkd.

Shinyzenith avatar Shinyzenith commented on August 29, 2024

Hi, thank you for the verbose report. Would you mind expanding on what the hyper key is? I'm not particularly familiar with that.

from swhkd.

xircon avatar xircon commented on August 29, 2024

It is an additional modifier, so I now have Super, Alt, Control and Hyper. You can use xmodmap to do this on x11, but on wayland I used this:

https://ibnishak.github.io/blog/post/caps-to-hyper/

So in sxhkd you can use:

hyper+d
    <your-command-here>

Press and hold caps lock - press d.

I can define hyper in my sway config and it works:

set $mod3 Mod3
#######################
# Hyper key bindings: #
#######################

    bindsym $mod3+b exec --no-startup-id killall -SIGUSR1 waybar
    bindsym $mod3+n exec swaync-client -t -sw
    bindsym $mod3+s exec ~/.local/bin/grimm
    bindsym $mod3+u exec ~/scripts/ups.sh 

All of which function as expected.

For a full history of additional modifiers, search for space-cadet keyboards on lisp machines (spot the emacs user 😄).

:edit:
To get caps lock, I use:

input type:keyboard {
      		    xkb_layout "gb"
		    xkb_options shift:both_capslock # <<<<<<<<<<<<<<
		    }

Press both shifts to toggle caps lock.

from swhkd.

Shinyzenith avatar Shinyzenith commented on August 29, 2024

OK I will get someone to look into this. I currently can't work on it due to my deteriorating health.

from swhkd.

xircon avatar xircon commented on August 29, 2024

No problems, I completely understand, I am an old crip, easier and quicker to list what isn't wrong with me 🤣

from swhkd.

simonwiles avatar simonwiles commented on August 29, 2024

I was experimenting with migrating from sxhkd, but this is a show-stopper for me. With my existing sxhkd config:

hyper + f
  jumpapp firefox

...

I get:

[2022-08-19T00:09:53Z ERROR swhkd] Config Error: Error parsing config file "/etc/swhkd/swhkdrc". Unknown symbol at line 1.

99% of what I use sxhkd for is mapping commands to hyper combinations, fwiw.

from swhkd.

Shinyzenith avatar Shinyzenith commented on August 29, 2024

patches are always welcome

from swhkd.

redxtech avatar redxtech commented on August 29, 2024

does that mean that there's no way to get binds with the hyper mod key working in swhkd?

from swhkd.

samsonnagamani avatar samsonnagamani commented on August 29, 2024

I found the code to do with the "hyper" mod key, while trying to make the "alt graph" key work. It may be considered a breaking change. I've managed to get it working with the "alt gr" key so I'm assuming it would work with the "hyper" key, however I don't have a keyboard with the "hyper" key.

Also by "hyper" key I'm assuming you mean the "right logo/windows" button found on larger keyboards.

There are 2 main steps to get the hyper key working.

  1. Add "Hyper" in the "Modifier" enum in config.rs
pub enum Modifier {
    Super,
    Hyper,
    Alt,
    Control,
    Shift,
    Any,
}
  1. Map "RIGHTMETA" key to the "Hyper" Modifer enum in the "modifiers_map" hashmap located in daemon.rs
    let modifiers_map: HashMap<Key, config::Modifier> = HashMap::from([
        (Key::KEY_LEFTMETA, config::Modifier::Super),
        (Key::KEY_RIGHTMETA, config::Modifier::Hyper),
        (Key::KEY_LEFTALT, config::Modifier::Alt),
        (Key::KEY_RIGHTALT, config::Modifier::Alt),
        (Key::KEY_LEFTCTRL, config::Modifier::Control),
        (Key::KEY_RIGHTCTRL, config::Modifier::Control),
        (Key::KEY_LEFTSHIFT, config::Modifier::Shift),
        (Key::KEY_RIGHTSHIFT, config::Modifier::Shift),
    ]);

Again, I can't test whether this will work since I don't have that key available on my keyboard

from swhkd.

Shinyzenith avatar Shinyzenith commented on August 29, 2024

@samsonnagamani Thanks for the patch! If anyone can test it and get it working, I'd be more than happy to merge and support this usecase.

from swhkd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.