I want to remap a key into a sequence of keys while running one cli prog[SOLVED]

Forum Forums New users New Users and General Questions I want to remap a key into a sequence of keys while running one cli prog[SOLVED]

  • This topic has 3 replies, 2 voices, and was last updated Mar 15-1:20 am by BobC.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7795
    Moderator
    BobC

      When I’m running a particular program from only that terminal session running mc, i want to remap the ctrl-home key to a ctrl-g-1-enter and when the program exits i want it to return to normal.

      I can see that I could create a script to

      map keys
      run program
      unmap keys

      But what program can map a key or pair of keys to a sequence of keys, only for that terminal session?

      Thanks…

      • This topic was modified 5 years, 1 month ago by BobC.
      #7798
      Anonymous
        Helpful
        Up
        0
        ::

        mc is running in console, or within an xsession terminal emulator window?

        “running a particular program launched from only that terminal session running mc”
        ^— suggests it’s the latter context.
        Using a wrapper script which remaps (and execs fb reconfig), then launches mc, and waits for mc to exit and remaps (and execs fb reconfig) could work…
        …but would trap the keypress globally, not just when the launched-via-mc app window has focus.

        But what program can map a key or pair of keys to a sequence of keys, only for that terminal session?
        I’m saying: no program can do so.
        The window manager gets “first dibs” at trapping keypresses.
        Even if a program (internally) supports configurable keybind assignments…
        …any such assignments that confict with (are overshadowed by) globally-assigned keybinds, will wind up ineffective.
        You can notice examples of this: F10 keypress in htop, or in roxterm (or in lxterminal?) may not produce the documented (per the application’s docs) result, due to being overshadowed/grabbed by a global assignment specified in ~/{jwm|icewm|fluxbox}/keys

        #7799
        Moderator
        BobC
          Helpful
          Up
          0
          ::

          I run a terminal, in my case mrxvt-mini

          in the terminal session i typically run mc

          from the mc screen i will press F3 to view, or F4 to edit the file

          i am hoping i can make it call a viewer or editor script that will map the 2 keys I want to work differently, then call the viewer or editor program to view or edit

          when i exit the program i’m hoping it will unmap it back

          but i don’t want that affecting all uses of ctrl-home or ctrl-end, just the terminal session where i am running that program.

          its not looking good,.. oh well…

          PS: it sounds like my only option is to remap the keys in the editor itself

          • This reply was modified 5 years, 1 month ago by BobC.
          #7806
          Moderator
          BobC
            Helpful
            Up
            0
            ::

            I downloaded all the sources for Tilde, added the functions to the editor and compiled it from source. Considering I don’t know C++ or much C even, I’m real happy with it.

            It’s an editor that works with keystroke shortcuts similar to Notepad++ on my work PC. I made it so ESC-ESC exits like Midnight Commander’s viewer. I added Ctrl-Home to go to beginning of file, and Ctrl-End to go to end of file, like many viewers and editors I’m familiar with. Its really quite comfortable to use, except that shift arrows don’t select (maybe a project for another day), but the mouse select does work, so I do have a way to do it somehow that I’m used to, so that’s pretty good.

            My mouse wouldn’t work with Jed and that drove me nuts, and I just couldn’t find a better multi-window, multi-buffer, mouse capable, no X windows needed viewer/editor. I’ll post a screen print from my other PC where I worked on it if anyone is interested.

            PS: It looks like Tilde will be in the repos in Buster, I guess its in SID now.
            PSS: Thanks Skidoo for showing me that was the only way to fix it if I wanted that feature…

            • This reply was modified 5 years, 1 month ago by BobC.
            • This reply was modified 5 years, 1 month ago by BobC.
            • This reply was modified 5 years, 1 month ago by BobC.
          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.