Christian Dietrich | 1 May 13:42 2010
Picon

[Contrib-Patch] XMonad.Actions.KeyRemap

Hi,
i had the problem that i wanted to use programmers dvorak keymapping[1]
(or better said, i wanted to learn it). But for me as an emacs user it
is a little bit disturbing, that my keybindings change when doing so.

So i wrote a module that made it possible for me to define a keymapping,
so that normal characters are translated by xmonad to programmers
dvorak, and everythin that contains a modifier is left untouched.

This behaviour is done by grabbing all keys by xmonad and sending
appropriate Events to the focused window.

It is also possible to change keymaps on the fly. Here i have the empty
Mapping (here are also no keys bound by xmonad) on F1 and the dvorak
Mapping on F2.

greetz didi

[1] http://www.kaufmann.no/roland/dvorak/

PS: I hope i got the attachment right, i'm not used to gnus until now.

--

-- 
No documentation is better than bad documentation
-- Das Ausdrucken dieser Mail wird urheberrechtlich verfolgt.

Attachment (KeyRemap.hs): text/x-haskell, 6925 bytes
Hi,
(Continue reading)

Gwern Branwen | 1 May 15:02 2010
Picon

Re: [Contrib-Patch] XMonad.Actions.KeyRemap

On Sat, May 1, 2010 at 7:42 AM, Christian Dietrich
<stettberger@...> wrote:
> Hi,
> i had the problem that i wanted to use programmers dvorak keymapping[1]
> (or better said, i wanted to learn it). But for me as an emacs user it
> is a little bit disturbing, that my keybindings change when doing so.
>
> So i wrote a module that made it possible for me to define a keymapping,
> so that normal characters are translated by xmonad to programmers
> dvorak, and everythin that contains a modifier is left untouched.
>
> This behaviour is done by grabbing all keys by xmonad and sending
> appropriate Events to the focused window.
>
> It is also possible to change keymaps on the fly. Here i have the empty
> Mapping (here are also no keys bound by xmonad) on F1 and the dvorak
> Mapping on F2.
>
> greetz didi
>
> [1] http://www.kaufmann.no/roland/dvorak/
>
> PS: I hope i got the attachment right, i'm not used to gnus until now.

The attachment is fine, but it'd be better if it were a Darcs patch
and not just the raw source. If you're not sure how to 'darcs add' a
file, 'darcs record' it as a patch, and then 'darcs send' it to this
list, the Darcs manual is useful: http://darcs.net/manual/

--

-- 
(Continue reading)

Christian Dietrich | 1 May 15:45 2010
Picon

Re: [Contrib-Patch] XMonad.Actions.KeyRemap


> The attachment is fine, but it'd be better if it were a Darcs patch
> and not just the raw source. If you're not sure how to 'darcs add' a
> file, 'darcs record' it as a patch, and then 'darcs send' it to this
> list, the Darcs manual is useful: http://darcs.net/manual/

I really want to send a darcs patch file, but code.haskell.org seems to
be down for now and i can't figure out how to press a patch out of darcs
without code.haskell.org up.

greetz didi
--

-- 
No documentation is better than bad documentation
-- Das Ausdrucken dieser Mail wird urheberrechtlich verfolgt.

adam vogt | 1 May 22:25 2010
Picon

Re: [Contrib-Patch] XMonad.Actions.KeyRemap

Hello Christian,

I have a couple suggestions, mostly concerned with documentation:

Type signatures for top level declarations are mandatory.

Blocks of sample code should be prefixed with `>':

-- > foo x y z = ...
-- >     ....

Itemized lists need blank lines around each item.

Lastly, the hardcoded constants could be calculated from the strings
you listed with `map (fromIntegral . fromEnum)'. Leave out the
fromIntegral if [Int] is the result you're looking for.

If it was a runtime performance concern, you could use template
haskell to run that calculation at compile time.

Nice idea to restore some unserializable state with the startupHook.

--
Adam

On Sat, May 1, 2010 at 7:42 AM, Christian Dietrich
<stettberger@...> wrote:
> Hi,
> i had the problem that i wanted to use programmers dvorak keymapping[1]
> (or better said, i wanted to learn it). But for me as an emacs user it
(Continue reading)

Christian Dietrich | 2 May 11:19 2010
Picon

Re: [Contrib-Patch] XMonad.Actions.KeyRemap

adam vogt <vogt.adam@...> writes:

> Hello Christian,
>
> I have a couple suggestions, mostly concerned with documentation:

I have done darcs send, but it seems it didn't worked :-( I just fixed
the documentation in that patch. 

