Vim style keybindings in GTK apps and Openbox

Hello all
I've been using Openbox for a while now, I use Vim all the time for most of my work, and I've enabled Vimperator for Firefox as I found that once you know the Vim keybindings, it becomes much quicker to do things without a mouse.
Problem is, being so used to these keybindings I find that I'll unintentionally search for something starting with 'j' when I want to scroll down (i.e. with Thunar). Does anyone know of a method to enable a Vim mode for GTK+? I've almost set up a Vim mode with my Openbox rc.xml, but so far GTK has resisted my efforts to change it, which is a real shame because they provided an Emacs mode =/
cheers for anyone who can offer suggestions

It is not a perfect solution, but with a little xmodmapping you can set up a scheme that gives you hjkl (with a modifier) in almost any app (almost). It even gives you hjkl in insert mode in vim, which i find particularly handy.
Here is my xmodmap file which accomplishes this for my keyboard. Please don't use it directly as it may not be compatible with every keyboard. It is here as an example of a keyboard layout using Mode_switch. I have added some comments wher things may not be clear.
! file: ~/.xmodmap
! vim:enc=utf-8:nu:ai:si:et:ts=4:sw=4:ft=xmodmap:
! Modifiers
! clear the modifiers and locks
! remember to add them after all keysyms have been assigned
clear Shift
clear Control
clear Mod1
clear Mod2
clear Mod3
clear Mod4
clear Mod5
! Shift + Shift initiates ShiftLock mode, which allows
! for shifted behaviour on all keys.
! This can act as replacement for Caps_Lock.
! Toggle it off with one single shift keypress.
keycode 50 = Shift_L Shift_Lock
keycode 62 = Shift_R Shift_Lock
! standard Left Alt, except I prefer meta over alt
keycode 64 = Meta_L Alt_L
! "Menu" key, shifts us into the next group permanenty (toggle)
! I actually don't use this myself, but left it here for future study.
! keycode 135 = ISO_Next_Group ISO_Prev_Group
keycode 135 = Super_R
! AltGr is Multi_key for those fancy compose chars
! have a look at .Xcompose for more info
keycode 108 = Multi_key Meta_R
! standard Control and Super keys
keycode 37 = Control_L
keycode 105 = Control_R
keycode 133 = Super_L
! Caps_Lock is Mode_switch. Mode_switch sends keys from
! one group above the current (shifted and unshifted).
keycode 66 = Mode_switch
! Only use two groups, to keeps switching sane.
! You can add several groups, but I have not tried with more than 4
! |--- Group 1 ---| |--- Group 2 ---|
! Special Keys
keycode 9 = Escape
keycode 23 = Tab ISO_Left_Tab
keycode 22 = BackSpace Terminate_Server
keycode 36 = Return
keycode 65 = space
! Num Keys
keycode 49 = grave asciitilde
keycode 10 = 1 exclam
keycode 11 = 2 at
keycode 12 = 3 numbersign
keycode 13 = 4 dollar
keycode 14 = 5 percent
keycode 15 = 6 asciicircum
keycode 16 = 7 ampersand
keycode 17 = 8 asterisk
keycode 18 = 9 parenleft
keycode 19 = 0 parenright
keycode 20 = minus underscore
keycode 21 = equal plus
! Upper Row
keycode 24 = q Q
keycode 25 = w W
keycode 26 = e E
keycode 27 = r R
keycode 28 = t T
keycode 29 = y Y
keycode 30 = u U Prior
keycode 31 = i I Home
keycode 32 = o O End
keycode 33 = p P
keycode 34 = bracketleft braceleft Escape
keycode 35 = bracketright braceright
! Home Row
keycode 38 = a A
keycode 39 = s S
keycode 40 = d D Delete
keycode 41 = f F
keycode 42 = g G
keycode 43 = h H Left
keycode 44 = j J Down
keycode 45 = k K Up
keycode 46 = l L Right
keycode 47 = semicolon colon
keycode 48 = apostrophe quotedbl
keycode 51 = backslash bar
! Lower Row
keycode 94 = less greater
keycode 52 = z Z
keycode 53 = x X
keycode 54 = c C
keycode 55 = v V
keycode 56 = b B BackSpace
keycode 57 = n N Next
keycode 58 = m M
keycode 59 = comma less
keycode 60 = period greater
keycode 61 = slash question
! F keys
keycode 67 = F1 XF86_Switch_VT_1
keycode 68 = F2 XF86_Switch_VT_2
keycode 69 = F3 XF86_Switch_VT_3
keycode 70 = F4 XF86_Switch_VT_4
keycode 71 = F5 XF86_Switch_VT_5
keycode 72 = F6 XF86_Switch_VT_6
keycode 73 = F7 XF86_Switch_VT_7
keycode 74 = F8 XF86_Switch_VT_8
keycode 75 = F9 XF86_Switch_VT_9
keycode 76 = F10 XF86_Switch_VT_10
keycode 95 = F11 XF86_Switch_VT_11
keycode 96 = F12 XF86_Switch_VT_12
! Fn F keys
keycode 77 = Num_Lock Pointer_EnableKeys
keycode 78 = Scroll_Lock
! KP Keys / Fn keys
keycode 87 = KP_End KP_1
keycode 88 = KP_Down KP_2
keycode 89 = KP_Next KP_3
keycode 83 = KP_Left KP_4
keycode 84 = KP_Begin KP_5
keycode 85 = KP_Right KP_6
keycode 79 = KP_Home KP_7
keycode 80 = KP_Up KP_8
keycode 81 = KP_Prior KP_9
keycode 90 = KP_Insert KP_0
keycode 86 = KP_Add XF86_Next_VMode
keycode 82 = KP_Subtract XF86_Prev_VMode
keycode 91 = KP_Delete KP_Decimal
keycode 63 = KP_Multiply XF86_ClearGrab
keycode 106 = KP_Divide XF86_Ungrab
! Print, Pause, Insert, Delete
keycode 107 = Print Sys_Req
keycode 127 = Pause Break
keycode 118 = Insert
keycode 119 = Delete
! Home, PgUp, PgDown, End
keycode 110 = Home
keycode 112 = Prior
keycode 117 = Next
keycode 115 = End
! Fn+Home/PgUp/PgDown/End
keycode 172 = XF86AudioPlay
keycode 174 = XF86AudioStop
keycode 173 = XF86AudioPrev
keycode 171 = XF86AudioNext
! Cursors
keycode 113 = Left
keycode 111 = Up
keycode 114 = Right
keycode 116 = Down
! XF86 Keys
! Fn+F8
keycode 121 = XF86AudioMute
! Fn+F4
keycode 150 = XF86Sleep
! Builtin volume keys
keycode 122 = XF86AudioLowerVolume
keycode 123 = XF86AudioRaiseVolume
! Brightness controls on Fn key
keycode 232 = XF86MonBrightnessDown
keycode 233 = XF86MonBrightnessUp
! 126 is Brighness up, when it can go no futher
keycode 126 = NoSymbol
! Reassign Modifiers
add Shift = Shift_L Shift_R
add Control = Control_L Control_R
add Mod1 = Alt_L Meta_L
add Mod2 = Num_Lock
add Mod4 = Super_L Super_R
Let me know if there is something that is not clear
Last edited by alterecco (2009-10-23 14:24:14)

