|
|
||
Restoring Kate Projects and Window Focus© Copyright Darrell Anderson. I was fairly content with Kate, the high-end text editor packaged with KDE, until Kate was modified in a horrific way in KDE 3.5.x. I have shared my frustrations here and here. The sessions idea crippled the multiple document interface (MDI) of Kate. The problem is that opening a document in Kate from outside of Kate (from the command line or from within Konqueror) will indeed select Kate, but the Kate window either never receives the focus or never rises to the front of the screen. Nothing I have tried has succeeded in forcing Kate to both receive the focus and rise to the front of the desktop. Usage is always an either-or dilemma and the KDE developers have had six opportunities ( KDE 3.5.1 through 3.5.6) to remedy this bug. They have not. There is a --use option that is supposed to solve the problems, but that option does not work. Kate became almost unusable to me. In my frustration and anger I began to brainstorm and eventually wonder whether I could use Kate from KDE 3.4.3 (version 2.4.1) rather than the version packaged with KDE 3.5.x (2.5.x). I still had a copy of KDE 3.4.3 installed and when I used that version of KDE then Kate functioned just fine. Some trial and error proved my idea a success. I now am able to use Kate 2.4.1 within the KDE 3.5.x desktop and with subsequent usage I notice no significant errors or issues. Kate now always opens with both the focus and rising to the front of the screen. There no longer are any sessions, instead projects are available. Using that older version also means that the small widgets (close and docking) in the side components of Kate are once again available. Just as pleasing, because the sessions model is no longer used, I no longer have issues with my most recently used (MRU) file list. Under the sessions model the MRU is specific to each session defined. Bear in mind that my solution provided here is, fundamentally, a work-around. With each updating of KDE the work-around has to be re-implemented. Yet that is a small sacrifice for eliminating the flawed and broken sessions model of Kate. To avoid some of the hassles I have written this mini how-to and a shell script to help automate reinstalling the older version of Kate. I admit my solution means forever using the older version of Kate, unless Kate in KDE 4.x is repaired. Yet in Windows I continue to use older software that “just works” and I seem to never miss the “latest and greatest.” I only wanted an MDI text editor with syntax highlighting and some basic features and the older version of Kate provides that. Are any KDE developers listening? Do they even care? * * * There are two ways to maintain the older Kate files. One method is modifying the existing $KDEDIR files. The second method is modifying some of those files while also maintaining the older Kate files in a separate directory. KDE supports multiple $KDEDIR directories in a separate environment variable called $KDEDIRS (notice the appending S). See the KDE documentation for details. At a command line type echo $KDEDIR to learn the root path to the KDE files. Most distros do not come packaged with secondary directories or a $KDEDIRS variable as this is usually a local customization task. Although not required for this project, adding that second location does render things more manageable. To house some additional KDE modifications in Slackware, I merely added a kde2.sh script to /etc/profile.d. As a side note, adding that second KDE directory is a great way to globalize various KDE changes. I disagree with some of the decisions the KDE people make about the KDE desktop. Although running Control Center will add these changes to each user’s $HOME/.kde directories, moving those same changes to a second KDE directory handily globalizes the modifications for all users. Theoretically, KDE is supposed to follow the precedence order of the directories in the $KDEDIRS variable, but I have noticed exceptions to that programming rule affecting this mini how-to. Therefore I have opted to modify a few of the underlying $KDEDIR files. Fortunately there are only a handful of files that must be modified to restore or reinstall the older version of Kate: Files to modify: $KDEDIR/bin/kate Notice in the $KDEDIR/lib directory that there are many symbolic links. Those files need not be modified. Leave them as is. Only modify the target file of the links. Files from KDE 3.4.3 to add. These files are more easily managed if placed in a second KDE directory rather than copying over the stock KDE 3.5.x files: $KDEDIR/lib/kde3/katedefaultprojectplugin.la Finally, after restoring Kate from KDE 3.4.3, if necessary, be sure to edit $KDEDIR/share/applications/kde/kate.desktop to remove the --use syntax. As good practice, a reasonable approach is not to replace the files indiscriminately, but to rename the existing KDE 3.5.x files and then copy the older Kate files. That way, for whatever reason, restoring to the original KDE 3.5.x status is more straightforward. In the attached shell script I wrote to support my own effort, I merely appended the KDE version to the file name to help me identify those files. The associated shell script is liberally commented and provides additional details about the process. Manually modifying KDE is fine for a one-time event, but I wanted a script to help me for future updates of KDE because I knew I then would have to repeat this process. You’ll need the Kate files from KDE 3.4.3 and they are available here in a tar.gz format. The directory tree structure of the tar.gz follows the usual KDE directory tree structure. If you are a point-and-click user you probably could use Konqueror to copy the files from the uncompressed tar.gz file and paste the files in the $KDEDIR directory tree, and thereby overwrite all existing files. But first renaming the existing files, which the associated script supports, is a nice way to provide a recovery path should the poop hit the fan. After downloading, end-users need to modify the script variables according to how their distro installs KDE, where they want to unpack the tar.gz files, and how they want to maintain the older Kate files. Users can run the script from within KDE and Konsole, but be sure not to have Kate running concurrently. To my knowledge, users need not restart KDE after reverting to the older Kate. I make no claim to fully understanding the underlying KDE design and structure, nor am I a skilled script writer. Quite possibly, some of these files do not need to be modified from the older Kate files and the existing KDE 3.5.x files will function fine. Yet I took a conservative approach and replaced the files. Surprisingly, however, that is all there is to do to revert to the older Kate. I was surprised at how straightforward the reversion was and more than pleased with the results. Kate now once again behaves appropriately. I welcome any improvements to this mini how-to. kate-3.4.3-files.tar.gz (903 KB) kate-revert (associated shell script) kde2.sh (sample /etc/profile.d script to modify KDE environment variables) Finis. |
||