Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
6.8k stars 715 forks source link

[request] format-empty for hyprland/window module? #1995

Closed Fxzzi closed 1 year ago

Fxzzi commented 1 year ago

Hi all, is there a possibility that a format-empty option could be added which allows us to format a module when the it is empty? I'll show an example here:

the module center-right is the hyprland/window module in question. You can see in this screenshot it looks fine.

In this screenshot, you can see that nothing is focused. This causes my bar to look a little off as there is a | seperator with nothing after it. Is there a possibility that this could be added to alleviate issues like these? I have my | seperators set up as a custom module.

This will also probably occur on the tray module I have on the right.

gmr458 commented 1 year ago

I support this, something similar happens when using borders. 20230201_15h41m36s_grim

fybx commented 1 year ago

This issue possibly has the exact root cause as #1934.

noahpolimon commented 1 year ago

i created my own custom module for this but i don't know how to make the output different for multimonitors in the config.

config:

"custom/activewindow": {
    "return-type": "json",
    "format": "{}",
    "tooltip-format": "{}",

        "exec": "sh ~/.config/hypr/scripts/activewindow/active-window.sh",
        "interval": 1,
        "max-length": 40,
    },

active-window.sh:

#!/bin/bash

ACTIVE=$(hyprctl activewindow -j)
TITLE=$(echo $ACTIVE | jq -r '.title')

if [[ "$TITLE" == "null" ]] || [[ "$TITLE" == "" ]]; then
    TEXT=" $(whoami)@$(hostname)"
    TOOLTIP="$(uname -s) $(uname -r)"
else
    TEXT=" ${TITLE}"
    TOOLTIP="class: $(echo $ACTIVE | jq -r '.class')\nxwayland: $(echo $ACTIVE | jq -r '.xwayland')"
fi

JSON=$(echo "{\"text\":\"${TEXT}\", \"tooltip\":\"${TOOLTIP}\"}" | sed 's/&/\&/g')

echo "${JSON}"

idk how to implement separate output tho.

2023-05-03T20:14:22,035945936+04:00 2023-05-03T20:14:53,849561427+04:00

haShinui commented 1 year ago

Hello so for me just adding "hyprland/window"{ "format": "{}" "rewrite" : { /*stuff you have like discord Firefox and so on */ " ": "TEST" } }, This worked for me and if its an empty window it display TEST or whaever you want else it display my discord and so on. So adding "": "TEST" is what you need to add

Babkock commented 1 year ago

Damn these are some sweet rices!