Ghostwriter Configuration & Fixes

Summary of fixes for Ghostwriter to resolve NVIDIA Vulkan layer conflicts and force the file browser sidebar to match the current working or document directory instead of defaulting to ~/Documents.

Configuration Files

  • Application Config: /home/simon/.config/kde.org/ghostwriter.conf
  • Sidebar Path Key: folderPath=

Terminal Workflow (Fish Shell)

To ensure launching Ghostwriter from the terminal automatically roots the file sidebar in your current working directory while preserving the NVIDIA graphics workaround, update or create ~/.config/fish/functions/ghostwriter.fish:

function ghostwriter --description 'Launch Ghostwriter with the sidebar rooted in the current directory and bypass breaking NVIDIA Vulkan layers'
    set -l config_file "$HOME/.config/kde.org/ghostwriter.conf"

    # Update the sidebar root folder to the current working directory
    if test -f $config_file
        sed -i "s|^folderPath=.*|folderPath=$PWD|" $config_file
    end

    # Run the application with the NVIDIA Vulkan workaround
    env VK_DRIVER_FILES="" /usr/bin/ghostwriter $argv
end

File Manager Workflow (Dolphin / Desktop Entry)

Because .desktop files cannot execute complex conditional shell logic natively, a wrapper script handles path resolution when double-clicking files in Dolphin.

Launcher Wrapper Script

Save the following script to your local bin directory (e.g., ~/Documents/Git/home-config/bin/ghostwriter-wrapper.sh):

#!/bin/bash
CONFIG_FILE="$HOME/.config/kde.org/ghostwriter.conf"
TARGET_FILE="$1"

# 1. Extract the parent directory if a file is passed; default to $HOME if empty
if [ -n "$TARGET_FILE" ] && [ -e "$TARGET_FILE" ]; then
    TARGET_DIR=$(dirname "$(realpath "$TARGET_FILE")")
else
    TARGET_DIR="$HOME"
fi
# 2. Inject the calculated directory into the Ghostwriter configuration

if [ -f "$CONFIG_FILE" ]; then
    sed -i "s|^folderPath=.*|folderPath=$TARGET_DIR|" "$CONFIG_FILE"
fi

# 3. Launch with the NVIDIA workaround and pass the target file
env VK_DRIVER_FILES="" /usr/bin/ghostwriter "$TARGET_FILE"
Make the script executable:
chmod +x ~/Documents/Git/home-config/bin/ghostwriter-wrapper.sh

Local Desktop Entry Override

Copy the system desktop file to your user directory to prevent package updates from overwriting your changes:

cp /usr/share/applications/org.kde.ghostwriter.desktop ~/.local/share/applications/
Open ~/.local/share/applications/org.kde.ghostwriter.desktop and update the Exec key to target the wrapper script using the %f flag (passes a single file path):
[Desktop Entry]
...
Exec=/home/simon/Documents/Git/home-config/bin/ghostwriter-wrapper.sh %f
...

Refresh Desktop Environment

A simple command will update the changes immediately.

update-desktop-database ~/.local/share/applications/


Posted

16:25 31/05/2026