gui: Close console with CTRL+D ala terminal #16515

pull promag wants to merge 1 commits into bitcoin:master from promag:2019-07-console-ctrld changing 1 files +6 −0
  1. promag commented at 10:56 pm on July 31, 2019: member
    Originally suggested by @emilengler.
  2. gui: Close console with CTRL+D ala terminal 5813b37ff6
  3. fanquake added the label GUI on Jul 31, 2019
  4. emilengler commented at 11:48 pm on July 31, 2019: contributor
    Tested it, works great. Concept ACK Approach ACK
  5. hebasto commented at 8:30 am on August 1, 2019: member
    Concept ACK and the code looks neat. The CTRL+D shortcut is not common for Windows users. And the GUI should somehow inform a user about it.
  6. jonasschnelli commented at 8:44 am on August 1, 2019: contributor

    I guess this is OS specific. On macOS, cmd-W does close windows within an app (works almost with all apps including strange java cross platform apps like “Arduino-IDE”,… but not with Bitcoin-Qt).

    However, concept ACK on working on shortcuts to close windows.

  7. laanwj commented at 9:45 am on August 1, 2019: member

    Concept ACK, going to test

    (though I share with @jonasschnelli a slight preference for Ctrl-W as well for closing any subwindow, due to FF browser tabs, but have no problem with Ctrl-D doing the same here, there’s already a PR for that anyhow #15768)

  8. laanwj commented at 10:18 am on August 1, 2019: member
    Tested ACK 5813b37ff687eb792d17b9efed729ee555bdb00a
  9. emilengler commented at 3:37 pm on August 1, 2019: contributor
    @jonasschnelli does ctrl+w closes any window? The idea behind it was only to close a terminal window and the bitcoin-qt terminal window is one. I think the Ctrl+D shortcut is common for unix terminals
  10. promag commented at 3:41 pm on August 1, 2019: member
    Correction, it sends EOF to the shell prompt, which then terminates, which can result in the window close.
  11. emilengler commented at 3:58 pm on August 1, 2019: contributor
    Sure but this effectively closes a terminal (at least on unix(-like) systems)
  12. promag commented at 4:08 pm on August 1, 2019: member

    Not quite:

    0cat
    1CTRL+D    # cat quits
    
  13. emilengler commented at 8:48 pm on August 1, 2019: contributor
    IIRC someone said that this does not send a EOF to the terminal, it “only” closes the terminal. I meant that your implementation is fine for this. Sorry I sometimes have problems to justify myself :(
  14. jonasschnelli commented at 10:40 am on August 2, 2019: contributor

    @jonasschnelli does ctrl+w closes any window?

    on macOS: yes. (Almost) every window (at least all well behaving apps close a window).


    #15768 is related and I think we should have one PR adding the “close window shortcut functionality”.

    Since this is OS dependent, the shortcut should probably be defined in platformstyles.cpp/.h.

    However, I think each window should be closeable with a default shortcut (including console, help, preferences, etc.). Probably: ctrl-D on linux, cmd-W on macOS and alt F4 on windows.

    I could not find, but it could be that Qt provide a such functionality already.

  15. jonatack commented at 12:03 pm on August 2, 2019: member

    ACK 5813b37ff687eb792d17b9efed729ee555bdb00a, built and tested manually, all tests pass.

    The added C-d functionality works only with the GUI console window, and not with the info, network traffic, or peers windows.

    On Linux Debian for me C-w closes desktop windows (Gnome) and browser tabs (Firefox), and C-d closes terminal windows.

    (though I share with @jonasschnelli a slight preference for Ctrl-W as well for closing any subwindow, due to FF browser tabs, but have no problem with Ctrl-D doing the same here, there’s already a PR for that anyhow #15768)

    Agree.

  16. emilengler commented at 3:30 pm on August 2, 2019: contributor
    On my Debian Linux MATE Ctrl-W also closes nearly every window except console windows. Does Ctrl-W also closes the default Terminal.app on macOS?
  17. hebasto commented at 11:21 am on August 3, 2019: member

    I’d prefer to use Ctrl+W for closing any subwindow (like #15768). And using a special shortcut for closing the “Console” window seems an overkill:

    Define new keyboard shortcuts only for things people do regularly. It’s hard for people to remember shortcuts they seldom use. Minimizing app-specific keyboard shortcuts also helps avoid potential conflicts with other system-wide shortcuts that may be in place.

    Anyway, if reviewers will decide that the “Console” window needs its own shortcut to be closed, it seems the next patch could be an improvement of usability:

     0--- a/src/qt/rpcconsole.cpp
     1+++ b/src/qt/rpcconsole.cpp
     2@@ -802,19 +802,21 @@ void RPCConsole::clear(bool clearHistory)
     3                 ".secwarning { color: red; }"
     4                 "b { color: [#006060](/bitcoin-bitcoin/006060/); } "
     5             ).arg(fixedFontInfo.family(), QString("%1pt").arg(consoleFontSize))
     6         );
     7 
     8 #ifdef Q_OS_MAC
     9-    QString clsKey = "(⌘)-L";
    10+    QString clear_key = "⌘L";
    11+    QString close_key = "⌘D";
    12 #else
    13-    QString clsKey = "Ctrl-L";
    14+    QString clear_key = "Ctrl+L";
    15+    QString close_key = "Ctrl+D";
    16 #endif
    17 
    18     message(CMD_REPLY, (tr("Welcome to the %1 RPC console.").arg(PACKAGE_NAME) + "<br>" +
    19-                        tr("Use up and down arrows to navigate history, and %1 to clear screen.").arg("<b>"+clsKey+"</b>") + "<br>" +
    20+                        tr("Use up and down arrows to navigate history, %1 to clear screen and %2 to close this window.").arg("<b>" + clear_key + "</b>").arg("<b>" + close_key + "</b>") + "<br>" +
    21                         tr("Type %1 for an overview of available commands.").arg("<b>help</b>") + "<br>" +
    22                         tr("For more information on using this console type %1.").arg("<b>help-console</b>") +
    23                         "<br><span class=\"secwarning\"><br>" +
    24                         tr("WARNING: Scammers have been active, telling users to type commands here, stealing their wallet contents. Do not use this console without fully understanding the ramifications of a command.") +
    25                         "</span>"),
    26                         true);
    
  18. promag commented at 0:28 am on August 19, 2019: member
    meh
  19. promag closed this on Aug 19, 2019

  20. promag deleted the branch on Aug 19, 2019
  21. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me