ITADN

Add support for custom formats with labels

#30Pull Requestdshoreman 创建于 2024-08-07
D
dshoremancommented
Hi! I started switching to Waybar at the weekend and found this to replace what I had for Polybar previously. It works great—thanks for merging #29 so quickly btw—but ideally ***I'd like to show counts separately***. I couldn't find a way to get Waybar passing anything from the "real" `format` option in the bar config, so instead I've hacked together some basic "label" parsing. It supports a custom prefix/suffix (separated by `:`) which allows for per-count auto-hiding icons, but at the cost of a *really* ugly sed block. ## New CLI args * `-f, --format` * `-t, --tooltip` ## Supported Labels * `{aur}` * `{dev}` * `{pacman}` * `{total}` ## Examples ### New defaults ```jsonc "exec": "waybar-updates", // All examples are based on this: "format": "{icon}{}", "format-icons": { "pending-updates": " ", "updated": "" } ``` ![wbu-0-default](https://github.com/user-attachments/assets/3e59be7c-e319-4d6f-91ca-e1aeb6c5fd44) ### Custom prefix and suffix ```jsonc "exec": "waybar-updates --format '{total}{ (+:aur: AUR)}'", ``` ![wbu-1-text](https://github.com/user-attachments/assets/65bd7985-abe3-405c-87a6-ab0e2a74adfd) ### Multiline Pacman+AUR example with icons ```jsonc "exec": "waybar-updates -df '{ :pacman:\n }{ :aur}'", ``` ![wbu-2-multiline](https://github.com/user-attachments/assets/0f414200-d40b-41fc-805c-e5c73186020b) ### Showing only package counts in the tooltip ```jsonc "exec": "waybar-updates --tooltip '{ :pacman}{  :aur}{  :dev}'", ``` ![wbu-3-simplett](https://github.com/user-attachments/assets/19fa95d0-56fc-4c76-99e9-540b5e8a36a9) ### Showing all counts individually (and hiding them in the tooltip) ```jsonc "exec": "waybar-updates -df '{pacman}{  :aur} {  :dev}' -t '{}'", ``` ![wbu-4-countsinbar](https://github.com/user-attachments/assets/3b4a43fe-f5d0-4cd0-934e-a0fbea984397)
合并状态:未合并 关闭于 2024-08-07 9 条评论