Skip to content

Commit

Permalink
Merge branch 'elkowar:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
midnightexigent authored Jul 15, 2021
2 parents 431d46d + 4f59424 commit b538845
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ assignees: ''

---

## Checklist before submitting an issue
- [ ] I have searched through the existing [closed and open issues](https://github.com/elkowar/eww/issues?q=is%3Aissue) for eww and made sure this is not a duplicate
- [ ] I have specifically verified that this bug is not a common [user error](https://github.com/elkowar/eww/issues?q=is%3Aissue+label%3Ano-actual-bug+is%3Aclosed)
- [ ] I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)

## Describe the bug
A clear and concise description of what the bug is.

Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
flake-utils.lib.eachDefaultSystem (system:
let
# Add rust nightly to pkgs
pkgs = nixpkgs.legacyPackages.${system} // { inherit (fenix.packages.${system}.latest) cargo rustc rust-src; };
pkgs = nixpkgs.legacyPackages.${system} // { inherit (fenix.packages.${system}.latest) cargo rustc rust-src clippy-preview rustfmt-preview; };

naersk-lib = (naersk.lib."${system}".override {
cargo = pkgs.cargo;
Expand Down
4 changes: 2 additions & 2 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ pkgs.mkShell {
gcc
gtk3
pkg-config
rustfmt
clippy
rustfmt-preview
clippy-preview
deno
mdbook
];
Expand Down
4 changes: 2 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl App {
}

fn close_window(&mut self, window_name: &WindowName) -> Result<()> {
for unused_var in self.variables_only_used_in(&window_name) {
for unused_var in self.variables_only_used_in(window_name) {
log::info!("stopping for {}", &unused_var);
self.script_var_handler.stop_for_variable(unused_var.clone());
}
Expand Down Expand Up @@ -246,7 +246,7 @@ impl App {
// initialize script var handlers for variables that where not used before opening this window.
// TODO somehow make this less shit
for newly_used_var in
self.variables_only_used_in(&window_name).filter_map(|var| self.eww_config.get_script_var(&var).ok())
self.variables_only_used_in(window_name).filter_map(|var| self.eww_config.get_script_var(var).ok())
{
self.script_var_handler.add(newly_used_var.clone());
}
Expand Down
4 changes: 2 additions & 2 deletions src/application_lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ lazy_static::lazy_static! {

/// Notify all listening tasks of the termination of the eww application process.
pub fn send_exit() -> Result<()> {
(&*APPLICATION_EXIT_SENDER).send(()).context("Failed to send exit lifecycle event")?;
(APPLICATION_EXIT_SENDER).send(()).context("Failed to send exit lifecycle event")?;
Ok(())
}

/// Yields Ok(()) on application termination. Await on this in all long-running tasks
/// and perform any cleanup if necessary.
pub async fn recv_exit() -> Result<()> {
(&*APPLICATION_EXIT_SENDER).subscribe().recv().await.context("Failed to receive lifecycle event")
(APPLICATION_EXIT_SENDER).subscribe().recv().await.context("Failed to receive lifecycle event")
}

/// Select in a loop, breaking once a application termination event (see `crate::application_lifecycle`) is received.
Expand Down
2 changes: 1 addition & 1 deletion src/config/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl WidgetUse {
.map(|attr| {
(
AttrName(attr.name().to_owned()),
AttrVal::parse_string(&xml_ext::resolve_escaped_symbols(&attr.value())),
AttrVal::parse_string(&xml_ext::resolve_escaped_symbols(attr.value())),
)
})
.collect::<HashMap<_, _>>(),
Expand Down
2 changes: 1 addition & 1 deletion src/config/script_var.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl ScriptVar {
ScriptVar::Poll(x) => match &x.command {
VarSource::Function(f) => f().with_context(|| format!("Failed to compute initial value for {}", &self.name())),
VarSource::Shell(f) => {
run_command(&f).with_context(|| format!("Failed to compute initial value for {}", &self.name()))
run_command(f).with_context(|| format!("Failed to compute initial value for {}", &self.name()))
}
},
ScriptVar::Tail(_) => Ok(PrimVal::from_string(String::new())),
Expand Down
2 changes: 1 addition & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub fn join_path_pretty<P: AsRef<std::path::Path>, P2: AsRef<std::path::Path>>(a
if b.is_absolute() {
b.to_path_buf()
} else {
a.parent().unwrap().join(b.strip_prefix("./").unwrap_or(&b))
a.parent().unwrap().join(b.strip_prefix("./").unwrap_or(b))
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/value/attr_value/attr_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ impl AttrValElement {

pub fn as_expr(&self) -> Option<&AttrValExpr> {
match self {
AttrValElement::Expr(x) => Some(&x),
AttrValElement::Expr(x) => Some(x),
_ => None,
}
}

pub fn as_primitive(&self) -> Option<&PrimVal> {
match self {
AttrValElement::Primitive(x) => Some(&x),
AttrValElement::Primitive(x) => Some(x),
_ => None,
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/value/attr_value/attr_value_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl AttrValExpr {

pub fn eval(self, values: &HashMap<VarName, PrimVal>) -> Result<PrimVal> {
match self {
AttrValExpr::Literal(x) => x.resolve_fully(&values),
AttrValExpr::Literal(x) => x.resolve_fully(values),
AttrValExpr::VarRef(ref name) => values
.get(name)
.cloned()
Expand Down
6 changes: 3 additions & 3 deletions src/widgets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fn build_builtin_gtk_widget(
// run resolve functions for superclasses such as range, orientable, and widget

if let Some(gtk_widget) = gtk_widget.dynamic_cast_ref::<gtk::Container>() {
resolve_container_attrs(&mut bargs, &gtk_widget);
resolve_container_attrs(&mut bargs, gtk_widget);
for child in &widget.children {
let child_widget = child.render(bargs.eww_state, window_name, widget_definitions).with_context(|| {
format!(
Expand All @@ -98,10 +98,10 @@ fn build_builtin_gtk_widget(
}

if let Some(w) = gtk_widget.dynamic_cast_ref() {
resolve_range_attrs(&mut bargs, &w)
resolve_range_attrs(&mut bargs, w)
}
if let Some(w) = gtk_widget.dynamic_cast_ref() {
resolve_orientable_attrs(&mut bargs, &w)
resolve_orientable_attrs(&mut bargs, w)
};
resolve_widget_attrs(&mut bargs, &gtk_widget);

Expand Down
6 changes: 5 additions & 1 deletion src/widgets/widget_definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,10 @@ fn build_gtk_label(bargs: &mut BuilderArgs) -> Result<gtk::Label> {
// @prop wrap - Wrap the text. This mainly makes sense if you set the width of this widget.
prop(wrap: as_bool) {
gtk_widget.set_line_wrap(wrap)
},
// @prop angle - the angle of rotation for the label (between 0 - 360)
prop(angle: as_f64 = 0) {
gtk_widget.set_angle(angle)
}
});
Ok(gtk_widget)
Expand Down Expand Up @@ -608,7 +612,7 @@ fn connect_first_map<W: IsA<gtk::Widget>, F: Fn(&W) + 'static>(widget: &W, func:
let is_first_map = std::rc::Rc::new(std::cell::RefCell::new(true));
widget.connect_map(move |w| {
if is_first_map.replace(false) {
func(&w);
func(w);
}
});
}
2 changes: 1 addition & 1 deletion src/widgets/widget_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl WidgetNode for Generic {
window_name: &WindowName,
widget_definitions: &HashMap<String, WidgetDefinition>,
) -> Result<gtk::Widget> {
crate::widgets::build_builtin_gtk_widget(eww_state, window_name, widget_definitions, &self)?
crate::widgets::build_builtin_gtk_widget(eww_state, window_name, widget_definitions, self)?
.with_context(|| format!("Unknown widget '{}'", self.get_name()))
}
}
Expand Down

0 comments on commit b538845

Please sign in to comment.