feat(launcher): option to reverse order

* Add reverse order for launcher items/favorites

* Add lanucher reverse order to docs

* Add example configs for json,toml,yaml,corn

---------

Co-authored-by: SerraPi <serrapm2@gmail.com>
This commit is contained in:
SerraPi 2024-04-28 21:33:20 +00:00 committed by GitHub
parent 782b9554a2
commit d03c752f9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 4 deletions

View File

@ -18,7 +18,7 @@ Optionally displays a launchable set of favourites.
| `show_names` | `boolean` | `false` | Whether to show app names on the button label. Names will still show on tooltips when set to false. |
| `show_icons` | `boolean` | `true` | Whether to show app icons on the button. |
| `icon_size` | `integer` | `32` | Size to render icon at (image icons only). |
| `reversed` | `boolean` | `false` | Whether to reverse the order of favorites/items |
<details>
<summary>JSON</summary>
@ -32,7 +32,8 @@ Optionally displays a launchable set of favourites.
"discord"
],
"show_names": false,
"show_icons": true
"show_icons": true,
"reversed": false
}
]
}
@ -51,6 +52,7 @@ type = "launcher"
favorites = ["firefox", "discord"]
show_names = false
show_icons = true
reversed = false
```
</details>
@ -66,6 +68,7 @@ start:
- discord
show_names: false
show_icons: true
reversed: false
```
</details>
@ -81,7 +84,7 @@ start:
favorites = [ "firefox" "discord" ]
show_names = false
show_icons = true
reversed = false
}
]
}

View File

@ -33,6 +33,9 @@ pub struct LauncherModule {
#[serde(default = "default_icon_size")]
icon_size: i32,
#[serde(default = "crate::config::default_false")]
reversed: bool,
#[serde(flatten)]
pub common: Option<CommonConfig>,
}
@ -338,7 +341,12 @@ impl Module<gtk::Box> for LauncherModule {
&controller_tx,
);
container.add(&button.button);
if self.reversed {
container.pack_end(&button.button, false, false, 0);
} else {
container.add(&button.button);
}
buttons.insert(item.app_id, button);
}
}