Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change text of tooltips for custom modules? #2914

Closed
bybrl opened this issue Feb 13, 2024 · 4 comments
Closed

How to change text of tooltips for custom modules? #2914

bybrl opened this issue Feb 13, 2024 · 4 comments

Comments

@bybrl
Copy link

bybrl commented Feb 13, 2024

I use this config, but want to use the supplied text instead of the icon while hovering the module.

{
    "layer": "top",
    "position": "top",
    "spacing": 0,
    "height": 34,
    "modules-left": [
        "custom/logo",
        "hyprland/workspaces","custom/launcher", 
        "custom/kitty",  "custom/firefox",
    ],
    "modules-center": [
        "clock",
        "custom/arch"
    ],
    "modules-right": [
        "tray",
        "memory",
        "network",
        "pulseaudio",
        "battery",
        "custom/power"
    ],
    "custom/launcher": {
            "format": "󱗼",
            "tooltip-format": "Wofi drun Menu",
    	    "on-click": "wofi --show drun -I -a -n -W 500 -H 376 -s ~/.config/wofi/themes/dracula.css ",
            "color": "#FF6347",
            "button": true,
        },
        "custom/logo":{
        	"format": "",
        	"tooltip-format": "Full system upgrade",
        	"on-click": "kitty --class float $HOME/.local/share/bin/syu"
        },
        "custom/firefox":{
        	"format": "",
            "on-click": "firefox",
            "tooltip-format": "Firefox web browser",
        },
        "custom/kitty":{
        	"format": "󰄛",
        	"tooltip-format": "Kitty terminal",
        	"on-click": "kitty $HOME"
        },
    "wlr/taskbar": {
        "format": "{icon}",
        "on-click": "activate",
        "on-click-right": "fullscreen",
        "icon-theme": "WhiteSur",
        "icon-size": 25,
        "tooltip-format": "{title}"
    },
    "hyprland/workspaces": {
        "on-click": "activate",
        "format": "{icon}",
        "format-icons": {
            "default": "",
            "1": "1",
            "2": "2",
            "3": "3",
            "4": "4",
            "5": "5",
            "6": "6",
            "7": "7",
            "8": "8",
            "9": "9",
            "active": "󱓻",
            "urgent": "󱓻"
        },
        "persistent_workspaces": {
            "1": [],
            "2": [],
            "3": [],
            "4": [],
            "5": []
        }
    },
    "memory": {
        "interval": 5,
        "format": "󰍛 {}%",
        "max-length": 10
    },
    "tray": {
        "spacing": 10
    },
    "clock": {
    	"timezone": "America/Chicago",
        "tooltip-format": "<tt>{calendar}</tt>",
        "format-alt": "  {:%a, %d %b %Y}",
        "format": "  {:%I:%M %p}"
    },
    "network": {
        "format-wifi" : "{name},{icon}",
        "format-ethernet": "{ipaddr}/{cidr} 󰀂",
        "tooltip-format": "{ifname} via {gwaddr} 󰀂",
    },
    "pulseaudio": {
        "format": "{icon}",
        "format-bluetooth": "󰂰",
        "nospacing": 1,
        "tooltip-format": "Volume : {volume}%",
        "format-muted": "󰝟",
        "format-icons": {
            "headphone": "",
            "default": ["󰖀","󰕾",""]
        },
        "on-click": "pamixer -t",
        "scroll-step": 1
    },
    "battery": {
        "format": "{capacity}% {icon}",
        "format-icons": {
            "charging": [
                "󰢜",
                "󰂆",
                "󰂇",
                "󰂈",
                "󰢝",
                "󰂉",
                "󰢞",
                "󰂊",
                "󰂋",
                "󰂅"
            ],
            "default": [
                "󰁺",
                "󰁻",
                "󰁼",
                "󰁽",
                "󰁾",
                "󰁿",
                "󰂀",
                "󰂁",
                "󰂂",
                "󰁹"
            ]
        },
        "format-full": "Charged ",
        "interval": 5,
        "states": {
            "warning": 20,
            "critical": 10
        },
        "tooltip": false
    },
    "custom/power": {
        "format": "󰤆",
        "tooltip": false,
        "on-click": "~/.config/rofi/powermenu/type-2/powermenu.sh &"
    }
}


Any idea on how this is possible?

@jones-josh
Copy link
Contributor

.. the supplied text ... the module

Which module? What text do you want? Each module has different format specifiers/replacements as per the wiki, and these can be used when the module allows a tooltip-format. You can also enter any arbitrary string in tooltip-format to appear on hover. Please have a look at the corresponding module page on the wiki.

@bybrl
Copy link
Author

bybrl commented Feb 14, 2024

Sorry, to clarify, I wanted the custom/arch, custom/firefox, custom/kitty, and custom/launcher modules to have a custom tooltip, I've used "tooltip-format", but it hasn't worked when I've tried it.

@jones-josh
Copy link
Contributor

jones-josh commented Feb 15, 2024

It seems toolbar-format is not actually defined for custom modules, apologies for the mistake. Whether this will come, making custom module tooltips easier, is an issue, but for now, below is an example script that you can use. This works by returning json from the script with a tooltip value, which is correctly formatted. Explanations for all the fields used are in the wiki's custom page.

~/path/to/script

#!/usr/bin/env bash
printf '{"text": "", "tooltip": "Shutdown on click"}\n'

~/.config/waybar/config

//...
"custom/power-icon": {
    "exec": "$HOME/path/to/script",
    "return-type": "json",
    "interval": "once",
    "format": "{}",
},
//...

Adding on-click and the like to the config's entry does work (I definitely use that one so can confirm).

Edit: While ultimately it was my fault for missing the actual issue at hand, it would have been easier to spot if the question was reduced a little in scope. Next time you have an issue try to include only the relevant parts of the config please and any steps you've taken to try solve the issue already to make the reader's life a little easier 😄

@bybrl
Copy link
Author

bybrl commented Feb 16, 2024

Okay. Marking this as closed.

@bybrl bybrl closed this as completed Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants