Ticket #2666 (new enhancement)

Opened 13 years ago

Last modified 9 years ago

FR: Start detached (has patch inside)

Reported by: Hubbitus Owned by:
Priority: trivial Milestone: Future Releases
Component: mc-core Version: master
Keywords: Cc: mooffie@…
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

Hello, guys.

Far on Windows (yes, I'm use it on many servers at work) have very convenient future: When I start program by hitting "Shift + Enter" instead of single Enter key - it started "detached" from far, so in new window by ather words (start command used if I understand correctly). It is very usefull.

As always Linux more powefull, and there no just "start" command, but I suggest use preconfigured console command. I think very common example should be "xterm", but it mast be adjusted on some manner (simplest way via config file) if user want use gnome-terminal or Konsole instead.

Off course it will be useful in X session only, but it has not side effect on the first glance because separate key combination used and no guess about environment should be applied.

Change History

comment:1 Changed 10 years ago by mooffie

  • Cc mooffie@… added

comment:2 Changed 9 years ago by Yuriy Chumak

On Shift+Enter starts executable under cursor as detached (by using " &" at the end of callee)

patch for ba9a5af10e89cc56a772ff7bfc1c692cea0dd0e6:

From: Yuriy Chumak
Date: Tue, 21 Apr 2015 09:50:56 +0300
Subject: [PATCH] Detached start for executables

---
 lib/keybind.c           |  1 +
 lib/keybind.h           |  1 +
 src/filemanager/panel.c | 18 ++++++++++++------
 src/keybind-defaults.c  |  1 +
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/lib/keybind.c b/lib/keybind.c
--- a/lib/keybind.c
+++ b/lib/keybind.c
@@ -48,6 +48,7 @@ static name_keymap_t command_names[] = {
     /* common */
     {"InsertChar", CK_InsertChar},
     {"Enter", CK_Enter},
+    {"ShiftEnter", CK_ShiftEnter},
     {"Up", CK_Up},
     {"Down", CK_Down},
     {"Left", CK_Left},
diff --git a/lib/keybind.h b/lib/keybind.h
index d5031ae..2fc3610 100644
--- a/lib/keybind.h
+++ b/lib/keybind.h
@@ -39,6 +39,7 @@ enum
 
     /* common */
     CK_Enter = 1,
+    CK_ShiftEnter,
     CK_Up,
     CK_Down,
     CK_Left,
diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c
--- a/src/filemanager/panel.c
+++ b/src/filemanager/panel.c
@@ -2722,7 +2722,7 @@ stop_search (WPanel * panel)
 /** Return TRUE if the Enter key has been processed, FALSE otherwise */
 
 static gboolean
-do_enter_on_file_entry (file_entry_t * fe)
+do_enter_on_file_entry (file_entry_t * fe, int detached)
 {
     vfs_path_t *full_name_vpath;
     gboolean ok;
@@ -2783,7 +2783,9 @@ do_enter_on_file_entry (file_entry_t * fe)
         char *tmp, *cmd;
 
         tmp = name_quote (fe->fname, FALSE);
-        cmd = g_strconcat (".", PATH_SEP_STR, tmp, (char *) NULL);
+        cmd = detached ?
+            g_strconcat (".", PATH_SEP_STR, tmp, "&", (char *) NULL) :
+            g_strconcat (".", PATH_SEP_STR, tmp, (char *) NULL);
         g_free (tmp);
         shell_execute (cmd, 0);
         g_free (cmd);
@@ -2799,9 +2801,9 @@ do_enter_on_file_entry (file_entry_t * fe)
 /* --------------------------------------------------------------------------------------------- */
 
 static inline gboolean
-do_enter (WPanel * panel)
+do_enter (WPanel * panel, int detached)
 {
-    return do_enter_on_file_entry (selection (panel));
+    return do_enter_on_file_entry (selection (panel), detached);
 }
 
 /* --------------------------------------------------------------------------------------------- */
@@ -3392,8 +3394,11 @@ panel_execute_cmd (WPanel * panel, unsigned long command)
         delete_cmd_local ();
         break;
     case CK_Enter:
-        do_enter (panel);
+        do_enter (panel, 0);
         break;
+    case CK_ShiftEnter:
+    	do_enter (panel, 1);
+    	break;
     case CK_ViewRaw:
         view_raw_cmd ();
         break;
@@ -3548,6 +3553,7 @@ panel_key (WPanel * panel, int key)
         return MSG_HANDLED;
     }
 
+    // keybind_lookup_keymap_command(panel_map, key)
     for (i = 0; panel_map[i].key != 0; i++)
         if (key == panel_map[i].key)
             return panel_execute_cmd (panel, panel_map[i].command);
@@ -3871,7 +3877,7 @@ panel_event (Gpm_Event * event, void *data)
     }
     else if ((local.type & (GPM_UP | GPM_DOUBLE)) == (GPM_UP | GPM_DOUBLE) &&
              local.y > 0 && local.y <= lines)
-        do_enter (panel);
+        do_enter (panel, 0);
 
   finish:
     if (panel->dirty)
diff --git a/src/keybind-defaults.c b/src/keybind-defaults.c
--- a/src/keybind-defaults.c
+++ b/src/keybind-defaults.c
@@ -170,6 +170,7 @@ static const global_keymap_ini_t default_panel_keymap[] = {
     {"CopySingle", "f15"},
     {"DeleteSingle", "f18"},
     {"Enter", "enter"},
+    {"ShiftEnter", "shift-enter"},
     {"EditNew", "f14"},
     {"MoveSingle", "f16"},
     {"SelectInvert", "alt-asterisk"},
-- 
1.9.1
Last edited 9 years ago by Yuriy Chumak (previous) (diff)

comment:3 Changed 9 years ago by Yuriy Chumak

  • Priority changed from minor to trivial
  • Summary changed from FR: Start detached to FR: Start detached (has patch inside)
Note: See TracTickets for help on using tickets.