> Type signatures for top level declarations are mandatory.
>
> Blocks of sample code should be prefixed with `>':
>
> -- > foo x y z = ...
> -- >     ....
>
> Itemized lists need blank lines around each item.
>
> Lastly, the hardcoded constants could be calculated from the strings
> you listed with `map (fromIntegral . fromEnum)'. Leave out the
> fromIntegral if [Int] is the result you're looking for.

let a = (map fromEnum "abc") :: [KeySym]

<interactive>:1:13:
    Couldn't match expected type `KeySym' against inferred type `Int'
    In the first argument of `map', namely `fromEnum'
    In the expression: (map fromEnum "abc") :: [KeySym]
    In the definition of `a': a = (map fromEnum "abc") :: [KeySym]

(Continue reading)

Adam Vogt | 2 May 16:28 2010
Picon

Re: Re: [Contrib-Patch] XMonad.Actions.KeyRemap

* On Sunday, May 02 2010, Christian Dietrich wrote:

>adam vogt <vogt.adam@...> writes:
>
>> Lastly, the hardcoded constants could be calculated from the strings
>> you listed with `map (fromIntegral . fromEnum)'. Leave out the
>> fromIntegral if [Int] is the result you're looking for.
>
>let a = (map fromEnum "abc") :: [KeySym]
>
><interactive>:1:13:
>    Couldn't match expected type `KeySym' against inferred type `Int'
>    In the first argument of `map', namely `fromEnum'
>    In the expression: (map fromEnum "abc") :: [KeySym]
>    In the definition of `a': a = (map fromEnum "abc") :: [KeySym]
>
>If you can give me a way around this type issue i will fix it with pleasure.

  Prelude XMonad> map (fromIntegral . fromEnum) "qwerty" :: [KeySym]
  [113,119,101,114,116,121]

--
Adam
Christian Dietrich | 2 May 17:35 2010
Picon

Re: [Contrib-Patch] XMonad.Actions.KeyRemap

Adam Vogt <vogt.adam@...> writes:
>   Prelude XMonad> map (fromIntegral . fromEnum) "qwerty" :: [KeySym]
>   [113,119,101,114,116,121]

Thank you very much, i replaced this and attached the new patch

greetz didi
-- 
No documentation is better than bad documentation
-- Das Ausdrucken dieser Mail wird urheberrechtlich verfolgt.

Attachment (KeyRemap.patch): text/x-diff, 6962 bytes
Adam Vogt <vogt.adam@...> writes:
>   Prelude XMonad> map (fromIntegral . fromEnum) "qwerty" :: [KeySym]
>   [113,119,101,114,116,121]

Thank you very much, i replaced this and attached the new patch

greetz didi
--

-- 
No documentation is better than bad documentation
-- Das Ausdrucken dieser Mail wird urheberrechtlich verfolgt.

Adam Vogt | 2 May 19:09 2010
Picon

Re: Re: [Contrib-Patch] XMonad.Actions.KeyRemap

* On Sunday, May 02 2010, Christian Dietrich wrote:

>Adam Vogt <vogt.adam@...> writes:
>>   Prelude XMonad> map (fromIntegral . fromEnum) "qwerty" :: [KeySym]
>>   [113,119,101,114,116,121]
>
>Thank you very much, i replaced this and attached the new patch
>
>greetz didi
>-- 
>No documentation is better than bad documentation
>-- Das Ausdrucken dieser Mail wird urheberrechtlich verfolgt.

Hello Christian,

One final thing prevents me from applying your patch:

darcs won't apply your patch: the context lines after the body of the
patch (make it with `darcs send -O') seem to be necessary.

Thanks,
Adam
Christian Dietrich | 3 May 10:45 2010
Picon

Re: [Contrib-Patch] XMonad.Actions.KeyRemap

Adam Vogt <vogt.adam@...> writes:

> Hello Christian,
>
> One final thing prevents me from applying your patch:
>
> darcs won't apply your patch: the context lines after the body of the
> patch (make it with `darcs send -O') seem to be necessary.
>
> Thanks,
> Adam

hm, code.haskell.org seems to be down quite often at the moment,
perhaps it is possible for you to pull from [1].

greetz didi

[1] http://dokucode.de/files/XMonadContrib/
--

-- 
No documentation is better than bad documentation
-- Das Ausdrucken dieser Mail wird urheberrechtlich verfolgt.

adam vogt | 3 May 17:43 2010
Picon

Re: Re: [Contrib-Patch] XMonad.Actions.KeyRemap

On Mon, May 3, 2010 at 4:45 AM, Christian Dietrich
<stettberger@...> wrote:
> hm, code.haskell.org seems to be down quite often at the moment,
> perhaps it is possible for you to pull from [1].
>
> greetz didi
>
> [1] http://dokucode.de/files/XMonadContrib/

I've applied your KeyRemap patch. Thanks.

Gmane