This works for me in Kubuntu 19.10:
Create the following file in your Desktop folder:
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=---
Exec=dolphin ---
Icon=system-file-manager
Type=Application
X-DocPath=dolphin/index.html
Categories=Qt;KDE;System;FileTools;FileManager;
GenericName=---
Terminal=false
MimeType=inode/directory;
InitialPreference=10
X-DBUS-ServiceName=org.kde.dolphin
StartupWMClass=dolphin
And save it as template.txt.
Now, each time you want to create a folder shortcut on your desktop, edit template.txt and change each occurrence of ---
to whatever is appropriate and save the file with the appropriate prefix with .desktop
as the suffix.
Two examples:
Example 1
This will open your $HOME/Videos
folder:
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=OpenVideos
Exec=dolphin $HOME/Videos
Icon=smtube
Type=Application
X-DocPath=dolphin/index.html
Categories=Qt;KDE;System;FileTools;FileManager;
GenericName=OpenVideos
Terminal=false
MimeType=inode/directory;
InitialPreference=10
X-DBUS-ServiceName=org.kde.dolphin
StartupWMClass=dolphin
Note: I've changed Icon=system-file-manager
to Icon=smtube
. You can give the folders distinctive icons by right-clicking on the icon on your desktop, opening Properties and then, in the window that appears, clicking on the icon itself: doing so will allow you to select an icon.
Example 2
This will open /var/log/apt
:
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=OpenApt-logs
Exec=dolphin /var/log/apt
Icon=system-file-manager
Type=Application
X-DocPath=dolphin/index.html
Categories=Qt;KDE;System;FileTools;FileManager;
GenericName=Apt-logs
Terminal=false
MimeType=inode/directory;
InitialPreference=10
X-DBUS-ServiceName=org.kde.dolphin
StartupWMClass=dolphin
And this is how the .desktop
files in ~/Desktop looks like in konsole:
$ ls -l
total 36
drwxr-xr-x 4 dkb dkb 4096 Jan 2 07:41 ./
drwxr-xr-x 18 dkb dkb 4096 Jan 2 07:19 ../
-rwxrw-r-- 1 dkb dkb 346 Jan 2 07:41 Apt-History.desktop*
-rw-rw-r-- 1 dkb dkb 2414 Sep 28 16:35 autoremove.txt
-rw-r--r-- 1 dkb dkb 50 Sep 28 14:12 .directory
drwxrwxr-x 2 dkb dkb 4096 Sep 28 16:17 MyNext/
drwxrwxr-x 2 dkb dkb 4096 Dec 25 10:15 'New Folder'/
-rwxrw-r-- 1 dkb dkb 345 Jan 2 07:36 OpenVideos.desktop*
$
Of course, there are other ways to open specific folders in Dolphin directly.
One way is to specify keyboard shortcuts to open a specific folder. For example, I've set Ctrl+Meta+N to open my Downloads folder.
Another way is to use Rofi. In the image below, I typed 12
. Pressing Enter now would open ~/.local/share
in Dolphin. Similarly, I could open ~/bin
, ~/.config
, ~/Downloads
, etc. The same screen also lets me launch certain scripts (that don't need to be run from a terminal), and to open documents.