Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize keys #151

Closed
zan22 opened this issue Jul 22, 2014 · 7 comments

Comments

@zan22
Copy link

commented Jul 22, 2014

I want to make -> and <- got forward and backward please

@muennich

This comment has been minimized.

Copy link
Owner

commented Jul 22, 2014

You only need to apply the following patch to your config.h:

--- config.def.h    2014-06-10 09:29:17.108188636 +0200
+++ config.h    2014-07-22 09:05:29.902102223 +0200
@@ -99,6 +99,9 @@ static const keymap_t keys[] = {
    { 0,            XK_N,             it_navigate_marked,   (arg_t) +1 },
    { 0,            XK_P,             it_navigate_marked,   (arg_t) -1 },

+   { 0,            XK_Left,          i_navigate,           (arg_t) -1 },
+   { 0,            XK_Right,         i_navigate,           (arg_t) +1 },
+
    { 0,            XK_h,             it_scroll_move,       (arg_t) DIR_LEFT },
    { 0,            XK_Left,          it_scroll_move,       (arg_t) DIR_LEFT },
    { 0,            XK_j,             it_scroll_move,       (arg_t) DIR_DOWN },

The diff is against a vanilla config.def.h from the current master (5d0679b).

@muennich muennich closed this Jul 22, 2014
@muennich

This comment has been minimized.

Copy link
Owner

commented Jul 22, 2014

The config.h must be put into place before compiling sxiv, so you have to modify the package and build it on your own.

@muennich

This comment has been minimized.

Copy link
Owner

commented Jul 22, 2014

I do not know how xmonad handles the recompilation, but I'm quite certain that being written in haskell helps a lot. I doubt that an application written in C can do something like this.

@barrucadu

This comment has been minimized.

Copy link

commented Jul 22, 2014

(disclaimer: I've never even heard of sxiv before, but this was brought to my attention)

The way XMonad does this is by recompiling itself and then restarting, which is why it depends on ghc. So, to implement something like this in sxiv you'd need

  • To have a runtime dependency on a C compiler (not really much of a problem)
  • To be able to restart with no loss of information
@muennich

This comment has been minimized.

Copy link
Owner

commented Jul 22, 2014

Let's just end the discussion right here. I will not do any of this.
I've often said here and in forums that I would have used lua, if the goal of sxiv was to be a highly configurable image viewer. But it is not.
sxiv uses the simple config.h configuration-at-compile-time scheme to provide a bare minimum of configuration, which allows an experienced computer user to bend some behaviours/looks/mappings to her needs. There's no technical limitation, that prevents me from writing my own config parser or to rely on lua. It is an intentional one.
And the only lesson I have learned from including a configuration file and adding the key-handler and image-info scripts is, that the number of bug reports will increase, because some user setting does not work, as will the number of feature requests regarding new configuration options.

@muennich

This comment has been minimized.

Copy link
Owner

commented Jul 22, 2014

Dependencies aren't the problem here. But I really think that it is a lot easier for everyone, if users just build sxiv themselves, if they really need to change the default configuration. And I would be the one who has to come up with the actual implemention for this ah-so simple recompilation scheme, that would have to work for every user on every distro.

@zebracanevra

This comment has been minimized.

Copy link

commented Jul 22, 2014

Every single other sane program uses plaintext config files. All that would need to be done is write a parser. Embedding lua or recompiling a C header is a pointless and time consuming task, which will offer little to no benefits over a probably less than 100 line config parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.