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

Simplify volume_muted icons #517

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions src/blocks/sound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,22 +627,15 @@ impl Sound {

let volume = self.device.volume();
if self.device.muted() {
self.text.set_icon("volume_empty");
let icon = self
.config
.icons
.get("volume_muted")
.block_error("sound", "cannot find icon")?
.to_owned();
self.text.set_icon("volume_muted");
if self.show_volume_when_muted {
if self.bar {
self.text
.set_text(format!("{} {}", icon, format_percent_bar(volume as f32)));
self.text.set_text(format_percent_bar(volume as f32));
} else {
self.text.set_text(format!("{} {:02}%", icon, volume));
self.text.set_text(format!("{:02}%", volume));
}
} else {
self.text.set_text(icon);
self.text.set_text("");
}
self.text.set_state(State::Warning);
} else {
Expand Down
9 changes: 3 additions & 6 deletions src/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ lazy_static! {
"volume_full" => " VOL ",
"volume_half" => " VOL ",
"volume_empty" => " VOL ",
// This icon has no spaces around it because it is manually set as text. (sound.rs)
"volume_muted" => "MUTED",
"volume_muted" => " VOL MUTED ",
ammgws marked this conversation as resolved.
Show resolved Hide resolved
"thermometer" => " TEMP ",
"xrandr" => " SCREEN ",
"net_up" => " UP ",
Expand Down Expand Up @@ -83,8 +82,7 @@ lazy_static! {
"volume_full" => " \u{f028} ",
"volume_half" => " \u{f027} ",
"volume_empty" => " \u{f026} ",
// This icon has no spaces around it because it is manually set as text. (sound.rs)
"volume_muted" => "\u{f00d}",
"volume_muted" => " \u{f6a9} ",
"thermometer" => " \u{f2c8} ",
"xrandr" => " \u{f26c} ",
"net_up" => " \u{2b06} ",
Expand Down Expand Up @@ -142,8 +140,7 @@ lazy_static! {
"volume_full" => " \u{e050} ",
"volume_half" => " \u{e04d} ",
"volume_empty" => " \u{e04e} ",
// This icon has no spaces around it because it is manually set as text. (sound.rs)
"volume_muted" => "\u{e04f}",
"volume_muted" => " \u{e04e} \u{e04f} ",
"thermometer" => " \u{f2c8} ", // TODO
"xrandr" => " \u{e31e} ",
// Same as time symbol.
Expand Down