Skip to content

Commit 44f8b61

Browse files
authored
Merge pull request #1256 from JakeStanger/fix/ipc-popup
IPC Popup Fix
2 parents 14a02b9 + 8af9480 commit 44f8b61

File tree

6 files changed

+14
-25
lines changed

6 files changed

+14
-25
lines changed

docs/IPC.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# IPC
2-
31
The server listens on a Unix socket.
42
The path is printed on startup, and can usually be found at `/run/user/$UID/ironbar-ipc.sock`.
53

src/bar.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ pub struct Bar {
4040
inner: Inner,
4141
}
4242

43-
impl Drop for Bar {
44-
fn drop(&mut self) {
45-
self.window.close();
46-
self.window.destroy();
47-
}
48-
}
49-
5043
impl Bar {
5144
pub fn new(
5245
app: &Application,
@@ -164,6 +157,12 @@ impl Bar {
164157
self
165158
}
166159

160+
/// Closes the bar, consuming it.
161+
pub fn close(self) {
162+
self.window.close();
163+
self.window.destroy();
164+
}
165+
167166
/// Sets up GTK layer shell for a provided application window.
168167
fn setup_layer_shell(
169168
&self,

src/config/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,22 +221,17 @@ pub enum MonitorConfig {
221221
Multiple(Vec<BarConfig>),
222222
}
223223

224-
#[derive(Debug, Deserialize, Copy, Clone, PartialEq, Eq)]
224+
#[derive(Debug, Default, Deserialize, Copy, Clone, PartialEq, Eq)]
225225
#[serde(rename_all = "snake_case")]
226226
#[cfg_attr(feature = "extras", derive(JsonSchema))]
227227
pub enum BarPosition {
228228
Top,
229+
#[default]
229230
Bottom,
230231
Left,
231232
Right,
232233
}
233234

234-
impl Default for BarPosition {
235-
fn default() -> Self {
236-
Self::Bottom
237-
}
238-
}
239-
240235
#[derive(Debug, Default, Deserialize, Copy, Clone, PartialEq, Eq)]
241236
#[cfg_attr(feature = "extras", derive(JsonSchema))]
242237
#[serde(default)]

src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ impl Ironbar {
249249
instance
250250
.bars
251251
.borrow_mut()
252-
.retain(|bar| bar.monitor_name() != event.connector);
252+
.extract_if(.., |bar| bar.monitor_name() == event.connector)
253+
.for_each(Bar::close);
253254
}
254255
MonitorState::Connected(wl_output, gdk_output) => {
255256
if let Some(gdk_output) = gdk_output.upgrade() {
@@ -418,7 +419,7 @@ pub fn load_output_bars(ironbar: &Rc<Ironbar>, app: &Application) -> Result<()>
418419
let wl = ironbar.clients.borrow_mut().wayland();
419420
let outputs = wl.output_info_all();
420421

421-
let display = crate::get_display();
422+
let display = get_display();
422423
let monitors = display.monitors();
423424

424425
for output in outputs {

src/modules/music/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub enum PlayerType {
1313
Mpris,
1414
}
1515

16+
#[allow(clippy::derivable_impls)]
1617
impl Default for PlayerType {
1718
fn default() -> Self {
1819
cfg_if::cfg_if! {

src/script.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ pub enum ScriptInput {
2121
Struct(Script),
2222
}
2323

24-
#[derive(Debug, Deserialize, Clone, Copy, Eq, PartialEq)]
24+
#[derive(Debug, Default, Deserialize, Clone, Copy, Eq, PartialEq)]
2525
#[serde(rename_all = "snake_case")]
2626
#[cfg_attr(feature = "extras", derive(schemars::JsonSchema))]
2727
pub enum ScriptMode {
28+
#[default]
2829
Poll,
2930
Watch,
3031
}
@@ -48,12 +49,6 @@ impl From<&str> for ScriptMode {
4849
}
4950
}
5051

51-
impl Default for ScriptMode {
52-
fn default() -> Self {
53-
Self::Poll
54-
}
55-
}
56-
5752
impl Display for ScriptMode {
5853
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
5954
write!(

0 commit comments

Comments
 (0)