Skip to content

Commit 17df0af

Browse files
authored
feat: option to change arrow symbol in the tooltip
* Adding the --arrow-type option * Update README.md
1 parent f2042c8 commit 17df0af

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ This small program will give you fast updates with less network usage. After you
6060

6161
`--color-semver-updates` - color each package update in a color corresponding to the type of update (major, minor, patch, pre)
6262

63+
`--arrow-style` - change the arrow symbols that are displayed between version updates.
64+
6365
### How to hide the module when there are no updates available
6466

6567
##### waybar config

src/main.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ fn display_help() {
3939
println!(" --color-semver-updates <colors> Check the difference of semantic versions and color them using the given colors.");
4040
println!(" The order of pango markup hex colors for colored updates is Major, Minor, Patch, Pre, Other.");
4141
println!(" (default: ff0000,00ff00,0000ff,ff00ff,ffffff)");
42+
println!(" --arrow-style <symbol> Changes the style of the arrows, which are displayed between version updates.");
4243
println!();
4344
}
4445

@@ -56,6 +57,7 @@ fn main() -> Result<(), Error> {
5657
let mut color_semver_updates = false;
5758
let mut semver_updates_colors = ["ff0000", "00ff00", "0000ff", "ff00ff", "ffffff"];
5859
let mut no_aur = false;
60+
let mut arrow_style = "->";
5961
if args.len() > 1 {
6062
for (i, arg) in args.iter().enumerate() {
6163
if arg == "--help" {
@@ -89,6 +91,10 @@ fn main() -> Result<(), Error> {
8991
.take(semver_updates_colors.len())
9092
.for_each(|(index, color)| semver_updates_colors[index] = color);
9193
}
94+
} else if arg == "--arrow-style" {
95+
if i + 1 < args.len() {
96+
arrow_style = args[i + 1].as_str();
97+
}
9298
}
9399
}
94100
}
@@ -111,6 +117,7 @@ fn main() -> Result<(), Error> {
111117
} else {
112118
get_aur_updates()
113119
};
120+
114121
let updates = pacman_updates + aur_updates;
115122
let mut stdout = if !aur_stdout.is_empty() && !pacman_stdout.is_empty() {
116123
format!("{}\n{}", pacman_stdout, aur_stdout)
@@ -119,7 +126,12 @@ fn main() -> Result<(), Error> {
119126
} else {
120127
pacman_stdout
121128
};
129+
122130
if updates > 0 {
131+
if arrow_style != "->" {
132+
stdout = stdout.replace("->", arrow_style);
133+
}
134+
123135
if tooltip_align {
124136
let mut padding = [0; 4];
125137
stdout

0 commit comments

Comments
 (0)