Index: nagelfar.tcl
--- nagelfar.tcl.orig
+++ nagelfar.tcl
@@ -50,15 +50,13 @@ while {[file type $tmplink] == "link"} {
 unset tmplink
 
 # This makes it possible to customize where files are installed
-set dbDir      $thisDir
-set docDir     $thisDir/doc
+set dbDir      [file join [file dirname [::tcl::pkgconfig get libdir,install]] libdata nagelfar]
+set docDir     [file join [file dirname [::tcl::pkgconfig get libdir,install]] share doc nagelfar]
 set libDir     $thisDir/lib
  
 # Search where the script is, to be able to place e.g. ctext there.
 if {[info exists ::starkit::topdir]} {
     lappend auto_path [file dirname [file normalize $::starkit::topdir]]
-} else {
-    lappend auto_path $libDir
 }
 set version "Version 1.3.2 2021-02-02"
 #----------------------------------------------------------------------
@@ -6475,14 +6473,7 @@ proc addOptionsMenu {m} {
 #----------------------------------------------------------------------
 
 proc PluginSearchPath {} {
-    set dirs [list . ./plugins]
-    lappend dirs [file join $::thisDir .. ..]
-    lappend dirs [file join $::thisDir .. .. plugins]
-    lappend dirs [file join $::thisDir .. plugins]
-    foreach d $::Nagelfar(pluginPath) {
-        lappend dirs $d
-    }
-    return $dirs
+    return [list . ./nagelfar_plugins ~/nagelfar_plugins {*}$::Nagelfar(pluginPath)]
 }
 
 # Locate plugin source
