Closed tomgeraghty3 closed 2 years ago
@tomgeraghty3 can you share your theme? The default ones do not have any tooltips enabled so that's expected behaviour. When I validate using my personal config, it works.
@JanDeDobbeleer Sorry I wasn't clear. I meant I took the default config and added tooltips to them, thus ruling out that it was a problem with my config. But here is my config:
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"vertical_offset": 1,
"segments": [
{
"type": "os",
"style": "diamond",
"leading_diamond": "",
"trailing_diamond": "<,#c386f1></>",
"foreground": "#ffffff",
"background": "#003543",
"properties": {
"prefix": "",
"windows": " ",
"postfix": ""
}
},
{
"type": "session",
"style": "powerline",
"foreground": "#ffffff",
"background": "#c386f1",
"properties": {
"prefix": " ",
"display_host": false
}
},
{
"type": "path",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#003544",
"background": "#0087D8",
"properties": {
"prefix": " ",
"style": "full",
"folder_separator_icon": "/"
}
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#193549",
"background": "#d2ff5e",
"properties": {
"display_stash_count": true,
"display_upstream_icon": true,
"status_colors_enabled": true,
"display_status": true,
"local_changes_color": "#ff9248",
"ahead_and_behind_color": "#f26d50",
"behind_color": "#f17c37",
"ahead_color": "#89d1dc",
"stash_count_icon": " "
}
}
]
},
{
"type": "rprompt",
"segments": [
{
"type": "exit",
"style": "diamond",
"invert_powerline": false,
"foreground": "#000000",
"background": "#95ffa4",
"leading_diamond": "",
"trailing_diamond": "<,#83769c></>",
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "#f1184c",
"color_background": true,
"prefix": ""
}
},
{
"type": "executiontime",
"style": "diamond",
"invert_powerline": true,
"leading_diamond": "",
"trailing_diamond": "<,#2e9599></>",
"foreground": "#ffffff",
"background": "#83769c",
"properties": {
"always_enabled": true,
"prefix": " 羽",
"postfix": "⠀"
}
},
{
"type": "time",
"style": "diamond",
"invert_powerline": true,
"trailing_diamond": "",
"background": "#2e9599",
"foreground": "#111111",
"properties": {
"time_format": "3:04:05 PM"
}
}
]
},
{
"type": "prompt",
"alignment": "left",
"newline": true,
"segments": [
{
"type": "root",
"style": "plain",
"foreground": "#fff",
"properties": {
"root_icon": "⚡"
}
},
{
"type": "text",
"style": "plain",
"foreground": "#f1184c",
"properties": {
"prefix": "",
"text": "🦄"
}
}
]
}
],
"tooltips": [
{
"type": "git",
"tips": [
"git",
"g"
],
"style": "diamond",
"foreground": "#193549",
"background": "#fffb38",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"display_status": true,
"display_upstream_icon": true,
"status_colors_enabled": true,
"local_changes_color": "#ff9248",
"ahead_and_behind_color": "#f26d50",
"behind_color": "#f17c37",
"ahead_color": "#89d1dc"
}
},
{
"type": "java",
"tips": [
"java",
"j"
],
"style": "diamond",
"foreground": "#193549",
"background": "#fffb38",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"display_status": true,
"display_upstream_icon": true,
"status_colors_enabled": true,
"local_changes_color": "#ff9248",
"ahead_and_behind_color": "#f26d50",
"behind_color": "#f17c37",
"ahead_color": "#89d1dc"
}
},
{
"type": "aws",
"tips": [
"aws"
],
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#FFA400",
"properties": {
"prefix": " ",
"template": "{{.Profile}}{{if .Region}}@{{.Region}}{{end}}"
}
},
{
"tips": [
"azure",
"az"
],
"type": "azfunc",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#FEAC19",
"properties": {
"prefix": " ",
"display_version": true,
"display_mode": "always"
}
},
{
"tips": [
"dart"
],
"type": "dart",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#06A4CE",
"properties": {
"prefix": " ",
"display_mode": "always",
"missing_command_text": ""
}
},
{
"tips": [
"dotnet"
],
"type": "dotnet",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#000000",
"background": "#00ffff",
"properties": {
"prefix": " ",
"display_mode": "always",
"unsupported_version_icon": " {not installed}"
}
}
],
"final_space": true
}
@tomgeraghty3 I just validated with your config but everything works, so nothing wrong there. Can you share your $PROFILE
?
@JanDeDobbeleer Yeah sure:
Import-Module -Name Terminal-Icons
oh-my-posh --init --shell pwsh --config ~/oh-my-posh.json | Invoke-Expression
Enable-PoshTooltips
function explore([string]$path)
{
explorer "$path"
}
Set-Alias -Name ll -Value Get-ChildItem
@tomgeraghty3 I just tried with your config and the latest changes and it all works. So, no way to reproduce the issue here.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
Hi @JanDeDobbeleer ,
Happy new year.
I got a new laptop over the holidays and the same thing has happened! It worked the very first time I used "Enable-PoshTooltips" but then in every subsequent load of $PROFILE after the tooltips have stopped working. I even tried taking it out my $PROFILE and manually typing in Windows Terminal but the same thing happens. Do you have any suggests or any log files I can look at etc? Maybe it's something I'm doing wrong because it's happened on 2 separate machines now. I'm using the Install-Module oh-my-posh -Scope CurrentUser
method rather than e.g. winget, is that part of it I'm just not sure where to go :(
@tomgeraghty3 shouldn't be a difference in installation method as the functionality is added from oh-my-posh and not module specific. It sets a read handler in the spacebar using PSReadline: Set-PSReadlineKeyHandler -Key SpaceBar {}
, so the only thing I can think of is that either that one isn't up to date, or you have another handler that overrides it somehow?
Hi, if I run Get-PSReadLineKeyHandler
before Enable-Poshtooltips
I can see no custom handlers for Space then, after running Enable-Poshtooltips
I see:
======================
Key Function Description
--- -------- -----------
Space CustomAction User defined action
at the end of the list - so it looks like it is registering :\
Alright, we'll get to the bottom of it 😅 can you first validate if PSREADLINE is up to date?
@JanDeDobbeleer I've figured it out 🙈🙈🙈...
When I did the original installation I wasn't in my home directory. Then, through my paranoia, I've closed and reopened PowerShell to have a completely "clean" session ( in hindsight using . $PROFILE
would've been a better choice) which defaults to starting in the Home directory. Then I've just read this for java
tooltips:
home_enabled: boolean - display the segment in the HOME folder or not - defaults to false
So after adding "home_enabled": true
to my config the tooltip works as expected!
I ended up pulling down the source code and debugging through to which:
inHomeDir := func() bool {
return l.env.getcwd() == l.env.homeDir()
}
homeEnabled := l.props.getBool(HomeEnabled, l.homeEnabled)
if inHomeDir() && !homeEnabled {
return false
}
was always returning false
...
I'm sorry I wasted your time. I don't know if this is just me being thick but is there a particular motivation for defaulting these to false
? I think if this was on the prompt with other segments and the particular segment didn't appear it would suggest something configuration-wise with that specific segment and point you in the right direction but with tooltips, it just looked like nothing was happening and then I incorrectly assumed it was a "global tooltips" problem.
Is it maybe even worth highlighting on the tooltips documentation page "If the segment you want to use as a tooltip defaults to home_enabled
as false and you try to use the tooltip when in the home directory then nothing will happen and this may cause you to incorrectly assume tooltips aren't working properly".
Maybe that explanation isn't needed but just in case someone has the same issue I had because looking through my config I realised all my "tooltip" segments have home_enabled = false
by default so all the segments were exhibiting the same behaviour causing me to raise this Issue that isn't really an Issue due to misunderstanding.
Thanks for your help/patience.
@tomgeraghty3 the reason this is done is because we received multiple comments about seeing segments in the home directory when they were triggered by config files rather than actual source files.
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Code of Conduct
What happened?
Hi, great work on this I love it! I'm not sure if what I've experienced is a bug but I'm a bit stumped ... I enabled Tooltips (as per docs) and run
Enable-PoshTooltips
in my Profile for Powershell and everything worked brilliantly. I then started messing with the segments/colours and once I was happy with that I noticed that my tooltips stopped working. Thinking it might be something theme/config-specific I reverted my JSON file to match your JSON config but the problem still persists. Is there a way I can see logs? I had a look at the .exe and ran with--help
but couldn't see anything. I've also tried uninstalling and reinstallingoh-my-posh
Version
5.16.2
Theme
A custom theme just now but I also experience the issue using any of the inbuilt themes
What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Relevant log output
No response