1-click open directories in Dolphin without Plasma

The setting to toggle single/double click behavior isn’t built into Dolphin itself. Rather, it’s configured globally for the entire plasma desktop. If you’re actually using KDE Plasma as your DE, you can simply change it in the graphical system settings app. I’m not using plasma, so I manually updated ~/.config/kdeglobals, with the following text:

[KDE]
SingleClick=true

However, without plasma, the changes won’t automatically apply to Dolphin. I needed to take another couple extra steps:

  1. Install kdePackages.plasma-integration
  2. Set the environment variable QT_QPA_PLATFORMTHEME='kde'

Putting it all together, here’s the home manager setup I came up with:

home.packages = with pkgs.kdePackages; [
  dolphin
  breeze # Nice to have for theming
  plasma-integration
];

home.file."${config.xdg.configHome}/kdeglobals".text = ''
[KDE]
SingleClick=true
'';

Now, executing QT_QPA_PLATFORMTHEME='kde' dolphin, I’m able to enter directories without double-clicking.

Update: I’ve moved this configuration to a system module (rather than Home Manager) and added support for opening files in their appropriate application when clicked.

{ config, pkgs, lib, ... }:

# NOTE: This file contains somewhat horrifying workarounds for proper file assocation and 1-click open functionality

let
  # Based on the following commit, with edits:
  # https://github.com/rumboon/dolphin-overlay/commit/f2a50da28161b1ed96a7999a5ce570f80392543a
  pkgsDolphinOverlay = pkgs.extend (final: prev: {
    kdePackages = prev.kdePackages.overrideScope (kfinal: kprev: {
      dolphin = prev.symlinkJoin {
        name = "dolphin-wrapped";
        paths = [ kprev.dolphin ];
        nativeBuildInputs = [ prev.makeWrapper ];
        # Set XDG_CONFIG_DIRS to ensure environment.etc configs are respected
        # Set QT_QPA_PLATFORMTHEME for 1-click open
        # Run kbuildsycoca6 for file assocation MIME type cache
        postBuild = ''
          rm $out/bin/dolphin
          makeWrapper ${kprev.dolphin}/bin/dolphin $out/bin/dolphin \
            --set XDG_CONFIG_DIRS "/etc/xdg/:$XDG_CONFIG_DIRS" \
            --set QT_QPA_PLATFORMTHEME "kde" \
            --run "${kprev.kservice}/bin/kbuildsycoca6"
        '';
      };
    });
  });
in
{
  environment.systemPackages = with pkgsDolphinOverlay.kdePackages; [
    dolphin

    # For mounting drives within Dolphin
    kio
    kio-fuse
    kio-extras
    kio-admin

    # For the integrated terminal panel
    konsole

    # For 1-click open
    plasma-integration
  ];

  # For 1-click open
  environment.etc."xdg/kdeglobals".text = ''
  [KDE]
  SingleClick=true

  [UiSettings]
  ColorScheme=*
  '';

  # For file assocations
  #
  # Based on the following commit:
  # https://github.com/qweered/hyprnixos/commit/d53c18bdf51838b8268de282d25bdfc1bbfcdf39
  environment.etc."xdg/menus/applications.menu".source = ./dolphin.menu;

}

If you use this configuration, be sure to drop the dolphin.menu in the same directory as the module: https://raw.githubusercontent.com/qweered/hyprnixos/d53c18bdf51838b8268de282d25bdfc1bbfcdf39/modules/system/dolphin.menu

See https://github.com/NixOS/nixpkgs/issues/409986#issuecomment-3931363516

1 Like