diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp
index 5298435f21..b80d8938f0 100644
--- a/common/eda_base_frame.cpp
+++ b/common/eda_base_frame.cpp
@@ -531,7 +531,15 @@ void EDA_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
 
     // Save the recently used files list
     if( m_fileHistory )
+    {
+        // Save the currently opened file in the file history
+        wxString currentlyOpenedFile = GetCurrentFileName();
+
+        if( !currentlyOpenedFile.IsEmpty() )
+            UpdateFileHistory( currentlyOpenedFile );
+
         m_fileHistory->Save( *aCfg );
+    }
 }
 
 
diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp
index 1e80c265e0..65959dc868 100644
--- a/eeschema/sch_edit_frame.cpp
+++ b/eeschema/sch_edit_frame.cpp
@@ -1224,3 +1224,14 @@ void SCH_EDIT_FRAME::ConvertTimeStampUuids()
 
     timeStampSheetPaths.ReplaceLegacySheetPaths( oldSheetPaths );
 }
+
+
+wxString SCH_EDIT_FRAME::GetCurrentFileName() const
+{
+    SCH_SCREEN* screen = g_RootSheet->GetScreen();
+
+    if( screen )
+        return screen->GetFileName();
+
+    return wxEmptyString;
+}
diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h
index 59c5db71bc..441943d8ac 100644
--- a/eeschema/sch_edit_frame.h
+++ b/eeschema/sch_edit_frame.h
@@ -567,6 +567,8 @@ public:
 
     bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
 
+    wxString GetCurrentFileName() const override;
+
     void ParseArgs( wxCmdLineParser& aParser ) override;
 
     /**
diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h
index bb3d822453..eb5a37b64e 100644
--- a/include/eda_base_frame.h
+++ b/include/eda_base_frame.h
@@ -408,6 +408,14 @@ public:
 
     wxString GetMruPath() const { return m_mruPath; }
 
+    /**
+     * Get the full filename + path of the currently opened file in the frame.
+     * If no file is open, an empty string is returned.
+     *
+     * @return the filename and full path to the open file
+     */
+    virtual wxString GetCurrentFileName() const { return wxEmptyString; }
+
     /**
      * Recreates the menu bar.
      *
diff --git a/kicad/kicad_manager_frame.cpp b/kicad/kicad_manager_frame.cpp
index 67132e3b77..5d5af884dc 100644
--- a/kicad/kicad_manager_frame.cpp
+++ b/kicad/kicad_manager_frame.cpp
@@ -215,7 +215,7 @@ void KICAD_MANAGER_FRAME::SetProjectFileName( const wxString& aFullProjectProFil
 }
 
 
-const wxString KICAD_MANAGER_FRAME::GetProjectFileName()
+const wxString KICAD_MANAGER_FRAME::GetProjectFileName() const
 {
     return  Prj().GetProjectFullName();
 }
@@ -310,10 +310,6 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
 
     if( Kiway().PlayersClose( false ) )
     {
-        // Save the currently opened file in the file history
-        if( !GetProjectFileName().empty() )
-            UpdateFileHistory( GetProjectFileName() );
-
         Event.SetCanVeto( true );
 
         m_leftWin->Show( false );
diff --git a/kicad/kicad_manager_frame.h b/kicad/kicad_manager_frame.h
index ff0b323e5b..45a987b25d 100644
--- a/kicad/kicad_manager_frame.h
+++ b/kicad/kicad_manager_frame.h
@@ -97,6 +97,11 @@ public:
     void RecreateBaseHToolbar();
     void RecreateLauncher();
 
+    wxString GetCurrentFileName() const override
+    {
+        return GetProjectFileName();
+    }
+
     /**
      *  Open dialog to import Eagle schematic and board files.
      */
@@ -153,7 +158,7 @@ public:
     void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
 
     void SetProjectFileName( const wxString& aFullProjectProFileName );
-    const wxString GetProjectFileName();
+    const wxString GetProjectFileName() const;
 
     // read only accessors
     const wxString SchFileName();
diff --git a/pagelayout_editor/design_inspector.cpp b/pagelayout_editor/design_inspector.cpp
index c05432db7f..3b9d7f280c 100644
--- a/pagelayout_editor/design_inspector.cpp
+++ b/pagelayout_editor/design_inspector.cpp
@@ -207,7 +207,7 @@ void DIALOG_INSPECTOR::ReCreateDesignList()
 
     WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
 
-    wxFileName      fn( ((PL_EDITOR_FRAME*) GetParent())->GetCurrFileName() );
+    wxFileName      fn( ((PL_EDITOR_FRAME*) GetParent())->GetCurrentFileName() );
 
     if( fn.GetName().IsEmpty() )
         SetTitle( "<default page layout>" );
diff --git a/pagelayout_editor/files.cpp b/pagelayout_editor/files.cpp
index 185eff7c4d..669a239677 100644
--- a/pagelayout_editor/files.cpp
+++ b/pagelayout_editor/files.cpp
@@ -90,7 +90,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
 {
     wxString       msg;
     int            id = event.GetId();
-    wxString       filename = GetCurrFileName();
+    wxString       filename = GetCurrentFileName();
     WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
 
     if( filename.IsEmpty() && id == wxID_SAVE )
@@ -110,7 +110,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
     {
     case wxID_NEW:
         pglayout.AllowVoidList( true );
-        SetCurrFileName( wxEmptyString );
+        SetCurrentFileName( wxEmptyString );
         pglayout.ClearList();
         OnNewPageLayout();
         break;
@@ -207,8 +207,8 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
             msg.Printf( _("File \"%s\" written"), GetChars( filename ) );
             SetStatusText( msg );
 
-            if( GetCurrFileName().IsEmpty() )
-                SetCurrFileName( filename );
+            if( GetCurrentFileName().IsEmpty() )
+                SetCurrentFileName( filename );
         }
     }
         break;
