I would like to remap a modifier key, in my case CAPS_LOCK, to send multiple modifiers at once on its one. By that, I mean not a specific combination of keys, like <Ctrl>+C. While the second part, mapping a key to a key combination, is answered in multiple questions, I have not found a solution for the first problem.
https://unix.stackexchange.com/questions/11182/mapping-key-combination-with-xmodmap shows how to map to a specific key combinations
https://wiki.archlinux.org/index.php/xmodmap#Reassigning_modifiers_to_keys_on_your_keyboard Xmodmap, while able to create multiple layers for your keyboard, does not support this
https://ubuntuforums.org/showthread.php?t=1764318 I have seen AutoKey mentioned a few times, but you cannot map to a modifier key
https://unix.stackexchange.com/questions/11182/mapping-key-combination-with-xmodmap The proposed combination of xbindkeys and xmacro also does not seem to support this
https://www.semicomplete.com/projects/xdotool/ Xdotool seems promising, but the documentation is quite lacking
To make things more specific: I would like to remap Caps_lock to Meta+Control+Alt+Shift so I have a modifier key that does not conflict with any other key combinations defined by system applications. The combination is a result of sharing my PyCharm and Intellij keymap between a Mac and my Ubuntu machine and on Mac I use Karabiner to map the caps lock to a so called Hyper key, which is the combination of the above mentioned modifiers.
I realize this thread is old but for others like me who stumble by, this is how I've successfully mapped the caps lock key on my Apple Magic Keyboard to left-command+left-option+left-shift:
{
"manipulators": [
{
"description": "Change caps_lock to command+option+shift.",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_shift",
"modifiers": [
"left_command",
"left_alt"
]
}
],
"type": "basic"
}
]
}
[To prevent misunderstandings: do you mean "at once on its OWN"? You typed: "on its ONE"]
As its name insinuates, caps_lock LOCKS its state permanently (on my Windows keyboard).
MEANING: pressing caps_lock once returns "eventType: key_down" (in K-E's EventViewer) and only a second press will invoke "eventType: key_up".
So if you plan to "send" and be done with it, I'm afraid caps_lock prevents this "mechanically".
(This is confirmed/illustrated by: if you code an additional "to_if_held_down" with a long waiting time -2s- and press caps_lock shortly, your "held_down"-commands will STILL be executed after 2s.)
SO: if your Apple/internal keyboard behaves DIFFERENTLY: please comment HERE !!!
I am not sure that I got the "intention" of your question (see comments) but I'll still try to answer.
The current version 12.1 necessitates manual editing of your ~/.config/karabiner/ karabiner.json file for complex remaps (until a final "non-elements" version is released).
Following code works very well for me in principle, but its state is toggled key_down/_up:
{ "description": "META-Cmd & Shift & Control & Option",
"manipulators": [
{ "from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [ "any" ] }
},
"to": [{
"key_code": "left_command",
"modifiers": [
"left_shift",
"left_control",
"left_option" ]
}],
"type": "basic"
} ]},
My Windows keyboard toggles EVERY time I press it, no matter what my settings in Sys-Prefs Keyboard Special-Keys are. (I read somewhere that a Microsoft driver may be the cause.)
Related
We are currently running into an issue when expanding our current azure search features.
When we have the following string indexed in azure search:
AEDE190EACWWG4VGLDE02000UHKPT
And we search for that complete string, we are not able to find it.
However, when we only use 20 chars, we are able to find it.
So the with the string below, we are able to find it
AEDE190EACWWG4VGLDE
However, when adding just 1 more char it disappears again. And this is not only within our implementation. This is also in azure itself when entering this within the query string
The field is set up as
Retrievable
Filterable
Searchable
Anyone know how to solve this issue?
I tested your scenario now, and it works fine. I cannot reproduce the problem you have. You don't specify which analyzer you use, so I'm going to assume you use the standard analyzer.
Here is how I tested.
I create a new index with two fields Id and Ordcode.
I upload two records via Postman
"value": [
{
"#search.action": "mergeOrUpload",
"Id": "1",
"Ordcode" : "AEDE190EACWWG4VGLDE02000UHKPT"
},
{
"#search.action": "mergeOrUpload",
"Id": "2",
"Ordcode": "ABC123"
}]
I search for your the string AEDE190EACWWG4VGLDE02000UHKPT using searchMode=all, queryType=full. The response is as expected.
{
"#odata.context": "https://<search-service>.search.windows.net/indexes('dg-test-65143696')/$metadata#docs(*)",
"#odata.count": 1,
"value": [
{
"#search.score": 0.2876821,
"Id": "1",
"Ordcode": "AEDE190EACWWG4VGLDE02000UHKPT"
}
]
}
I also tried to reproduce via the Search Explorer in the Azure Portal, even with simple mode and any (the default).
search=AEDE190EACWWG4VGLDE02000UHKPT&$count=true&$select=Id,Ordcode
There is a limit on the tokens produced (depending on the analyzer you use), but it's not 20 unless you have defined a shorter max token length.
I've written up a quick proof of concept console app to test out the functionality of the AzureSpell Cognitive Services product, however it doesn't seem to often detect obvious spelling mistakes.
Having experimented with recommendations through other SO answers, I've had limited success.
Even using the demo located at https://azure.microsoft.com/en-us/services/cognitive-services/spell-check/ produces no results.
For example, consider the following piece of text: "Currently growing my compny which is a UK based Online compny with clients across the world. Working since 2001 to help indivduals."
This produces no results. I've looked at regional settings, PROOF vs SPELL, character counts to no avail.
Has anyone had any success with this service, or, even better, does the above text snippet produce results for you?
Spell mode is working for me with your sample, see below:
The JSON result is:
{
"_type": "SpellCheck",
"flaggedTokens": [
{
"offset": 21,
"token": "compny",
"type": "UnknownToken",
"suggestions": [
{
"suggestion": "company",
"score": 0.9264452620075305
}
]
},
{
"offset": 55,
"token": "compny",
"type": "UnknownToken",
"suggestions": [
{
"suggestion": "company",
"score": 0.8740149238635179
}
]
},
{
"offset": 120,
"token": "indivduals",
"type": "UnknownToken",
"suggestions": [
{
"suggestion": "individuals",
"score": 0.753968656686115
}
]
}
]
}
Ok, so after a fair amount of trial I've had some success, which has solved some issues and created others. I've not been able to get a reliable result from Spell mode, but I have with Proof, however after adding a fairly short piece of text, it would again not report any results. Inspecting the API shows the text is encoded in the POST, removing both "%0D" and "%0A", line feed chars allows me to Proof long texts with success, which would be fine, however being UK based, lots of correct spellings are now flagged as incorrect as the PROOF mode is only available in the US. So, I've still been unable to solve getting a functioning SPELL result (which works for very short pieces of text). I understand the documentation states upto 130 chars for GET, but 10,000 chars for POST and my typical example POSTS are around 1,000 chars. Possibly a ticket with MS unless anyone has any ideas?
I am creating a synonym map like below,
{ "name": "country-synonym",
"format":"solr",
"synonyms": "germany, dl, deutschland\n
india, ind"
}
But when I queried the synonym to view it, it was created like below, instead of two rules, only one rule was created.
{
"#odata.context": "https://#############.search.windows.net/$metadata#synonymmaps/$entity",
"#odata.etag": "###########",
"name": "country-synonym",
"format": "solr",
"synonyms": "germany, dl, deutschland india, ind",
"encryptionKey": null
}
What am I doing wrong?
You answered it correctly in your comment. The search is working correctly, meaning the search terms were posted to the API correctly. The problem is the browser collapsing the newline. Try to look at the raw response in the Inspector & you should see the newline.
I changed the behavior of NumLock to perform as Insert with the following line added to my layout file ('br', could be 'us' etc.):
key <NMLK> { [ Insert, Insert, Insert, Insert ] };
However, with this change, the Super key (aka Win key) stopped working.
Other functionalities like the change-brightness keys also stopped working.
This is not the first time I see such kind of interference between unrelated keys.
Is there a reason for it to happen?
Using replace solved the problem:
replace key <NMLK> { [ Insert ] };
I've been playing with Alexa skills and looking to do some basic home automation. I have defined the following basic intent schema to start:
{
"intents": [
{
"intent": "Lock",
"slots": [
{
"name" : "Door",
"type" : "AMAZON.LITERAL"
}
]
},
{
"intent": "Unlock",
"slots": [
{
"name" : "Door",
"type" : "AMAZON.LITERAL"
}
]
}
]
}
And then the sample utterances:
Lock lock {slot value|Door}
Lock lock door {slot value|Door}
Lock lock the door {slot value|Door}
Unlock unlock {slot value|Door}
Unlock unlock door {slot value|Door}
Unlock unlock the door {slot value|Door}
The idea being that the door names would have to be freeform, since they won't be known ahead of time. However, when i try out a phrase like:
lock door front
It finds the right intent, but the "Door" slot value contains extra words:
"intent": {
"name": "Lock",
"slots": {
"Door": {
"name": "Door",
"value": "door front"
}
}
}
Is this normal, or is it a byproduct of using an AMAZON.LITERAL? I've also tried a custom slot type, but multiple word device names don't seem to work well with it, and it always uses the last word in that case.
I would define utterances as ending with 'door' word:
Lock lock {slot value|Door} door
So, user will have to say:
Alexa, ask Lock lock kitchen door
So you would mostlikely receive only one word as a door type. Then you parse the string. You might want to test not for exact equality, but for inclusion.
I have to admit that I never use LITERAL type, as it is not advised by Amazon tutorials, so I would define a custom type and list possible values for door type.
Turning on/off lights/thermostats is a different story. You have to use Alexa SmartHome API for that. Then 'turn on/off', 'set value', etc become reserved key words for Alexa. There will be no intents like these (in your question) in SmartHome API, no utterances and no custom slot types. All you need is to implement processing Discovery request and Control request. I think user sets device names in official apps/accounts of device vendor, and when Alexa discovers device (due to Discovery request), the skill just fetches the devices descriptions from vendors server and provides it for Alexa. That is how Alexa will know the names of available devices.
Alexa stops with the first match it finds. So you need to move the more general utterances after the more specific.
Lock lock door {slot value|Door}
Lock lock {slot value|Door}
This way "lock door front" matches with slot = "front".
If you have any utterances with no slots, be sure to put them LAST.
Update: The comment I made about LITERAL going away is dated. Thanks for pointing it out. LITERAL will remain. But Alexa (and Lex) do return slot values not in the slot list. I see this often. It's nice.
For those that may stumble across this question, know that skills using AMAZON.LITERAL will no longer be approved starting in December, 2016. You should use custom slots instead. Interesting, the documentation says that even when using custom slots you can receive words not defined in the custom list, like with a literal. I've not tested for this, but it could come in handy.