Skip to content
Merged
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
2 changes: 0 additions & 2 deletions docs/IPC.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# IPC

The server listens on a Unix socket.
The path is printed on startup, and can usually be found at `/run/user/$UID/ironbar-ipc.sock`.

Expand Down
13 changes: 6 additions & 7 deletions src/bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ pub struct Bar {
inner: Inner,
}

impl Drop for Bar {
fn drop(&mut self) {
self.window.close();
self.window.destroy();
}
}

impl Bar {
pub fn new(
app: &Application,
Expand Down Expand Up @@ -164,6 +157,12 @@ impl Bar {
self
}

/// Closes the bar, consuming it.
pub fn close(self) {
self.window.close();
self.window.destroy();
}

/// Sets up GTK layer shell for a provided application window.
fn setup_layer_shell(
&self,
Expand Down
9 changes: 2 additions & 7 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,22 +221,17 @@ pub enum MonitorConfig {
Multiple(Vec<BarConfig>),
}

#[derive(Debug, Deserialize, Copy, Clone, PartialEq, Eq)]
#[derive(Debug, Default, Deserialize, Copy, Clone, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
#[cfg_attr(feature = "extras", derive(JsonSchema))]
pub enum BarPosition {
Top,
#[default]
Bottom,
Left,
Right,
}

impl Default for BarPosition {
fn default() -> Self {
Self::Bottom
}
}

#[derive(Debug, Default, Deserialize, Copy, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "extras", derive(JsonSchema))]
#[serde(default)]
Expand Down
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ impl Ironbar {
instance
.bars
.borrow_mut()
.retain(|bar| bar.monitor_name() != event.connector);
.extract_if(.., |bar| bar.monitor_name() == event.connector)
.for_each(Bar::close);
}
MonitorState::Connected(wl_output, gdk_output) => {
if let Some(gdk_output) = gdk_output.upgrade() {
Expand Down Expand Up @@ -418,7 +419,7 @@ pub fn load_output_bars(ironbar: &Rc<Ironbar>, app: &Application) -> Result<()>
let wl = ironbar.clients.borrow_mut().wayland();
let outputs = wl.output_info_all();

let display = crate::get_display();
let display = get_display();
let monitors = display.monitors();

for output in outputs {
Expand Down
1 change: 1 addition & 0 deletions src/modules/music/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub enum PlayerType {
Mpris,
}

#[allow(clippy::derivable_impls)]
impl Default for PlayerType {
fn default() -> Self {
cfg_if::cfg_if! {
Expand Down
9 changes: 2 additions & 7 deletions src/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ pub enum ScriptInput {
Struct(Script),
}

#[derive(Debug, Deserialize, Clone, Copy, Eq, PartialEq)]
#[derive(Debug, Default, Deserialize, Clone, Copy, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
#[cfg_attr(feature = "extras", derive(schemars::JsonSchema))]
pub enum ScriptMode {
#[default]
Poll,
Watch,
}
Expand All @@ -48,12 +49,6 @@ impl From<&str> for ScriptMode {
}
}

impl Default for ScriptMode {
fn default() -> Self {
Self::Poll
}
}

impl Display for ScriptMode {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(
Expand Down