@@ -225,7 +225,7 @@ bool PL_EDITOR_FRAME::LoadPageLayoutDescrFile( const wxString& aFullFileName )
     if( wxFileExists( aFullFileName ) )
     {
         WS_DATA_MODEL::GetTheInstance().SetPageLayout( aFullFileName );
-        SetCurrFileName( aFullFileName );
+        SetCurrentFileName( aFullFileName );
         UpdateFileHistory( aFullFileName );
         GetScreen()->ClrModify();
         return true;
diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp
index efc674eeb2..178af7e126 100644
--- a/pagelayout_editor/pl_editor_frame.cpp
+++ b/pagelayout_editor/pl_editor_frame.cpp
@@ -282,7 +282,7 @@ void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
 
     if( IsContentModified() )
     {
-        wxFileName filename = GetCurrFileName();
+        wxFileName filename = GetCurrentFileName();
         wxString msg = _( "Save changes to \"%s\" before closing?" );
 
         if( !HandleUnsavedChanges( this, wxString::Format( msg, filename.GetFullName() ),
@@ -449,7 +449,7 @@ void PL_EDITOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
 void PL_EDITOR_FRAME::UpdateTitleAndInfo()
 {
     wxString title;
-    wxString file = GetCurrFileName();
+    wxString file = GetCurrentFileName();
 
     title.Printf( _( "Page Layout Editor" ) + wxT( " \u2014 %s" ),
                   file.Length() ? file : _( "no file selected" ) );
@@ -457,13 +457,13 @@ void PL_EDITOR_FRAME::UpdateTitleAndInfo()
 }
 
 
-const wxString& PL_EDITOR_FRAME::GetCurrFileName() const
+wxString PL_EDITOR_FRAME::GetCurrentFileName() const
 {
     return BASE_SCREEN::m_PageLayoutDescrFileName;
 }
 
 
-void PL_EDITOR_FRAME::SetCurrFileName( const wxString& aName )
+void PL_EDITOR_FRAME::SetCurrentFileName( const wxString& aName )
 {
     BASE_SCREEN::m_PageLayoutDescrFileName = aName;
 }
@@ -774,7 +774,7 @@ void PL_EDITOR_FRAME::OnNewPageLayout()
 
     m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
 
-    if( GetCurrFileName().IsEmpty() )
+    if( GetCurrentFileName().IsEmpty() )
     {
         // Default shutdown reason until a file is loaded
         SetShutdownBlockReason( _( "New page layout file is unsaved" ) );
diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h
index e0bb3108b8..138eee6c89 100644
--- a/pagelayout_editor/pl_editor_frame.h
+++ b/pagelayout_editor/pl_editor_frame.h
@@ -259,12 +259,12 @@ public:
      * If this is the default (no loaded file) returns a emtpy name
      * or a new design.
      */
-    const wxString& GetCurrFileName() const;
+    wxString GetCurrentFileName() const override;
 
     /**
      * Stores the current layout descr file filename
      */
-    void SetCurrFileName( const wxString& aName );
+    void SetCurrentFileName( const wxString& aName );
 
     /**
      * Refresh the library tree and redraw the window
diff --git a/pagelayout_editor/tools/pl_editor_control.cpp b/pagelayout_editor/tools/pl_editor_control.cpp
index 9ccfc938a9..ddda4e5310 100644
--- a/pagelayout_editor/tools/pl_editor_control.cpp
+++ b/pagelayout_editor/tools/pl_editor_control.cpp
@@ -88,7 +88,7 @@ int PL_EDITOR_CONTROL::PageSetup( const TOOL_EVENT& aEvent )
     m_frame->SaveCopyInUndoList( true );
 
     DIALOG_PAGES_SETTINGS dlg( m_frame, wxSize( MAX_PAGE_SIZE_MILS, MAX_PAGE_SIZE_MILS ) );
-    dlg.SetWksFileName( m_frame->GetCurrFileName() );
+    dlg.SetWksFileName( m_frame->GetCurrentFileName() );
     dlg.EnableWksFileNamePicker( false );
 
     if( dlg.ShowModal() != wxID_OK )
diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp
index cea6011741..8cf646c960 100644
--- a/pcbnew/pcb_edit_frame.cpp
+++ b/pcbnew/pcb_edit_frame.cpp
@@ -1257,3 +1257,9 @@ void PCB_EDIT_FRAME::OnExportHyperlynx( wxCommandEvent& event )
 
     ExportBoardToHyperlynx( GetBoard(), fn );
 }
+
+
+wxString PCB_EDIT_FRAME::GetCurrentFileName() const
+{
+    return GetBoard()->GetFileName();
+}
diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h
index 230dc18b94..01c08f0358 100644
--- a/pcbnew/pcb_edit_frame.h
+++ b/pcbnew/pcb_edit_frame.h
@@ -952,6 +952,8 @@ public:
 
     void SyncToolbars() override;
 
+    wxString GetCurrentFileName() const override;
+
     DECLARE_EVENT_TABLE()
 };