fix to view-tags
This commit is contained in:
parent
1b297251bc
commit
a803c271c0
27
src/main.rs
27
src/main.rs
@ -41,8 +41,8 @@ fn main() {
|
|||||||
|
|
||||||
let mut args = std::env::args();
|
let mut args = std::env::args();
|
||||||
let mut monitor = None;
|
let mut monitor = None;
|
||||||
let mut show_tags = false;
|
let mut enable_tag = false;
|
||||||
let mut view_tags = false;
|
let mut enable_views_tag = true;
|
||||||
args.next();
|
args.next();
|
||||||
loop {
|
loop {
|
||||||
match args.next() {
|
match args.next() {
|
||||||
@ -51,8 +51,8 @@ fn main() {
|
|||||||
Ok(i) => Some(i),
|
Ok(i) => Some(i),
|
||||||
Err(_) => None,
|
Err(_) => None,
|
||||||
},
|
},
|
||||||
"--tag" | "-t" => show_tags = true,
|
"--tag" | "-t" => enable_tag = true,
|
||||||
"--view-tags" | "-vt" => view_tags = true,
|
"--view-tags" | "-vt" => enable_views_tag = true,
|
||||||
"--help" | "-h" | "--h" => {
|
"--help" | "-h" | "--h" => {
|
||||||
println!("Usage: status [option]\n");
|
println!("Usage: status [option]\n");
|
||||||
println!(" --tag | -t : displays the focused tag");
|
println!(" --tag | -t : displays the focused tag");
|
||||||
@ -109,22 +109,19 @@ fn main() {
|
|||||||
.get_river_output_status(&output.output));
|
.get_river_output_status(&output.output));
|
||||||
output.output_status.as_mut().unwrap().quick_assign(move |_, event, _| match event {
|
output.output_status.as_mut().unwrap().quick_assign(move |_, event, _| match event {
|
||||||
zriver_output_status_v1::Event::FocusedTags { tags } => {
|
zriver_output_status_v1::Event::FocusedTags { tags } => {
|
||||||
if show_tags {
|
if enable_tag {
|
||||||
base10(tags);
|
base10(tags);
|
||||||
println!("");
|
println!("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zriver_output_status_v1::Event::ViewTags { tags } => {
|
zriver_output_status_v1::Event::ViewTags { tags } => {
|
||||||
if view_tags {
|
if enable_views_tag {
|
||||||
let mut tagmask:u32 = 1;
|
let len = tags.len();
|
||||||
for (i, tag) in tags.iter().enumerate() {
|
let mut i = 0;
|
||||||
if *tag != 0 {
|
while i < len {
|
||||||
tagmask *= *tag as u32;
|
let buf: [u8; 4] = [tags[i],tags[i+1],tags[i+2],tags[i+3]];
|
||||||
}
|
base10(u32::from_le_bytes(buf));
|
||||||
if (i+1) % 4 == 0 {
|
i+=4;
|
||||||
base10(tagmask);
|
|
||||||
tagmask = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
println!("");
|
println!("");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user