Skip to content

Commit

Permalink
Merge pull request #18 from BluewyDiamond/vertical-format
Browse files Browse the repository at this point in the history
added vertical format for text
  • Loading branch information
bjesus authored Oct 23, 2023
2 parents 97e9946 + 62f8f13 commit 0597f85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ For NixOS, use the [NixPkg](https://github.com/NixOS/nixpkgs/blob/master/pkgs/ap

e.g. `wttrbar --date-format "%m/%d" --location Paris --hide-conditions`

- `--vertical-view` - shows the icon on the first line and temperature in a new line

## Waybar configuration

Assuming `wttrbar` is in your path, it can be used like:
Expand Down
8 changes: 7 additions & 1 deletion main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ fn main() {
None => "",
};

let vertical_view = args.iter().any(|arg| arg == "--vertical-view");

let hide_conditions = args.iter().any(|arg| arg == "--hide-conditions");

let ampm = args.iter().any(|arg| arg == "--ampm");
Expand Down Expand Up @@ -137,7 +139,11 @@ fn main() {
.find(|(code, _)| *code == weather_code.parse::<i32>().unwrap())
.map(|(_, symbol)| symbol)
.unwrap();
let text = format!("{} {}", weather_icon, indicator);
let text = if vertical_view {
format!("{}\n{}", weather_icon, indicator)
} else {
format!("{} {}", weather_icon, indicator)
};
data.insert("text", text);

let mut tooltip = format!(
Expand Down

0 comments on commit 0597f85

Please sign in to comment.