Skip to content

Commit 6867b87

Browse files
committed
Disk: disable hyperlink by default and move it to custom keys
1 parent cb13d43 commit 6867b87

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

src/modules/disk/disk.c

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,42 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk, uint32_t index
1515

1616
if(options->moduleArgs.key.length == 0)
1717
{
18-
if(instance.config.display.pipe)
19-
ffStrbufAppendF(&key, "%s (%s)", FF_DISK_MODULE_NAME, disk->mountpoint.chars);
20-
else
18+
ffStrbufSetF(&key, "%s (%s)", FF_DISK_MODULE_NAME, disk->mountpoint.chars);
19+
}
20+
else
21+
{
22+
FF_STRBUF_AUTO_DESTROY mountpointLink = ffStrbufCreate();
23+
FF_STRBUF_AUTO_DESTROY nameLink = ffStrbufCreate();
24+
#ifdef __linux__
25+
if (getenv("WSL_DISTRO_NAME") != NULL && getenv("WT_SESSION") != NULL)
2126
{
22-
#ifdef __linux__
23-
if (getenv("WSL_DISTRO_NAME") != NULL && getenv("WT_SESSION") != NULL)
27+
if (ffStrbufEqualS(&disk->filesystem, "9p") && ffStrbufStartsWithS(&disk->mountpoint, "/mnt/"))
2428
{
25-
if (ffStrbufEqualS(&disk->filesystem, "9p") && ffStrbufStartsWithS(&disk->mountpoint, "/mnt/"))
26-
ffStrbufAppendF(&key, "%s (\e]8;;file:///%c:/\e\\%s\e]8;;\e\\)", FF_DISK_MODULE_NAME, disk->mountpoint.chars[5], disk->mountpoint.chars);
27-
else
28-
ffStrbufAppendF(&key, "%s (\e]8;;file:////wsl.localhost/%s%s\e\\%s\e]8;;\e\\)", FF_DISK_MODULE_NAME, getenv("WSL_DISTRO_NAME"), disk->mountpoint.chars, disk->mountpoint.chars);
29+
ffStrbufSetF(&mountpointLink, "\e]8;;file:///%c:/\e\\%s\e]8;;\e\\", disk->mountpoint.chars[5], disk->mountpoint.chars);
30+
ffStrbufSetF(&nameLink, "\e]8;;file:///%c:/\e\\%s\e]8;;\e\\", disk->mountpoint.chars[5], disk->name.chars);
2931
}
3032
else
31-
#endif
32-
ffStrbufAppendF(&key, "%s (\e]8;;file://%s\e\\%s\e]8;;\e\\)", FF_DISK_MODULE_NAME, disk->mountpoint.chars, disk->mountpoint.chars);
33+
{
34+
ffStrbufSetF(&mountpointLink, "\e]8;;file:////wsl.localhost/%s%s\e\\%s\e]8;;\e\\", getenv("WSL_DISTRO_NAME"), disk->mountpoint.chars, disk->mountpoint.chars);
35+
ffStrbufSetF(&nameLink, "\e]8;;file:////wsl.localhost/%s%s\e\\%s\e]8;;\e\\", getenv("WSL_DISTRO_NAME"), disk->mountpoint.chars, disk->name.chars);
36+
}
3337
}
34-
}
35-
else
36-
{
38+
else
39+
#endif
40+
{
41+
ffStrbufSetF(&mountpointLink, "\e]8;;file://%s\e\\%s\e]8;;\e\\", disk->mountpoint.chars, disk->mountpoint.chars);
42+
ffStrbufSetF(&nameLink, "\e]8;;file://%s\e\\%s\e]8;;\e\\", disk->mountpoint.chars, disk->name.chars);
43+
}
44+
3745
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, ((FFformatarg[]) {
3846
FF_FORMAT_ARG(disk->mountpoint, "mountpoint"),
3947
FF_FORMAT_ARG(disk->name, "name"),
4048
FF_FORMAT_ARG(disk->mountFrom, "mount-from"),
4149
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
4250
FF_FORMAT_ARG(index, "index"),
51+
FF_FORMAT_ARG(disk->filesystem, "filesystem"),
52+
FF_FORMAT_ARG(mountpointLink, "mountpoint-link"),
53+
FF_FORMAT_ARG(nameLink, "name-link"),
4354
}));
4455
}
4556

0 commit comments

Comments
 (0)