1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-04 20:21:02 +02:00

feat: more positioning options (#23)

* feat: more positioning options

Can now display the bar on the left/right, and avoid anchoring to edges to centre the bar.

BREAKING CHANGE: The `left` and `right` config options have been renamed to `start` and `end`
This commit is contained in:
Jake Stanger 2022-10-15 16:27:25 +01:00 committed by GitHub
parent 1b853bcb71
commit 06cfad62e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 254 additions and 83 deletions

View file

@ -202,14 +202,22 @@ impl Module<Button> for MpdModule {
fn into_widget(
self,
context: WidgetContext<Self::SendMessage, Self::ReceiveMessage>,
_info: &ModuleInfo,
info: &ModuleInfo,
) -> Result<ModuleWidget<Button>> {
let button = Button::new();
let label = Label::new(None);
label.set_angle(info.bar_position.get_angle());
button.add(&label);
let orientation = info.bar_position.get_orientation();
button.connect_clicked(move |button| {
context
.tx
.try_send(ModuleUpdateEvent::TogglePopup(Popup::button_pos(button)))
.try_send(ModuleUpdateEvent::TogglePopup(Popup::button_pos(
button,
orientation,
)))
.expect("Failed to send MPD popup open event");
});
@ -218,7 +226,7 @@ impl Module<Button> for MpdModule {
context.widget_rx.attach(None, move |mut event| {
if let Some(event) = event.take() {
button.set_label(&event.display_string);
label.set_label(&event.display_string);
button.show();
} else {
button.hide();