diff --git a/docs/modules/Tray.md b/docs/modules/Tray.md
index 7115b759..a80c48e5 100644
--- a/docs/modules/Tray.md
+++ b/docs/modules/Tray.md
@@ -6,7 +6,10 @@ Displays a fully interactive icon tray using the KDE `libappindicator` protocol.
> Type: `tray`
-***This module provides no configuration options.***
+
+| Name | Type | Default | Description |
+|-------------|----------|-----------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|
+| `direction` | `string` | `left_to_right` if bar is horizontal, `top_to_bottom` otherwise | Direction to display the tray items. Possible values: `top_to_bottom`, `bottom_to_top`, `left_to_right`, `right_to_left` |
JSON
@@ -15,7 +18,8 @@ Displays a fully interactive icon tray using the KDE `libappindicator` protocol.
{
"end": [
{
- "type": "tray"
+ "type": "tray",
+ "direction": "top_to_bottom"
}
]
}
@@ -29,6 +33,7 @@ Displays a fully interactive icon tray using the KDE `libappindicator` protocol.
```toml
[[end]]
type = "tray"
+direction = "top_to_bottom"
```
@@ -39,6 +44,7 @@ type = "tray"
```yaml
end:
- type: "tray"
+ direction: "top_to_bottom"
```
@@ -49,7 +55,10 @@ end:
```corn
{
end = [
- { type = "tray" }
+ {
+ type = "tray"
+ direction = "top_to_bottom"
+ }
]
}
```
@@ -63,4 +72,4 @@ end:
| `.tray` | Tray widget box |
| `.tray .item` | Tray icon button |
-For more information on styling, please see the [styling guide](styling-guide).
\ No newline at end of file
+For more information on styling, please see the [styling guide](styling-guide).
diff --git a/src/modules/tray/mod.rs b/src/modules/tray/mod.rs
index b2830a88..5231e097 100644
--- a/src/modules/tray/mod.rs
+++ b/src/modules/tray/mod.rs
@@ -8,7 +8,7 @@ use crate::modules::tray::diff::get_diffs;
use crate::modules::{Module, ModuleInfo, ModuleParts, ModuleUpdateEvent, WidgetContext};
use crate::{glib_recv, spawn};
use color_eyre::Result;
-use gtk::prelude::*;
+use gtk::{prelude::*, PackDirection};
use gtk::{IconTheme, MenuBar};
use interface::TrayMenu;
use serde::Deserialize;
@@ -18,10 +18,28 @@ use tokio::sync::mpsc;
#[derive(Debug, Deserialize, Clone)]
pub struct TrayModule {
+ #[serde(default, deserialize_with = "deserialize_orientation")]
+ pub direction: Option,
#[serde(flatten)]
pub common: Option,
}
+fn deserialize_orientation<'de, D>(deserializer: D) -> Result