Bind a single key in xmonad without using a ModMask - xmonad

I would like to bind single key presses to certain actions in my xmonad.hs.
I'm setting up a security system and will have each workspace on xmonad running a camera view. I want to bind single keys, such as left or right, to the switching of the workspaces instead of requiring to also press a modmask along with the key.
Is this possible?

Found my answer,
Put a zero in place of the modkey:
Instead of this:
((modm ,xK_a), prevWS)
This:
((0 ,xK_a), prevWS)

Related

Keyboard shortcut to show/hide tabs in ST3 Win10

I was reviewing several pages but I can not make Sublime Text 3 have a hot key where you can show and hide the Tabs quickly, read this link where it talks about it but it seems that there is no such combination, someone who could do it ?
Pd: I do not want to do it from the menu, i want is by keyhots
In order to bind a key to this, you need to know what command to use in the key binding. The easiest way to determine that would be to select View > Show Console from the menu to open the console, then enter sublime.log_commands(True) to turn on command logging, and execute the command that you want to bind.
In this case, that would be View > Hide Tabs (or View > Show Tabs, depending on if they're visible or not), which allows us to see this in the console:
>>> sublime.log_commands(True)
command: toggle_tabs
Armed with the command, you can select Preferences > Key Bindings and add your own key binding in the right hand pane, such as this one:
{
"keys": ["ctrl+alt+t"],
"command": "toggle_tabs"
},
Naturally you can choose any key binding that you'd like here. Once you do this, the menu command and the command palette entries for toggling the tab state will show the key you selected next to them to remind you.
Note that if this is your first custom key binding, you want to make sure that you add the binding inside of the [ and ] characters that will appear in the file. If you have other bindings, make sure that you separate each binding with a , character.

Xmonad extension to cycle recent windows

I find it a bit awkward in xmonad to switch back and forth between two windows. Is there an extension (or a part of core xmonad) which allows this?
For example, I want to switch between firefox and emacs often, and they might not be in the same workspace. I currently do this using gotoMenu by typing M-g firefox<cr> and M-g emacs<cr> but this is awkward, especially if there's more than one instance of either app. Ideally I'd like a single shortcut to perform an action like give-focus-to-most-recently-used-unfocussed-window, which I could just press over and over to switch back and forth.
XMonad.Actions.GroupNavigation seems to be a perfect fit. To let the module track your window history, make sure that logHook invokes historyHook. For example:
import XMonad.Actions.GroupNavigation
...
main = xmonad $ defaultConfig {
...
, logHook = myLogHook xmobars >> historyHook
}
Then create a key binding for the following expression, which will toggle between the current and most recent window.
("M-x", nextMatch History (return True))

Disable Alt key in Raspbian entirely

I am looking to develop the raspberry pi into something that I would be able to run a free use public web terminal which would be locked to a certain domain. This is for my employer, a township, who wants to set up terminals around the township so that the less fortunate in our community will be able to contact and interact with the various services that the township provides without having to find a way to the Administration center.
I have been able to get most of what I want working, but I want to disable the Alt key on the keyboard. This will stop users from being able to Ctrl+Alt+Del or Alt+F4 out of the browser environment, and various other features of LXDE that smart users could use to break my kiosk (like virtual terminals). I thought that I had found the method to do this, with xmodmap, but when I ran this command
xmodmap -e "keycode 204 = "
Which to my knowledge should set all mappings for the right Alt key to nothing, still lets me Alt+F4 in chromium and other things.
I also attempted to edit my ~/.config/openbox/lxde-rc.xml and change the keyboard bindings in it. I was able to disable the Ctrl+Alt+Del through that, but when I change or erase other key bindings in there, nothing happens. So I'm trying to figure out other options I have to disable the Alt key on this application. Any ideas?
Soo, I actually just answered my own question. Fixing the problem indeed lies in the ~/.config/openbox/lxde-rc.xml file, but I was not doing it right. To set the Ctrl Alt Delete option, you need to change the value between <command></command> to false (or a program that pops up a finger wag to the user).
The problem was, only four or so of the keys entries have a <command> field to them, and all of the other use an <action="whatever"></action> field to define the action that is being performed by the key. I was changing the value of "whatever" to false and was under the impression that would have the same effect as changing the command field.
But really, what you need to do is change the value of "whatever" to "Execute", and then nest a set of <command></command> with a value set to false and it will set the key's mapping to false. I guess there must be a set of default values that are used to override improper changes to the lxde-rc.xml files, and that's why things kept working after removing the entries.

Lwuit on nokia. Setting a command to the game fire key

This may seem trivial, but i'm working on a project to be deployed exclusively on nokia phones, and all i want is to create a command and set it to the "GAME_FIRE" center key. For some reason, when adding lwuit commands, LWUIT skips the game fire key, and instead creates a defaut menu command that then shows the added commands. Please help.
As far as I understand, LWUIT never uses the center key to commands. It wont event let you have two menus,it will always use one soft key for the main (the first) command, and all the other commands will be on a menu in the other soft button
Use
Display.getInstance().setThirdSoftButton(true);
This will set the label on the fire key as well.

Shortcut with meta-shift key doesn't work in emacs

I can't use any shortcut that has meta-shift (alt and shift) in it because ubuntu will treat it as "change keyboard layout" shortcut (I map it to alt-shift since I use the same shortcut in windows) as soon as I press m-s. In windows change keyboard layout shortcut doesn't register until you release the key so any shortcut with m-s is usable in windows.
Is there any work-around without changing shortcut or meta key ? I kinda used to it.
Change the Ubuntu change-keyboard-layout shortcut, to something else.
Or use Esc as Meta
Nothing easy that I know of.
You can manually bind everything that's M-S-??? to C-M-S-??? in your .emacs or at least all of the ones that you use...
Or you can just change the short-cut... how often do you change the keyboard layout? (I use dvorak, and qwerty, but I've never needed a shortcut for it, I just use the button...)
I have tried different things, and in my opinion it is best to change the layout shortcut to something else. The power of emacs is all in its shortcuts that are available right there under your fingers. If you move the M key away and make it harder to reach, it will most surely have a negative impact on your editing speed.
Right now I'm trying to get used to switching layouts with the right Alt key. I almost never use it for anything, so missing it won't be a problem. And from my experience teaching yourself to switch layouts with another combination is a matter of several days.
P.S. Also it pays to use Caps-Lock as an additional Ctrl key, it helps tremendously!

Resources