Re: [dev] surf - add missing keybinding
On Mon, Oct 19, 2009 at 05:45:01PM +0200, Uriel wrote: Very neat. Is it Ok if I post this to http://ninetimes.cat-v.org/tips/ ? Sure, you can do whatever you want with it. I'll get around to posting it to 9fans one of these days if I can stand the noise. I'll admit that the flamboyant trolling, sycophantism, and teetotaling on this list make 9fans seem somewhat more bearable. -- Kris Maglione You're bound to be unhappy if you optimize everything. --Donald Knuth
Re: [dev] surf - add missing keybinding
Very neat. Is it Ok if I post this to http://ninetimes.cat-v.org/tips/ ? Thanks! uriel On Sun, Oct 18, 2009 at 11:09 PM, Kris Maglione wrote: > On Sun, Oct 18, 2009 at 05:39:30PM +0200, Uriel wrote: >> >> On Sun, Oct 18, 2009 at 3:58 AM, Kris Maglione >> wrote: >>> >>> But, I notice you don't have my nifty hack to make Xorg's compose >>> behavior >>> the same as Plan 9's, so I still come out ahead. :) >> >> Ah, please tell me what is the hack! I'd love to add it to the page :) > > Ok, but it's long-ish and ugly. And it uses python. I tried to do it in awk, > but it can't convert between characters and char codes. You could just > attach the result, but it's 95K compressed, 650K otherwise. The upside, > though, is that debian people will be able to run it without installing > x11proto-core-dev. It would probably be easier to provide both. > > First, we need to set Alt_R to the compose key. We could alter the last step > and skip this one, but this is the "correct" way to do it: > > xmodmap -e 'keysym Alt_R = Multi_key' > > Then we need to set some environment variables so GTK and QT apps take note > of our changes: > > GTK_IM_MODULE=xim > QT_IM_MODULE=xim > > Finally, we need to setup $home/.XCompose and restart any running apps: > > python >$HOME/.XCompose < import io > import os > import re > > KEYSYMDEF = "/usr/include/X11/keysymdef.h" > KEYBOARD = "%s/lib/keyboard" % os.environ['PLAN9'] UNICODE = > "%s/lib/unicode" % os.environ['PLAN9'] COMPOSE = > "/usr/share/X11/locale/en_US.UTF-8/Compose" > > KEYSYMS = {} > > f = io.open(KEYSYMDEF, "r") > for line in f: > match = re.search(r'XK_(\S+).*0x+([0-9a-fA-F]+)', line) > if match: > KEYSYMS[int(match.group(2), 16)] = match.group(1) > > def write(seq, char, desc): > print (u' %- 30s : "%s" U%04X # %s' % ( > ' '.join('<%s>' % KEYSYMS.get(ord(c), c) for c in seq), > char, ord(char), desc.upper())).encode('UTF-8') > > print 'include "%s"\n' % COMPOSE > for line in io.open(KEYBOARD, "r"): > for seq in line[6:18].split(): > write(seq, line[18], line[20:-1]) > print '' > for line in io.open(UNICODE): > codepoint, desc = line.rstrip().split('\t', 2) > write('X' + codepoint, unichr(int(codepoint, 16)), desc) > ! > > This gets us everything in /lib/keyboard, as well as Alt X style > mappings. If you want to skip the xmodmap step, just change Multi_key above > to Alt_R, but in that case, standard X11 compose sequences won't work as > expected. > > -- > Kris Maglione > > Religion began when the first scoundrel met the first fool. > --Voltaire > > >
Re: [dev] surf - add missing keybinding
On Sun, Oct 18, 2009 at 05:39:30PM +0200, Uriel wrote: On Sun, Oct 18, 2009 at 3:58 AM, Kris Maglione wrote: But, I notice you don't have my nifty hack to make Xorg's compose behavior the same as Plan 9's, so I still come out ahead. :) Ah, please tell me what is the hack! I'd love to add it to the page :) Ok, but it's long-ish and ugly. And it uses python. I tried to do it in awk, but it can't convert between characters and char codes. You could just attach the result, but it's 95K compressed, 650K otherwise. The upside, though, is that debian people will be able to run it without installing x11proto-core-dev. It would probably be easier to provide both. First, we need to set Alt_R to the compose key. We could alter the last step and skip this one, but this is the "correct" way to do it: xmodmap -e 'keysym Alt_R = Multi_key' Then we need to set some environment variables so GTK and QT apps take note of our changes: GTK_IM_MODULE=xim QT_IM_MODULE=xim Finally, we need to setup $home/.XCompose and restart any running apps: python >$HOME/.XCompose' % KEYSYMS.get(ord(c), c) for c in seq), char, ord(char), desc.upper())).encode('UTF-8') print 'include "%s"\n' % COMPOSE for line in io.open(KEYBOARD, "r"): for seq in line[6:18].split(): write(seq, line[18], line[20:-1]) print '' for line in io.open(UNICODE): codepoint, desc = line.rstrip().split('\t', 2) write('X' + codepoint, unichr(int(codepoint, 16)), desc) ! This gets us everything in /lib/keyboard, as well as Alt X style mappings. If you want to skip the xmodmap step, just change Multi_key above to Alt_R, but in that case, standard X11 compose sequences won't work as expected. -- Kris Maglione Religion began when the first scoundrel met the first fool. --Voltaire
Re: [dev] surf - add missing keybinding
On Sun, Oct 18, 2009 at 3:58 AM, Kris Maglione wrote: > On Sun, Oct 18, 2009 at 03:08:22AM +0200, Uriel wrote: >> >> Hmmm... Just curious, but what exactly is possible now? I checked the >> attached file, but the relevant lines seemed to be the same that I had >> in: http://unix-kb.cat-v.org/GTK_2/ >> >> Is there anything else I'm missing? (I don't currently use any gtk >> apps, but would like to know how to properly fix this in case in the >> future I have the misfortune of being forced to use any such app.) > > I actually just noticed your page after I posted that, when I went back and > read the rest of the thread. That key binding didn't use to be possible the > last time I tried it (two to three years ago, when the proper ^W key binding > didn't work either). > > But, I notice you don't have my nifty hack to make Xorg's compose behavior > the same as Plan 9's, so I still come out ahead. :) Ah, please tell me what is the hack! I'd love to add it to the page :) Thanks uriel > -- > Kris Maglione > > If the code and the comments disagree, then both are probably wrong. > --attributed to Norm Schryer > > >
Re: [dev] surf - add missing keybinding
On Sun, Oct 18, 2009 at 03:08:22AM +0200, Uriel wrote: Hmmm... Just curious, but what exactly is possible now? I checked the attached file, but the relevant lines seemed to be the same that I had in: http://unix-kb.cat-v.org/GTK_2/ Is there anything else I'm missing? (I don't currently use any gtk apps, but would like to know how to properly fix this in case in the future I have the misfortune of being forced to use any such app.) I actually just noticed your page after I posted that, when I went back and read the rest of the thread. That key binding didn't use to be possible the last time I tried it (two to three years ago, when the proper ^W key binding didn't work either). But, I notice you don't have my nifty hack to make Xorg's compose behavior the same as Plan 9's, so I still come out ahead. :) -- Kris Maglione If the code and the comments disagree, then both are probably wrong. --attributed to Norm Schryer
Re: [dev] surf - add missing keybinding
On Sun, Oct 18, 2009 at 2:02 AM, Kris Maglione wrote: > On Sat, Oct 17, 2009 at 01:39:00PM +0200, Tadeusz Sośnierz wrote: >> >> Add the following to your .gtkrc-2.0: >> gtk-key-theme-name = "Emacs" > > Nevermind. It's possible now. See attached. Hmmm... Just curious, but what exactly is possible now? I checked the attached file, but the relevant lines seemed to be the same that I had in: http://unix-kb.cat-v.org/GTK_2/ Is there anything else I'm missing? (I don't currently use any gtk apps, but would like to know how to properly fix this in case in the future I have the misfortune of being forced to use any such app.) Thanks uriel > > -- > Kris Maglione > > Never attribute to malice that which is adequately explained by > stupidity. > --Hanlon's razor > >
Re: [dev] surf - add missing keybinding
On 17-10-2009 19:56:40, Kris Maglione wrote: > On Sat, Oct 17, 2009 at 01:39:00PM +0200, Tadeusz Sośnierz wrote: > >>> Btw, does surf support the standard Unix text editing keybindings[1]? > >> > >>Its not about surf, this is a task for gtk textentry and so on. So unless > >>you write a ld.so modifying the signal handlers it will not be supported. > >> > >>It can be also be implemented in javascript, but it will be pretty slow. > > > >Add the following to your .gtkrc-2.0: > >gtk-key-theme-name = "Emacs" > >Should work well. > > It works. It doesn't work well. I have to admit, it's gotten better: > at least ^W finally deletes to the last non-word character rather > than to the last space. ^U still clears the whole line, and as far > as I can find, there's no way to configure it to do otherwise. > Well, It probably isn't ideal, but this is the best thing I know of, that's why I posted it. I don't care whether it's called emacs, vi or acme, as long as it works and does what I want. And it's not emacs, for ^W and ^U works as Kris said, not this emacs region stuff. Regards, Ted
Re: [dev] surf - add missing keybinding
On Sat, Oct 17, 2009 at 01:39:00PM +0200, Tadeusz Sośnierz wrote: Add the following to your .gtkrc-2.0: gtk-key-theme-name = "Emacs" Nevermind. It's possible now. See attached. -- Kris Maglione Never attribute to malice that which is adequately explained by stupidity. --Hanlon's razor # GTK - The GIMP Toolkit # Copyright (C) 2002 Owen Taylor # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # Modified by the GTK+ Team and others 1997-2000. See the AUTHORS # file for a list of people on the GTK+ Team. See the ChangeLog # files for a list of changes. These files are distributed with # GTK+ at ftp://ftp.gtk.org/pub/gtk/. # # A keybinding set implementing emacs-like keybindings # # # Bindings for GtkTextView and GtkEntry # binding "gtk-emacs-text-entry" { bind "b" { "move-cursor" (logical-positions, -1, 0) } bind "b" { "move-cursor" (logical-positions, -1, 1) } bind "f" { "move-cursor" (logical-positions, 1, 0) } bind "f" { "move-cursor" (logical-positions, 1, 1) } bind "b" { "move-cursor" (words, -1, 0) } bind "b" { "move-cursor" (words, -1, 1) } bind "f" { "move-cursor" (words, 1, 0) } bind "f" { "move-cursor" (words, 1, 1) } bind "a" { "move-cursor" (paragraph-ends, -1, 0) } bind "a" { "move-cursor" (paragraph-ends, -1, 1) } bind "e" { "move-cursor" (paragraph-ends, 1, 0) } bind "e" { "move-cursor" (paragraph-ends, 1, 1) } bind "w" { "cut-clipboard" () } bind "y" { "paste-clipboard" () } bind "d" { "delete-from-cursor" (chars, 1) } bind "d" { "delete-from-cursor" (word-ends, 1) } bind "k" { "delete-from-cursor" (paragraph-ends, 1) } bind "backslash" { "delete-from-cursor" (whitespace, 1) } bind "space" { "delete-from-cursor" (whitespace, 1) "insert-at-cursor" (" ") } bind "KP_Space" { "delete-from-cursor" (whitespace, 1) "insert-at-cursor" (" ") } # # Some non-Emacs keybindings people are attached to # bind "u" { "delete-from-cursor" (paragraph-ends, -1) } bind "h" { "delete-from-cursor" (chars, -1) } bind "w" { "delete-from-cursor" (word-ends, -1) } } # # Bindings for GtkTextView # binding "gtk-emacs-text-view" { bind "p" { "move-cursor" (display-lines, -1, 0) } bind "p" { "move-cursor" (display-lines, -1, 1) } bind "n" { "move-cursor" (display-lines, 1, 0) } bind "n" { "move-cursor" (display-lines, 1, 1) } bind "space" { "set-anchor" () } bind "KP_Space" { "set-anchor" () } } # # Bindings for GtkTreeView # binding "gtk-emacs-tree-view" { bind "s" { "start-interactive-search" () } bind "f" { "move-cursor" (logical-positions, 1) } bind "b" { "move-cursor" (logical-positions, -1) } } # # Bindings for menus # binding "gtk-emacs-menu" { bind "n" { "move-current" (next) } bind "p" { "move-current" (prev) } bind "f" { "move-current" (child) } bind "b" { "move-current" (parent) } } class "GtkEntry" binding "gtk-emacs-text-entry" class "GtkTextView" binding "gtk-emacs-text-entry" class "GtkTextView" binding "gtk-emacs-text-view" class "GtkTreeView" binding "gtk-emacs-tree-view" class "GtkMenuShell" binding "gtk-emacs-menu"
Re: [dev] surf - add missing keybinding
On Sat, Oct 17, 2009 at 01:39:00PM +0200, Tadeusz Sośnierz wrote: > Btw, does surf support the standard Unix text editing keybindings[1]? Its not about surf, this is a task for gtk textentry and so on. So unless you write a ld.so modifying the signal handlers it will not be supported. It can be also be implemented in javascript, but it will be pretty slow. Add the following to your .gtkrc-2.0: gtk-key-theme-name = "Emacs" Should work well. It works. It doesn't work well. I have to admit, it's gotten better: at least ^W finally deletes to the last non-word character rather than to the last space. ^U still clears the whole line, and as far as I can find, there's no way to configure it to do otherwise. -- Kris Maglione I cannot agree with those who rank modesty among the virtues. To the logician all things should be seen exactly as they are, and to underestimate one's self is as much a departure from truth as to exaggerate one's own powers. --"Sherlock Holmes"
Re: [dev] surf - add missing keybinding
I told them, they banned me from their irc server. They are beyond all hope. uriel On Sat, Oct 17, 2009 at 9:37 PM, Moritz Wilhelmy wrote: > I think you should tell the GTK-people about this, not us. > > Regards > > On Sat, Oct 17, 2009 at 07:22:32PM +0200, Uriel wrote: >> How many fucking times I have to explain that: Unix shortcuts are >> *NOT* Emacs shortcuts? God fucking heavens. >> >> uriel >> >> 2009/10/17 Tadeusz Sośnierz : >> >> > Btw, does surf support the standard Unix text editing keybindings[1]? >> >> >> >> Its not about surf, this is a task for gtk textentry and so on. So unless >> >> you write a ld.so modifying the signal handlers it will not be supported. >> >> >> >> It can be also be implemented in javascript, but it will be pretty slow. >> > Add the following to your .gtkrc-2.0: >> > gtk-key-theme-name = "Emacs" >> > Should work well. >> > Regards, >> > Ted >> > >> > -- >> > === >> > () ascii ribbon campaign - against html e-mail >> > /\ www.asciiribbon.org - against proprietary attachments >> > >> > >> > >> > >
Re: [dev] surf - add missing keybinding
I think you should tell the GTK-people about this, not us. Regards On Sat, Oct 17, 2009 at 07:22:32PM +0200, Uriel wrote: > How many fucking times I have to explain that: Unix shortcuts are > *NOT* Emacs shortcuts? God fucking heavens. > > uriel > > 2009/10/17 Tadeusz Sośnierz : > >> > Btw, does surf support the standard Unix text editing keybindings[1]? > >> > >> Its not about surf, this is a task for gtk textentry and so on. So unless > >> you write a ld.so modifying the signal handlers it will not be supported. > >> > >> It can be also be implemented in javascript, but it will be pretty slow. > > Add the following to your .gtkrc-2.0: > > gtk-key-theme-name = "Emacs" > > Should work well. > > Regards, > > Ted > > > > -- > > === > > () ascii ribbon campaign - against html e-mail > > /\ www.asciiribbon.org - against proprietary attachments > > > > > > >
Re: [dev] surf - add missing keybinding
On Thu, Sep 17, 2009 at 3:22 PM, pancake wrote: > Im sure that i can type faster than you in us or es kbd. The problem here is > that the retarded X11 is taking the slash as a single key, making the > modifier a separated key instead of taking t as a single keysim. why don't you just set the keybinding to ctrl-shift-7 then and stop whining about how x.org interprets keys based on the most common keyboard layout in the world -- # Kurt H Maier
Re: [dev] surf - add missing keybinding
On Thu, Sep 17, 2009 at 10:22 PM, pancake wrote: > > - Mensaje original - > >> On Fri, Oct 16, 2009 at 7:57 PM, pancake wrote: >> > I would like to have a dupped keybinding for the showsearch. >> > >> > ... >> > 14 { MODKEY, GDK_g, showuri, { 0 }, >> > Any >> > }, >> > 15 { MODKEY, GDK_slash, showsearch, { 0 }, >> > Any >> > }, >> > 16 { MODKEY|GDK_SHIFT_MASK,GDK_slash, showsearch, { 0 }, >> > Any >> > }, // ADD THIS INTO config.def.h >> > 17 { 0, GDK_Escape, hidesearch, { 0 }, >> > Any >> > }, >> > ... >> > >> > The problem is that in the spanish keyboard you have to press shift to >> > get >> > the slash >> > character (it's like an uppercase 7 (seven)). >> >> Then don't use a totally retarded and braindead keyboard layouts like >> the Spanish one. Textbook case of 'if it hurts it is because you are >> doing something dumb'. > > Yeah, i know that the retarded word is quite funny when you are not of them, > but it is not quite adequate for this case. > > All the keyboards suck in some or other way. > > Im sure that i can type faster than you in us or es kbd. The problem here is > that the retarded X11 is taking the slash as a single key, making the > modifier a separated key instead of taking t as a single keysim. > > Keyboard layouts and keymaps sucks. They fail by design and they are > stupidly complicated. I hope you never had to look to a windows mobile > keyboard driver. > >> When I remember the pain to get a fucking ~ I still have nightmares >> and can't understand how I managed so long without switching to the >> standard US kb layout (and that was over ten years ago). > > Maybe you are the retarded one. Because i never had any problem to type any > char in the sp layout. Do you know that it is possisble to create your own > layout modifications? I might be retarded, but I don't waste my life 'customizing' my fucking keyboard layout, I use the *standard* layout that works well for the task it is designed for: input text and code. Asking for apps to be changed because you use a braindead keyboard layout is just crazy. uriel >> Btw, does surf support the standard Unix text editing keybindings[1]? > > Its not about surf, this is a task for gtk textentry and so on. So unless > you write a ld.so modifying the signal handlers it will not be supported. That surf uses gtk is a disgrace, to depend on GTK providing sane keybindings is a really bad idea. > It can be also be implemented in javascript, but it will be pretty slow. I did it for Chrome already: http://repo.cat-v.org/burning_chrome/hosaka/ it is fast, but obviously still sucks, because the right solution is for the app to implement the proper and sane shortcuts. uriel >> >> uriel >> >> [1]: http://unix-kb.cat-v.org/ >> >> >> > >> > Thanks :) >> > >> > --pancake >> > >> > >> > >
Re: [dev] surf - add missing keybinding
How many fucking times I have to explain that: Unix shortcuts are *NOT* Emacs shortcuts? God fucking heavens. uriel 2009/10/17 Tadeusz Sośnierz : >> > Btw, does surf support the standard Unix text editing keybindings[1]? >> >> Its not about surf, this is a task for gtk textentry and so on. So unless >> you write a ld.so modifying the signal handlers it will not be supported. >> >> It can be also be implemented in javascript, but it will be pretty slow. > Add the following to your .gtkrc-2.0: > gtk-key-theme-name = "Emacs" > Should work well. > Regards, > Ted > > -- > === > () ascii ribbon campaign - against html e-mail > /\ www.asciiribbon.org - against proprietary attachments > > >
Re: [dev] surf - add missing keybinding
> > Btw, does surf support the standard Unix text editing keybindings[1]? > > Its not about surf, this is a task for gtk textentry and so on. So unless you > write a ld.so modifying the signal handlers it will not be supported. > > It can be also be implemented in javascript, but it will be pretty slow. Add the following to your .gtkrc-2.0: gtk-key-theme-name = "Emacs" Should work well. Regards, Ted -- === () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments
Re: [dev] surf - add missing keybinding
- Mensaje original - > On Fri, Oct 16, 2009 at 7:57 PM, pancake wrote: > > I would like to have a dupped keybinding for the showsearch. > > > > ... > > 14 { MODKEY, GDK_g, showuri, { 0 }, Any > > }, > > 15 { MODKEY, GDK_slash, showsearch, { 0 }, Any > > }, > > 16 { MODKEY|GDK_SHIFT_MASK,GDK_slash, showsearch, { 0 }, Any > > }, // ADD THIS INTO config.def.h > > 17 { 0, GDK_Escape, hidesearch, { 0 }, Any > > }, > > ... > > > > The problem is that in the spanish keyboard you have to press shift to get > > the slash > > character (it's like an uppercase 7 (seven)). > > Then don't use a totally retarded and braindead keyboard layouts like > the Spanish one. Textbook case of 'if it hurts it is because you are > doing something dumb'. Yeah, i know that the retarded word is quite funny when you are not of them, but it is not quite adequate for this case. All the keyboards suck in some or other way. Im sure that i can type faster than you in us or es kbd. The problem here is that the retarded X11 is taking the slash as a single key, making the modifier a separated key instead of taking t as a single keysim. Keyboard layouts and keymaps sucks. They fail by design and they are stupidly complicated. I hope you never had to look to a windows mobile keyboard driver. > When I remember the pain to get a fucking ~ I still have nightmares > and can't understand how I managed so long without switching to the > standard US kb layout (and that was over ten years ago). Maybe you are the retarded one. Because i never had any problem to type any char in the sp layout. Do you know that it is possisble to create your own layout modifications? > Btw, does surf support the standard Unix text editing keybindings[1]? Its not about surf, this is a task for gtk textentry and so on. So unless you write a ld.so modifying the signal handlers it will not be supported. It can be also be implemented in javascript, but it will be pretty slow. > > uriel > > [1]: http://unix-kb.cat-v.org/ > > > > > > Thanks :) > > > > --pancake > > > > >
Re: [dev] surf - add missing keybinding
On Fri, Oct 16, 2009 at 7:57 PM, pancake wrote: > I would like to have a dupped keybinding for the showsearch. > > ... > 14 { MODKEY, GDK_g, showuri, { 0 }, Any > }, > 15 { MODKEY, GDK_slash, showsearch, { 0 }, Any > }, > 16 { MODKEY|GDK_SHIFT_MASK,GDK_slash, showsearch, { 0 }, Any > }, // ADD THIS INTO config.def.h > 17 { 0, GDK_Escape, hidesearch, { 0 }, Any > }, > ... > > The problem is that in the spanish keyboard you have to press shift to get > the slash > character (it's like an uppercase 7 (seven)). Then don't use a totally retarded and braindead keyboard layouts like the Spanish one. Textbook case of 'if it hurts it is because you are doing something dumb'. When I remember the pain to get a fucking ~ I still have nightmares and can't understand how I managed so long without switching to the standard US kb layout (and that was over ten years ago). Btw, does surf support the standard Unix text editing keybindings[1]? uriel [1]: http://unix-kb.cat-v.org/ > > Thanks :) > > --pancake > >
[dev] surf - add missing keybinding
I would like to have a dupped keybinding for the showsearch. ... 14 { MODKEY, GDK_g, showuri,{ 0 }, Any }, 15 { MODKEY, GDK_slash, showsearch, { 0 }, Any }, 16 { MODKEY|GDK_SHIFT_MASK,GDK_slash, showsearch, { 0 }, Any }, // ADD THIS INTO config.def.h 17 { 0,GDK_Escape, hidesearch, { 0 }, Any }, ... The problem is that in the spanish keyboard you have to press shift to get the slash character (it's like an uppercase 7 (seven)). Thanks :) --pancake