Similar Messages

  • Text on right in GNOME/GTK apps in Openbox

    On the toolbars of my GTK/GNOME apps, the toolbar has text underneath the icons, I was wondering if this could be changed to be on the right, alongside the icon.
    I know this can be done in GNOME, but I'm running in Openbox, so I'm guessing the configuration might be hidden somewhere, I'm looking to gconf, could be wrong...
    I know this is just a minor thing, but im a bit of a perfectionist

    Thanks SamC, just used lxappearance (though I quickly reinstated my method of doing things) from it I found that you can just add this to .gtkrc.mine:
    gtk-toolbar-style=3
    I've also just found this:
    http://awesome.naquadah.org/wiki/index. … g_GTK_Apps
    Which also helps

  • How to use notify-osd with qt apps in openbox

    Hi, i'm using openbox and Notify-osd. With qhte GTK apps it works fine and i have no problems. But, all the QT apps don't work with notify-osd. Is there a way to get it work?
    I've tried editing the  this /usr/share/dbus-1/services/org.freedesktop.Notifications.service file, and it says:
    [D-BUS Service]
    Name=org.freedesktop.Notifications
    Exec=/usr/lib/notify-osd/notify-osd
    But, it still not working with the QT or the KDE apps. like amarok or choqok.

    na12 wrote:How can I change theme of qt applications in openbox? Qtconfig works only for gnome but not for openbox.It is ugly to have dark gtk apps and light qt apps.
    This is what worked for me:
    Put style=GTK+ at the end of your.config/Trolltech.conf. Got idea from here.

  • [Tut] Smooth KDE4 + FF3 (and other GTK apps) integration (Oxygen!)

    This is a very simple tutorial, but this problem stumped me for a little (finding gtk-kde4-oxygen-theme), so I thought it might help others. Most normal KDE4 +GTK guides tell you to use  gtk-qt-engine by itself, which some stubborn apps (Firefox especially) don't play nice with. Most Firefox guides tell you to install QtCurve, which is nice, but not nearly as nice as Oxygen IMO, especially since even KDE apps will change to QtCurve.
    I used KDEmod, but normal KDE should work too.
    1.) Get the KFirefox theme here: http://ramonantonio.net/kde-firefox/ This will change the main look of Firefox. to integrate well.
    2.) Get gtk-qt-engine, and install. This will let you set a KDE style for GTK apps. Unfortunately, "Use my KDE style in GTK applications" does not work in some stubborn apps, like Firefox, and you're normally forced to "Use another style" that's not as nice as your main KDE4.
    3.) Get gtk-kde4-oxygen-theme from the AUR, and install. This is one of those "other styles", but it's very Oxygen-like.
    4.) Go to the KDE System Settings, Appearance, and GTK Styles and Fonts. Select "Use another style", and then 'kde4-oxygen'.
    Done! You may need to restart Firefox and/or KDE. Enjoy =]

    brainsqueezer wrote:
    MillTek wrote:I tried and it changed he size of the FFox 'personal toolbar' to half the screen in height.  I refer to the toolbar where you can drag'n'drop links and establish folders of links etc.  Any ideas???
    Hello I'm the creator of the theme. Could you provide more information and test latest version?
    Sure.  I am using Minefield 3.0 and I just loaded your theme and it seems to work fine. Looks like you got whatever was causing the problem to work properly.

  • Gnome splash screen and gtk-apps in awesome huge fonts.

    Hi all,
    I installed awesome wm the other day and for some reason all GTK-apps have huge fonts. GDM and the gnome splash screen have the same issue. I'm thinking this is a DPI issue but I wouldn't know where to start looking. Could someone point me in the right direction?
    Thanks.

    Master One wrote:
    In the meantime I swapped over to KDEMOD again, but I am still not satisfied. I prefer a mix of QT and GTK+ applications, and whatever I tried, they just do not look the same if running them in KDE or XFCE4.
    Maybe I should try running a WM instead of a DE, after some reading I am very tempted to go for Openbox.
    Can somebody running just a WM comment on the results, when mixing QT & GTK+ apps?
    I use Openbox and don't have any ugly looking apps. Granted, I think the only QT app I use is opera though

  • Connection lost and slow gtk apps

    Hi,
    I have a wireless connection (zd1211 chip). I am always connected to the router, but when it losts internet connection (telecom italia sucks), gtk apps (not qt) freeze for about 20 seconds before they start.(seems like a connection timed out) I had ubuntu before and I hadn't this problem...
    Suggestion?

    Cornholio wrote:Hi,
    I have a wireless connection (zd1211 chip). I am always connected to the router, but when it losts internet connection (telecom italia sucks), gtk apps (not qt) freeze for about 20 seconds before they start.(seems like a connection timed out) I had ubuntu before and I hadn't this problem...
    Suggestion?
    *Which* GTK apps?  I suspect not all of them.  Do you have mounted filesystems on NFS or something similar?
    -- Thomas Adam

  • Use a gtk theme for one app and another for the whole system??

    I would like to know if is it possible to use a theme for one application and use another for the remaining of the system? I use OpenBox and I change themes with Lxappearance...
    Thanks,

    Uhh, thanks mauryck for the question and anonymous_user for the answer! I use a very slow gtk theme, and one program suffer from it, but this theme is so beautiful so I dont like to change. Never though about this solution, use a different theme only for this program!
    Sometimes the solution is so simple...

  • [Resolved] Adobe-AIR and some other GTK apps crash

    Gtk-WARNING **: Unable to locate theme engine in module_path: “oxygen-gtk”
    HTMLLoader failed to initialize
    How its work? oxygen-gtk are installed and works good with other gtk+ apps.
    Help me pls.
    Last edited by sylion (2011-04-17 21:22:37)

    sylion wrote:problem resolved by installing this packages: lib32-libxslt, lib32-xcb-util
    That was brilliant.
    Thanks for sharing!
    Juan
    :wq

  • Xfce4, gnome, and my GTK apps???

    What should I do here? So far I have done a fresh install of arch linux. I installed the light version of gnome, no extras. I did install a few gnome programs, like gnome-system-monitor, file roller, etc... functionality reasoning. I also have skype and audacious installed atm, pretty bare bones as u can see.
    What I did was change DE's, I now am stuck on xfce4 and want to drop gnome from this arch install. What should I be worried about and how would you go about removing gnome without ruining the arch install? I really like my setup and my GTK apps, I do not wanna destroy it. Any advice???
    Last edited by jacko (2007-12-02 19:34:43)

    on another note, how do I get my desktop icons back??? I experimented with the alt + ctrl + esc keyboard shortcut and did a kill process command on my desktop which in turned deleted the icons. Now they won't come back...

  • [SOLVED] Java GTK look and feel

    I opened a thread recently about replacing the ugly swing buttons in Java applications. After successfully modifying my ~/.bashrc, all was well. However, these new changes were only present when run from a terminal. I assumed it was because my desktop was still running a bash session that hadn't loaded the new options yet, so I restarted.
    Symptom: Java apps launched from the GUI still have old swing buttons, but have the GTK look and feel when launched from a terminal.
    My .bashrc additions:
    # Java stuff
    export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
    I use SLiM for a graphical login experience. Could this be affecting it? I'm not sure what happens differently behind the scenes when using a login manager other than that CTRL+ALT+F7 brings me to my GUI when I use one (because all 6 TTYs are still TTYs).
    Last edited by 2mac (2014-01-02 20:51:35)

    I had a similar issue where .xinitrc wasn't working to set an environment variable. I put mine in ~/.config/openbox/environment and it worked. If you run openbox try that. If using a different window manager maybe try /etc/environment I am unsure of how slim functions though maybe there are config files for it. I think slim is on it's way out though (already lacks some compatibility with systemd; they may fix it though upstream I have no idea). But yeah try the environment file way and see if that does it (assuming you have tested your command from the shell and it works how you want).

  • VI style keybindings for whole desktop ?

    I know in MAC OS X, EMACS style keybindings are system wide.
    Is there a way to set up vi-style (or VIM-style) for whole desktop softwares, not to set up in individual software (if it has a vim-style) ?
    e.g:
       Suppose there was a setting option:
       set vi
       After toggle it on, I can use vi-style keybindings in every software that I am currently focus on.
       For example, in filemanager (it does not have a vi-style keybindings), I can use HJKL to navigate.
    Last edited by jameschyn (2011-12-27 01:50:49)

    Based on the info in your edit, I think the simple answer is no.
    The less simple answer is 'maybe'.  If you spend some time with xbindkeys or your window manager config you could probably achieve much of this.  To go on your example, it would be pretty easy to bind h,j,k,&l to arrow keys which would have the effect you want - but it'd also have a hell of a lot of unwanted side effects as you could no longer type those letters!
    Vim is modal, X is not.
    I think you'd be best served by finding apps that work the way you want like vifm for a file manager with vi-style keybindings.
    Last edited by Trilby (2011-12-27 23:23:39)

  • JComboBox causing GTK-WARNING and GTK-CRITICAL on Ubuntu 8.04

    I was wondering why whenever I use the GTK Look and Feel, my JComboBox's cause GTK issues. They also don't display right...
    Here is the code I am using....
    import javax.swing.*;
    public class ComboBoxDisplayTest extends JFrame
      public ComboBoxDisplayTest()
        try
          UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
          SwingUtilities.updateComponentTreeUI(this);
        catch(Exception ex)
          ex.printStackTrace();
        JComboBox cb = new JComboBox();
        this.add(cb);
        cb.addItem("Item 1");
        cb.addItem("Item 2");
      public static void main(String[] args)
        ComboBoxDisplayTest c = new ComboBoxDisplayTest();
        c.pack();
        c.setVisible(true);
    }This is what get's printed onto the terminal when I run the program:
    java ComboBoxDisplayTest
    (<unknown>:7078): Gtk-WARNING **: Attempting to add a widget with type GtkButton to a GtkComboBoxEntry (need an instance of GtkEntry or of a subclass)
    (<unknown>:7078): Gtk-CRITICAL **: gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
    (<unknown>:7078): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed
    (<unknown>:7078): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed
    (<unknown>:7078): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed
    (<unknown>:7078): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed
    (<unknown>:7078): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failed
    (<unknown>:7078): Gtk-CRITICAL **: gtk_paint_box: assertion `style->depth == gdk_drawable_get_depth (window)' failedWhat exactly is going on?
    Is there something wrong with my code?
    Is there any way to fix this?
    Any answers are much appreciated...
    Thanks

    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6624717
    as far as i know (i am using Ubuntu 7.10 & OpenJDK 1.6.0_0-b11 & Sun JDK) not fixed yet ....
    Ronald

  • How can I use KDE apps in Openbox?

    I like using Openbox because it fits very well in my netbook, it's fast and lightweight. I also like to use a good file manager, like Dolphin and a image viewer like Gwenview. I can perfectly run those apps in Openbox, but there is a dark side.
    When I execute them, a bunch of extra processes come in, like knotify, kded4, khelper, kacpid, and a lot with "k"! I hate that because even after all the apps are closed, knotify (and the others) still running and consume about 90% of the CPU (specially knotify) when in normal use (without KDE apps), the average usage of it is about 10%
    Is there any way to use a "standalone" Dolphin or Gwenview or any other KDE app?
    Thanks!
    Last edited by sironitomas (2011-01-30 15:57:39)

    I use also some KDE applications in openbox, and I saw also the 7% cpu usage of knotify4 after the upgrade to KDE 4.6 with a new $HOME/.kde4.
    I could suppress that the same way as mentioned in https://bbs.archlinux.org/viewtopic.php?id=77531 post #2
    ie choosing "No audio output" for the notifications.
    I use regularly Konsole and play some KDE games; here are the KDE related processes running continuously :
    berbae 4400 1 0 10:32 ? 00:00:00 kdeinit4: kdeinit4 Runnin e
    berbae 4402 4400 0 10:32 ? 00:00:00 kdeinit4: klauncher [kdei e
    berbae 4404 1 0 10:32 ? 00:00:00 kdeinit4: kded4 [kdeinit]
    root 4412 1 0 10:32 ? 00:01:31 /usr/lib/upower/upowerd
    berbae 4458 1 0 10:33 tty1 00:00:09 konsole
    berbae 4460 4458 0 10:33 pts/0 00:00:00 /bin/bash
    berbae 4562 1 0 10:44 ? 00:00:00 /usr/bin/knotify4
    With these processes running I get 0-1% cpu usage, of course after the change with the notifications output.
    Hope that will solve also your issue.

  • Printers not shown in gtk apps under KDE 4.7

    Sorry if asked before, I searched a lot and tried many things but couldn't find a fix.
    No gtk based app are showing my configured printers. This includes LibreOffice, GIMP and Chromium. The printers are, however, shown properly in every kde app and in Opera. http://localhost:631/printers/ also shows "No printers."
    I'm running KDE 4.7.2.
    Things I already tried:
    - cp /etc/cups/cupsd.conf.default /etc/cups/cupsd.conf
    - I already have installed libgnomeprint
    - HostNameLookups Double in /etc/cups/cupsd.conf
    - I'm already in lpadmin group, which I also added to /etc/cups/cupsd.conf
    I don't really know when this problem started, probably a few weeks ago.
    Thanks in advance.

    Same issue here. Problem only occurs if you are using a custom shortcut (not one of the shortcuts mentioned in Main Shortcut.
    I did a quick search and this is the only related post I have found on the topic so it seems like an Arch only problem. If it is a KDE problem, this http://www.commit-digest.org/issues/201 … 79ffe2ed8/ bug-fix could be the reason.

  • Terminal.app and the European Unicode characters?

    Does anyone have the unicode characters working properly in Terminal.app?
    If I try to write in GNU nano 1.2.4 for instance "örrör" it translates into:
    (one empty line)
    örr
    ör
    which isn't certainly right. This is especially awkward when editing an unicode text file where the text then easily becomes more or less garbled. Usually more.
    It doesn't seem to make any difference whether or not I use the Finnish extended (unicode) keyboard layout or the conventional one in nano. If the Terminal.app window preferences are set as UTF-8, it says:
    ?rr
    ?r
    which looks even more garbled.
    In plain bash the characters print like this:
    å = \345
    ä = \344
    ö = \366
    so my mighty apple translates the example string "örrör" as "\366rr\366r".
    Any ideas, anyone?
    PowerBook G4 @ 1.5 GHz   Mac OS X (10.4.4)   1.25 GB DDR SDRAM
    Debian Sarge 3.1 as a slave fetchmail server.

    Hi solarflare,
       My first (and essentially only) language is English as well. However enough folks have asked that I have experimented with multibyte characters. There are so many apps and options involved, it's difficult to get consistent results. However, I'll recount as many settings as I can recall.
       To begin with, you are right about the LC settings. It helps many apps to have:
    export LCALL=enUS.UTF-8
    export LANG=en_US.UTF-8
    set in your shell startup scripts. Then the system should be set to produce unicode when you type. In the "Input Menu" tab of the "International" pane of "System Preferences", you should select a unicode keyboard layout, such as U.S. Extended.
       To configure the Terminal, you need to open the "Terminal Inspector" by selecting "Window Settings..." in the "Terminal" menu. To type many multibyte characters, you need the option key. To use it, you must have the "Use option key as meta key" checkbox unchecked, although I find the meta key too important in UNIX to leave that unchecked. In the dropdown menu in the "Display" pane of the "Terminal Inspector", you should set the "Character Set Encoding" to "Unicode (UTF-8)". In the "Emulation" pane of the same window, you must uncheck the "Escape non-ASCII characters" checkbox. That is important as I've read that it is checked by default and that can produce some pretty strange results.
       Now it's helpful to use a very modern shell. For instance, the latest beta version of zsh-4.3 has the best unicode support of all versions of zsh. After you've chosen a good shell, you're at the mercy of the application that you're using. As I gather you've noticed, vim has excellent unicode support and picks up on the LC settings. I have no idea about nano but it is meant to be a minimal text editor.
       I know that my settings allow me to type extended characters and the "Character Palette" lets me insert more. As far as other command line utilities go, the best you can do is to choose well and keep your apps as up-to-date as possible. Fink or Darwin Ports can often help in that regard.
    Gary
    ~~~~
       This generation doesn't have emotional baggage.
       We have emotional moving vans.
             -- Bruce Feirstein

Maybe you are looking for