Skip to content

Commit e00e911

Browse files
author
You name
committed
Add configurable keyboard shortcuts
All keyboard shortcuts are now stored in GSettings under org.nemo.keybindings and can be changed at runtime. A new Keyboard Shortcuts tab in Edit > Preferences lets users view, search, and rebind any shortcut using an inline key-capture widget. Changes take effect immediately without restart.
1 parent 0ba73e5 commit e00e911

17 files changed

+1954
-73
lines changed

gresources/nemo-file-management-properties.glade

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4383,6 +4383,22 @@ along with . If not, see <http://www.gnu.org/licenses/>.
43834383
<property name="position">8</property>
43844384
</packing>
43854385
</child>
4386+
<child>
4387+
<object class="GtkBox" id="keybindings_box">
4388+
<property name="visible">True</property>
4389+
<property name="can-focus">False</property>
4390+
<property name="orientation">vertical</property>
4391+
<child>
4392+
<placeholder/>
4393+
</child>
4394+
</object>
4395+
<packing>
4396+
<property name="name">keybindings</property>
4397+
<property name="title" translatable="yes">Keyboard Shortcuts</property>
4398+
<property name="icon-name">xsi-keyboard-shortcuts-symbolic</property>
4399+
<property name="position">9</property>
4400+
</packing>
4401+
</child>
43864402
</object>
43874403
<packing>
43884404
<property name="expand">True</property>

gresources/nemo-shell-ui.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<ui>
22
<accelerator action="Search"/>
33
<accelerator action="SplitViewNextPane"/>
4+
<accelerator action="Bookmark Picker"/>
5+
<accelerator action="Bookmark Picker Other Pane"/>
46
<accelerator action="TabsPrevious"/>
57
<accelerator action="TabsNext"/>
68
<accelerator action="TabsMoveLeft"/>

gresources/nemo-style-fallback-mandatory.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77
background-color: @theme_unfocused_bg_color;
88
}
99

10+
/* Hide selection highlight and focus cursor in the inactive pane */
11+
.nemo-window .nemo-inactive-pane .view:selected {
12+
background-color: alpha(@theme_unfocused_selected_bg_color, 0.4);
13+
color: @theme_fg_color;
14+
}
15+
16+
.nemo-window .nemo-inactive-pane .view:focus {
17+
outline-width: 0;
18+
outline-offset: 0;
19+
-gtk-outline-radius: 0;
20+
}
21+
1022
/* Rename box styling in the icon view. */
1123

