Skip to content

Commit 492c02e

Browse files
committed
add custom plugin ToolTip on result hover over
1 parent 3fa3090 commit 492c02e

File tree

5 files changed

+26
-4
lines changed

5 files changed

+26
-4
lines changed

Flow.Launcher.Plugin/Result.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,15 @@ public Result() { }
130130
/// Plugin ID that generated this result
131131
/// </summary>
132132
public string PluginID { get; internal set; }
133+
134+
/// <summary>
135+
/// Show message as ToolTip on result Title hover over
136+
/// </summary>
137+
public string TitleToolTip { get; set; }
138+
139+
/// <summary>
140+
/// Show message as ToolTip on result SubTitle hover over
141+
/// </summary>
142+
public string SubTitleToolTip { get; set; }
133143
}
134144
}

Flow.Launcher/ResultListBox.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
</TextBlock>
6363
</StackPanel>
6464
<TextBlock Style="{DynamicResource ItemTitleStyle}" DockPanel.Dock="Left"
65-
VerticalAlignment="Center" ToolTip="{Binding Result.Title}" x:Name="Title"
65+
VerticalAlignment="Center" ToolTip="{Binding ShowTitleToolTip}" x:Name="Title"
6666
Text="{Binding Result.Title}">
6767
<vm:ResultsViewModel.FormattedText>
6868
<MultiBinding Converter="{StaticResource HighlightTextConverter}">
@@ -71,7 +71,7 @@
7171
</MultiBinding>
7272
</vm:ResultsViewModel.FormattedText>
7373
</TextBlock>
74-
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" ToolTip="{Binding Result.SubTitle}"
74+
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" ToolTip="{Binding ShowSubTitleToolTip}"
7575
Grid.Row="1" x:Name="SubTitle" Text="{Binding Result.SubTitle}" MinWidth="750">
7676
<vm:ResultsViewModel.FormattedText>
7777
<MultiBinding Converter="{StaticResource HighlightTextConverter}">

Flow.Launcher/ViewModel/ResultViewModel.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ public ResultViewModel(Result result, Settings settings)
2929

3030
public string OpenResultModifiers => Settings.OpenResultModifiers;
3131

32+
public string ShowTitleToolTip => string.IsNullOrEmpty(Result.TitleToolTip)
33+
? Result.Title
34+
: Result.TitleToolTip;
35+
36+
public string ShowSubTitleToolTip => string.IsNullOrEmpty(Result.SubTitleToolTip)
37+
? Result.SubTitle
38+
: Result.SubTitleToolTip;
39+
3240
public ImageSource Image
3341
{
3442
get

Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal static class Constants
1616
internal const string DifferentUserIconImagePath = "Images\\user.png";
1717
internal const string IndexingOptionsIconImagePath = "Images\\windowsindexingoptions.png";
1818

19-
internal const string DefaultFolderSubtitleString = "Ctrl + Enter to open the directory";
19+
internal const string ToolTipOpenDirectory = "Ctrl + Enter to open the directory";
2020

2121
internal const char AllFilesFolderSearchWildcard = '>';
2222

Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ internal Result CreateFolderResult(string title, string subtitle, string path, Q
3838
return false;
3939
}
4040
}
41-
41+
4242
string changeTo = path.EndsWith(Constants.DirectorySeperator) ? path : path + Constants.DirectorySeperator;
4343
context.API.ChangeQuery(string.IsNullOrEmpty(query.ActionKeyword) ?
4444
changeTo :
4545
query.ActionKeyword + " " + changeTo);
4646
return false;
4747
},
48+
TitleToolTip = Constants.ToolTipOpenDirectory,
49+
SubTitleToolTip = Constants.ToolTipOpenDirectory,
4850
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = path, ShowIndexState = showIndexState, WindowsIndexed = windowsIndexed }
4951
};
5052
}
@@ -85,6 +87,8 @@ internal Result CreateOpenCurrentFolderResult(string path, bool windowsIndexed =
8587
FilesFolders.OpenPath(retrievedDirectoryPath);
8688
return true;
8789
},
90+
TitleToolTip = Constants.ToolTipOpenDirectory,
91+
SubTitleToolTip = Constants.ToolTipOpenDirectory,
8892
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = retrievedDirectoryPath, ShowIndexState = true, WindowsIndexed = windowsIndexed }
8993
};
9094
}

0 commit comments

Comments
 (0)