Skip to content

Commit 69c2396

Browse files
authored
Revert "Add right alignment option"
1 parent 2b94486 commit 69c2396

4 files changed

Lines changed: 12 additions & 36 deletions

File tree

docs/Configuration.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ QT_SCALE_FACTOR_ROUNDING_POLICY="PassThrough"
5151
| `enabled` | boolean | `true` | Whether the status bar is enabled. |
5252
| `screens` | list | `['*']` | The screens on which the status bar should be displayed. |
5353
| `class_name` | string | `"yasb-bar"` | The CSS class name for the status bar. |
54-
| `alignment` | object  | `{position: "top", alignment: "center"}` | The alignment settings for the status bar. **Deprecated:** The `center` property is deprecated - use `alignment: "left"/"center"/"right"` instead. |
54+
| `alignment` | object | `{position: "top", center: false}` | The alignment settings for the status bar. |
5555
| `blur_effect` | object | [See below](#blur-effect-configuration) | The blur effect settings for the status bar. |
5656
| `window_flags` | object | [See below](#window-flags-configuration) | The window flags for the status bar. |
5757
| `dimensions` | object | `{width: "100%", height: 36}` | The dimensions of the status bar. |
@@ -104,9 +104,6 @@ layouts:
104104
stretch: true
105105
```
106106
107-
### Status Bar Alignment Behavior
108-
When `width` is set to `100%`, changing the `alignment` value won't have any visible effect since the bar spans the full screen width. The alignment setting only becomes apparent when using smaller width percentages (e.g., `width: "80%"`).
109-
110107
# Multiple Bars Example
111108
> **Note:**
112109
> If you want to have different bars on each screen you will need to define on which screen the bar should be displayed, `screens` inside bar config is your monitor name. You can find your monitor name inside device manager or click on YASB tray icon and select Debug > Information to show all available screens.

src/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ bars:
1414
class_name: "yasb-bar"
1515
alignment:
1616
position: "top"
17-
alignment: "center"
17+
center: false
1818
animation:
1919
enabled: true
2020
duration: 1000

src/core/bar.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -157,29 +157,17 @@ def try_remove_app_bar(self) -> None:
157157
self.app_bar_manager.remove_appbar()
158158

159159
def bar_pos(self, bar_w: int, bar_h: int, screen_w: int, screen_h: int) -> tuple[int, int]:
160-
geom = self.screen().geometry()
161-
sx, sy = geom.x(), geom.y()
160+
screen_x = self.screen().geometry().x()
161+
screen_y = self.screen().geometry().y()
162+
x = int(screen_x + (screen_w / 2) - (bar_w / 2)) if self._alignment['center'] else screen_x
162163

163-
if "alignment" in self._alignment:
164-
a = self._alignment["alignment"]
164+
if self._alignment['position'] == "bottom":
165+
y = int(screen_y + screen_h - bar_h - self._padding['bottom'])
165166
else:
166-
a = "center" if self._alignment.get("center") else "left"
167-
168-
if a == "center":
169-
x = int((sx + screen_w - bar_w - self._padding["left"] - self._padding["right"]) / 2)
170-
elif a == "right":
171-
x = int(sx + (screen_w - bar_w - self._padding["left"] - self._padding["right"]))
172-
else: # 'left'
173-
x = sx
174-
175-
if self._alignment["position"] == "bottom":
176-
y = int(sy + screen_h - bar_h - self._padding["bottom"])
177-
else: # 'top'
178-
y = sy
179-
167+
y = screen_y
168+
180169
return x, y
181170

182-
183171
def position_bar(self, init=False) -> None:
184172
bar_width = self._dimensions['width']
185173
bar_height = self._dimensions['height']

src/core/validation/bar.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
'enabled': True,
33
'screens': ['*'],
44
'class_name': 'yasb-bar',
5-
'alignment': {
6-
'position': 'top',
7-
'center': False, # DEPRECATED
8-
'alignment': 'center'
9-
},
5+
'alignment': {'position': 'top', 'center': False},
106
'blur_effect': {'enabled': False, 'dark_mode': False, 'acrylic': False,'round_corners': False,'round_corners_type':'normal','border_color': "System"},
117
'animation': {'enabled': True, 'duration': 500},
128
'window_flags': {'always_on_top': False, 'windows_app_bar': False, 'hide_on_fullscreen': False, 'auto_hide': False},
@@ -46,13 +42,8 @@
4642
'default': BAR_DEFAULTS['alignment']['position']
4743
},
4844
'center': {
49-
'type': 'boolean',
50-
'default': BAR_DEFAULTS['alignment']['center']
51-
},
52-
'alignment': {
53-
'type': 'string',
54-
'allowed': ['left', 'center', 'right'],
55-
'default': BAR_DEFAULTS['alignment']['alignment']
45+
'type': 'boolean',
46+
'default': BAR_DEFAULTS['alignment']['center']
5647
}
5748
},
5849
'default': BAR_DEFAULTS['alignment']

0 commit comments

Comments
 (0)