ncmpcpp key bindings - where do these decimal values come from?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
ncmpcpp key bindings - where do these decimal values come from?
In ncmpcpp's "keys" config file, it says "keys can be defined with a character or a decimal value", and the defaults of some of these decimal values seem to be listed(and available to be altered) in the same file, like so:
At least one key though (backspace), doesn't seem to be expressly defined, but it is still bound using a decimal value (it's either 263 or 127, going by ncmpcpp's Help page and the "key_go_to_parent_dir" bind) in the keys file.
Where do these values come from? They don't correspond to anything reported in xev. Is there a list of these values somewhere I can consult to find out the decimal value for the Pause/Break key? Or is there a way I can define a value for the Pause/Break key myself?
I know I should just resign myself to using the "p" key, but I use my LIRC remote more often than not and when I use the keyboard I keep forgetting I've added the lowercase p as a secondary bind so I don't have to press Shift+P, and then I go and open up the keys file and go "oh yeah I did that already 3 months ago" and then I go off on a configuration tangent trying to figure out where these decimal values come from so I can just set the damn Pause key to the pause function but I never get any closer to a solution so here I am hoping someone else knows the answer.
as far as I know the xmodmap utility is used to modify keybindings. You should read the manpage for xmodmap and find out, if there's the information you're looking for.
Another point is: ncurses (where ncmpcpp belongs to) isn't a librarie for the X-window-system but runs in the terminal. So I think that tools like xmodmap or xev don't have anything to do with this library. You should check the settings for your terminal, these maybe different if your running X-window or not.
Thanks for the reply markush. At first I just dismissed using xbindkeys out of hand because I figured it would mean binding the pause key to another key on my keyboard, and because what I thought I really wanted was to have the pause key only do something when I was on the virtual desktop I have reserved for ncmpcpp.
Your point about xev sent me on a new tangent of trying to discover key values though, and quite quickly I thought I'd come across the answer, which was that the pause key had a value of "119" (which can been seen with the "dumpkeys" command). Unfortunately sticking that in ncmpcpp's keys config file still didn't make the Pause/Break do anything in ncmpcpp. Then I spent some time trying to get what "showkey -s" showed for the pause key into the "setkeycodes" command, but to no avail probably due to the fact that Pause/Break is a special key and throws up a different type of scancode than every other key. I supose that's why it's apparently not bindable in ncmpcpp in the first place.
However! In trying to figure out how to use setkeycodes for the pause key, I came across a page describing how xbindkeys will show you the codes it uses for special keys, using the "xbindkeys -k" command, and that particular example was using the "mpc toggle" command which also happens to be the exact command I bind to my LIRC remote for doing pause/unpause in ncmpcpp/mpd. And then it finally dawned on me that I should just use xbindkeys to bind the Pause/Break key to that mpc command instead of trying to bother with ncmpcpp's binds at all. And I suppose this way is even a little bit better because I can now toggle ncmpcpp's pause state without even having ncmpcpp's window/terminal/desktop focused, which when I think about is probably what I should have been trying to achieve in the first place anyway. D'oh!
Thanks again markush, now I just wait and see if I don't soon come across some obscure function I can no longer make use of when my Pause is bound this way....
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.