1224
.nemo-window .nemo-window-pane widget.entry {

libnemo-private/org.nemo.gschema.xml

Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,4 +895,262 @@
895895
<summary>List of search helper filenames to skip when using content search.</summary>
896896
</key>
897897
</schema>
898+
899+
<schema id="org.nemo.keybindings" path="/org/nemo/keybindings/">
900+
<!-- Navigation -->
901+
<key name="go-back" type="s">
902+
<default>'&lt;Alt&gt;Left'</default>
903+
<summary>Go back</summary>
904+
</key>
905+
<key name="go-forward" type="s">
906+
<default>'&lt;Alt&gt;Right'</default>
907+
<summary>Go forward</summary>
908+
</key>
909+
<key name="go-up" type="s">
910+
<default>'&lt;Alt&gt;Up'</default>
911+
<summary>Go to parent folder</summary>
912+
</key>
913+
<key name="go-home" type="s">
914+
<default>'&lt;Alt&gt;Home'</default>
915+
<summary>Go to home folder</summary>
916+
</key>
917+
<key name="edit-location" type="s">
918+
<default>'&lt;Control&gt;l'</default>
919+
<summary>Toggle location entry</summary>
920+
</key>
921+
<key name="reload" type="s">
922+
<default>'&lt;Control&gt;r'</default>
923+
<summary>Reload current location</summary>
924+
</key>
925+
<key name="reload-alt" type="s">
926+
<default>'F5'</default>
927+
<summary>Reload current location (alternate)</summary>
928+
</key>
929+
<key name="go-up-alt" type="s">
930+
<default>'BackSpace'</default>
931+
<summary>Go to parent folder (alternate)</summary>
932+
</key>
933+
<key name="search" type="s">
934+
<default>'&lt;Control&gt;f'</default>
935+
<summary>Search for files</summary>
936+
</key>
937+
938+
<!-- Window -->
939+
<key name="new-window" type="s">
940+
<default>'&lt;Control&gt;n'</default>
941+
<summary>Open a new window</summary>
942+
</key>
943+
<key name="close-window" type="s">
944+
<default>'&lt;Control&gt;w'</default>
945+
<summary>Close window or tab</summary>
946+
</key>
947+
<key name="close-all-windows" type="s">
948+
<default>'&lt;Control&gt;q'</default>
949+
<summary>Close all windows</summary>
950+
</key>
951+
<key name="show-hidden-files" type="s">
952+
<default>'&lt;Control&gt;h'</default>
953+
<summary>Toggle hidden files</summary>
954+
</key>
955+
<key name="show-sidebar" type="s">
956+
<default>'F9'</default>
957+
<summary>Toggle sidebar</summary>
958+
</key>
959+
<key name="split-view" type="s">
960+
<default>'F3'</default>
961+
<summary>Toggle split view</summary>
962+
</key>
963+
<key name="switch-pane" type="s">
964+
<default>'F6'</default>
965+
<summary>Switch to other pane</summary>
966+
</key>
967+
<key name="same-location-pane" type="s">
968+
<default>'&lt;Alt&gt;s'</default>
969+
<summary>Same location as other pane</summary>
970+
</key>
971+
972+
<!-- Tabs -->
973+
<key name="new-tab" type="s">
974+
<default>'&lt;Control&gt;t'</default>
975+
<summary>Open a new tab</summary>
976+
</key>
977+
<key name="previous-tab" type="s">
978+
<default>'&lt;Control&gt;Page_Up'</default>
979+
<summary>Previous tab</summary>
980+
</key>
981+
<key name="next-tab" type="s">
982+
<default>'&lt;Control&gt;Page_Down'</default>
983+
<summary>Next tab</summary>
984+
</key>
985+
<key name="move-tab-left" type="s">
986+
<default>'&lt;Shift&gt;&lt;Control&gt;Page_Up'</default>
987+
<summary>Move tab left</summary>
988+
</key>
989+
<key name="move-tab-right" type="s">
990+
<default>'&lt;Shift&gt;&lt;Control&gt;Page_Down'</default>
991+
<summary>Move tab right</summary>
992+
</key>
993+
994+
<!-- View -->
995+
<key name="zoom-in" type="s">
996+
<default>'&lt;Control&gt;plus'</default>
997+
<summary>Zoom in</summary>
998+
</key>
999+
<key name="zoom-out" type="s">
1000+
<default>'&lt;Control&gt;minus'</default>
1001+
<summary>Zoom out</summary>
1002+
</key>
1003+
<key name="zoom-normal" type="s">
1004+
<default>'&lt;Control&gt;0'</default>
1005+
<summary>Reset zoom to normal</summary>
1006+
</key>
1007+
<key name="icon-view" type="s">
1008+
<default>'&lt;Control&gt;1'</default>
1009+
<summary>Switch to icon view</summary>
1010+
</key>
1011+
<key name="list-view" type="s">
1012+
<default>'&lt;Control&gt;2'</default>
1013+
<summary>Switch to list view</summary>
1014+
</key>
1015+
<key name="compact-view" type="s">
1016+
<default>'&lt;Control&gt;3'</default>
1017+
<summary>Switch to compact view</summary>
1018+
</key>
1019+
1020+
<!-- Bookmarks -->
1021+
<key name="add-bookmark" type="s">
1022+
<default>'&lt;Control&gt;d'</default>
1023+
<summary>Add bookmark</summary>
1024+
</key>
1025+
<key name="edit-bookmarks" type="s">
1026+
<default>'&lt;Control&gt;b'</default>
1027+
<summary>Edit bookmarks</summary>
1028+
</key>
1029+
<key name="bookmark-picker" type="s">
1030+
<default>'&lt;Alt&gt;F1'</default>
1031+
<summary>Open bookmark and disk picker for current pane</summary>
1032+
</key>
1033+
<key name="bookmark-picker-other" type="s">
1034+
<default>'&lt;Alt&gt;F2'</default>
1035+
<summary>Open bookmark and disk picker for other pane</summary>
1036+
</key>
1037+
1038+
<!-- File Operations -->
1039+
<key name="open" type="s">
1040+
<default>'&lt;Control&gt;o'</default>
1041+
<summary>Open selected item</summary>
1042+
</key>
1043+
<key name="open-default" type="s">
1044+
<default>''</default>
1045+
<summary>Open with default application</summary>
1046+
</key>
1047+
<key name="open-alternate" type="s">
1048+
<default>'&lt;Control&gt;&lt;Shift&gt;o'</default>
1049+
<summary>Open in new window</summary>
1050+
</key>
1051+
<key name="open-in-new-tab" type="s">
1052+
<default>'&lt;Control&gt;&lt;Shift&gt;t'</default>
1053+
<summary>Open in new tab</summary>
1054+
</key>
1055+
<key name="open-in-terminal" type="s">
1056+
<default>'&lt;Shift&gt;F4'</default>
1057+
<summary>Open in terminal</summary>
1058+
</key>
1059+
<key name="open-containing-folder" type="s">
1060+
<default>'&lt;Control&gt;&lt;Alt&gt;o'</default>
1061+
<summary>Open containing folder</summary>
1062+
</key>
1063+
<key name="properties" type="s">
1064+
<default>'&lt;Alt&gt;Return'</default>
1065+
<summary>Show properties</summary>
1066+
</key>
1067+
<key name="new-folder" type="s">
1068+
<default>'&lt;Control&gt;&lt;Shift&gt;n'</default>
1069+
<summary>Create new folder</summary>
1070+
</key>
1071+
<key name="new-folder-alt" type="s">
1072+
<default>''</default>
1073+
<summary>Create new folder (alternate)</summary>
1074+
</key>
1075+
<key name="rename" type="s">
1076+
<default>'F2'</default>
1077+
<summary>Rename selected item</summary>
1078+
</key>
1079+
<key name="create-link" type="s">
1080+
<default>'&lt;Control&gt;m'</default>
1081+
<summary>Create symbolic link</summary>
1082+
</key>
1083+
<key name="pin-file" type="s">
1084+
<default>'&lt;Control&gt;&lt;Shift&gt;d'</default>
1085+
<summary>Pin or unpin file</summary>
1086+
</key>
1087+
<key name="trash" type="s">
1088+
<default>'Delete'</default>
1089+
<summary>Move to trash</summary>
1090+
</key>
1091+
<key name="trash-alt" type="s">
1092+
<default>''</default>
1093+
<summary>Move to trash (alternate key)</summary>
1094+
</key>
1095+
<key name="delete-permanently" type="s">
1096+
<default>'&lt;Shift&gt;Delete'</default>
1097+
<summary>Delete permanently</summary>
1098+
</key>
1099+
<key name="copy-to-other-pane" type="s">
1100+
<default>''</default>
1101+
<summary>Copy selection to other pane</summary>
1102+
</key>
1103+
<key name="move-to-other-pane" type="s">
1104+
<default>''</default>
1105+
<summary>Move selection to other pane</summary>
1106+
</key>
1107+
1108+
<!-- Clipboard -->
1109+
<key name="cut" type="s">
1110+
<default>'&lt;Control&gt;x'</default>
1111+
<summary>Cut files</summary>
1112+
</key>
1113+
<key name="copy" type="s">
1114+
<default>'&lt;Control&gt;c'</default>
1115+
<summary>Copy files</summary>
1116+
</key>
1117+
<key name="paste" type="s">
1118+
<default>'&lt;Control&gt;v'</default>
1119+
<summary>Paste files</summary>
1120+
</key>
1121+
1122+
<!-- Selection -->
1123+
<key name="select-all" type="s">
1124+
<default>'&lt;Control&gt;a'</default>
1125+
<summary>Select all items</summary>
1126+
</key>
1127+
<key name="select-pattern" type="s">
1128+
<default>'&lt;Control&gt;s'</default>
1129+
<summary>Select items matching a pattern</summary>
1130+
</key>
1131+
<key name="invert-selection" type="s">
1132+
<default>'&lt;Control&gt;&lt;Shift&gt;i'</default>
1133+
<summary>Invert selection</summary>
1134+
</key>
1135+
1136+
<!-- Edit -->
1137+
<key name="undo" type="s">
1138+
<default>'&lt;Control&gt;z'</default>
1139+
<summary>Undo</summary>
1140+
</key>
1141+
<key name="redo" type="s">
1142+
<default>'&lt;Control&gt;y'</default>
1143+
<summary>Redo</summary>
1144+
</key>
1145+
1146+
<!-- Help -->
1147+
<key name="show-help" type="s">
1148+
<default>'F1'</default>
1149+
<summary>Show help</summary>
1150+
</key>
1151+
<key name="show-shortcuts" type="s">
1152+
<default>'&lt;Control&gt;F1'</default>
1153+
<summary>Show keyboard shortcuts</summary>
1154+
</key>
1155+
</schema>
8981156
</schemalist>

src/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ nemoCommon_sources = [
4141
'nemo-icon-view.c',
4242
'nemo-image-properties-page.c',
4343
'nemo-interesting-folder-bar.c',
44+
'nemo-keybindings.c',
4445
'nemo-list-model.c',
4546
'nemo-list-view.c',
4647
'nemo-location-bar.c',

src/nemo-actions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
#define NEMO_ACTION_GO_HOME "Home"
5555
#define NEMO_ACTION_ADD_BOOKMARK "Add Bookmark"
5656
#define NEMO_ACTION_EDIT_BOOKMARKS "Edit Bookmarks"
57+
#define NEMO_ACTION_BOOKMARK_PICKER "Bookmark Picker"
58+
#define NEMO_ACTION_BOOKMARK_PICKER_OTHER "Bookmark Picker Other Pane"
5759
#define NEMO_ACTION_HOME "Home"
5860
#define NEMO_ACTION_ZOOM_IN "Zoom In"
5961
#define NEMO_ACTION_ZOOM_OUT "Zoom Out"

src/nemo-application.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
#include <libnemo-private/nemo-thumbnails.h>
6262
#include <libnemo-extension/nemo-menu-provider.h>
6363

64+
#include "nemo-keybindings.h"
65+
6466
#define DEBUG_FLAG NEMO_DEBUG_APPLICATION
6567
#include <libnemo-private/nemo-debug.h>
6668

@@ -565,6 +567,9 @@ nemo_application_startup (GApplication *app)
565567
init_icons_and_styles ();
566568
init_gtk_accels ();
567569

570+
/* initialize configurable keybindings */
571+
nemo_keybindings_init ();
572+
568573
/* initialize nemo modules */
569574
nemo_module_setup ();
570575

src/nemo-file-management-properties.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "nemo-plugin-manager.h"
4444
#include "nemo-template-config-widget.h"
4545
#include "nemo-actions.h"
46+
#include "nemo-keybindings.h"
4647

4748
/* string enum preferences */
4849
#define NEMO_FILE_MANAGEMENT_PROPERTIES_DEFAULT_VIEW_WIDGET "default_view_combobox"
@@ -487,6 +488,18 @@ nemo_file_management_properties_dialog_setup_templates_page (GtkBuilder *builder
487488
TRUE, TRUE, 0);
488489
}
489490

491+
static void
492+
nemo_file_management_properties_dialog_setup_keybindings_page (GtkBuilder *builder)
493+
{
494+
GtkWidget *box;
495+
GtkWidget *editor;
496+
497+
box = GTK_WIDGET (gtk_builder_get_object (builder, "keybindings_box"));
498+
editor = nemo_keybindings_create_editor ();
499+
500+
gtk_box_pack_start (GTK_BOX (box), editor, TRUE, TRUE, 0);
501+
}
502+
490503
static void
491504
create_date_format_menu (GtkBuilder *builder)
492505
{
@@ -1144,6 +1157,7 @@ nemo_file_management_properties_dialog_setup (GtkBuilder *builder,
11441157
nemo_file_management_properties_dialog_setup_list_column_page (builder);
11451158
nemo_file_management_properties_dialog_setup_plugin_page (builder);
11461159
nemo_file_management_properties_dialog_setup_templates_page (builder);
1160+
nemo_file_management_properties_dialog_setup_keybindings_page (builder);
11471161

11481162

11491163
setup_configurable_menu_items (builder);

src/nemo-icon-view.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2336,7 +2336,7 @@ button_press_callback (GtkWidget *widget, GdkEventFocus *event, gpointer user_da
23362336
GdkEventButton *event_button = (GdkEventButton *)event;
23372337
gint selection_count = nemo_view_get_selection_count (NEMO_VIEW (view));
23382338

2339-
if (!nemo_view_get_active (view) && selection_count > 0) {
2339+
if (!nemo_view_get_active (view)) {
23402340
NemoWindowSlot *slot = nemo_view_get_nemo_window_slot (view);
23412341
nemo_window_slot_make_hosting_pane_active (slot);
23422342
return GDK_EVENT_STOP;

0 commit comments

Comments
 (0)