Skip to content

Commit

Permalink
feat(widget): enhance container padding structure for multiple widgets
Browse files Browse the repository at this point in the history
Updated the container_padding parameter to accept a structured dictionary with top, left, bottom, and right properties. This change improves the layout flexibility of the widgets by allowing more precise control over their padding.
  • Loading branch information
amnweb committed Jan 13, 2025
1 parent 6e6ac21 commit 8a2e1cc
Show file tree
Hide file tree
Showing 42 changed files with 635 additions and 51 deletions.
23 changes: 23 additions & 0 deletions src/core/validation/widgets/komorebi/active_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
"paused": "[P]"
},
'container_padding': {'top': 0, 'left': 0, 'bottom': 0, 'right': 0},
'animation': {
'enabled': True,
'type': 'fadeInOut',
'duration': 200
},
'callbacks': {
'on_left': 'next_layout',
'on_middle': 'toggle_monocle',
Expand Down Expand Up @@ -115,6 +120,24 @@
'default': DEFAULTS['container_padding'],
'required': False
},
'animation': {
'type': 'dict',
'schema': {
'enabled': {
'type': 'boolean',
'default': DEFAULTS['animation']['enabled']
},
'type': {
'type': 'string',
'default': DEFAULTS['animation']['type']
},
'duration': {
'type': 'integer',
'default': DEFAULTS['animation']['duration']
}
},
'default': DEFAULTS['animation']
},
'callbacks': {
'type': 'dict',
'schema': {
Expand Down
24 changes: 24 additions & 0 deletions src/core/validation/widgets/yasb/active_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'processes': [],
'titles': []
},
'container_padding': {'top': 0, 'left': 0, 'bottom': 0, 'right': 0},
'callbacks': {
'on_left': 'toggle_label',
'on_middle': 'do_nothing',
Expand Down Expand Up @@ -108,6 +109,29 @@
},
'default': DEFAULTS['ignore_windows']
},
'container_padding': {
'type': 'dict',
'required': False,
'schema': {
'top': {
'type': 'integer',
'default': DEFAULTS['container_padding']['top']
},
'left': {
'type': 'integer',
'default': DEFAULTS['container_padding']['left']
},
'bottom': {
'type': 'integer',
'default': DEFAULTS['container_padding']['bottom']
},
'right': {
'type': 'integer',
'default': DEFAULTS['container_padding']['right']
}
},
'default': DEFAULTS['container_padding']
},
'callbacks': {
'type': 'dict',
'schema': {
Expand Down
24 changes: 24 additions & 0 deletions src/core/validation/widgets/yasb/battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
'type': 'fadeInOut',
'duration': 200
},
'container_padding': {'top': 0, 'left': 0, 'bottom': 0, 'right': 0},
'callbacks': {
'on_left': 'toggle_label',
'on_middle': 'do_nothing',
Expand Down Expand Up @@ -152,6 +153,29 @@
},
'default': DEFAULTS['animation']
},
'container_padding': {
'type': 'dict',
'required': False,
'schema': {
'top': {
'type': 'integer',
'default': DEFAULTS['container_padding']['top']
},
'left': {
'type': 'integer',
'default': DEFAULTS['container_padding']['left']
},
'bottom': {
'type': 'integer',
'default': DEFAULTS['container_padding']['bottom']
},
'right': {
'type': 'integer',
'default': DEFAULTS['container_padding']['right']
}
},
'default': DEFAULTS['container_padding']
},
'callbacks': {
'type': 'dict',
'schema': {
Expand Down
22 changes: 20 additions & 2 deletions src/core/validation/widgets/yasb/bluetooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,26 @@
},
'container_padding': {
'type': 'dict',
'default': DEFAULTS['container_padding'],
'required': False
'required': False,
'schema': {
'top': {
'type': 'integer',
'default': DEFAULTS['container_padding']['top']
},
'left': {
'type': 'integer',
'default': DEFAULTS['container_padding']['left']
},
'bottom': {
'type': 'integer',
'default': DEFAULTS['container_padding']['bottom']
},
'right': {
'type': 'integer',
'default': DEFAULTS['container_padding']['right']
}
},
'default': DEFAULTS['container_padding']
},
'callbacks': {
'type': 'dict',
Expand Down
22 changes: 20 additions & 2 deletions src/core/validation/widgets/yasb/brightness.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,26 @@
},
'container_padding': {
'type': 'dict',
'default': DEFAULTS['container_padding'],
'required': False
'required': False,
'schema': {
'top': {
'type': 'integer',
'default': DEFAULTS['container_padding']['top']
},
'left': {
'type': 'integer',
'default': DEFAULTS['container_padding']['left']
},
'bottom': {
'type': 'integer',
'default': DEFAULTS['container_padding']['bottom']
},
'right': {
'type': 'integer',
'default': DEFAULTS['container_padding']['right']
}
},
'default': DEFAULTS['container_padding']
},
'animation': {
'type': 'dict',
Expand Down
24 changes: 24 additions & 0 deletions src/core/validation/widgets/yasb/clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
'type': 'fadeInOut',
'duration': 200
},
'container_padding': {'top': 0, 'left': 0, 'bottom': 0, 'right': 0},
'callbacks': {
'on_left': 'toggle_label',
'on_middle': 'do_nothing',
Expand Down Expand Up @@ -69,6 +70,29 @@
},
'default': DEFAULTS['animation']
},
'container_padding': {
'type': 'dict',
'required': False,
'schema': {
'top': {
'type': 'integer',
'default': DEFAULTS['container_padding']['top']
},
'left': {
'type': 'integer',
'default': DEFAULTS['container_padding']['left']
},
'bottom': {
'type': 'integer',
'default': DEFAULTS['container_padding']['bottom']
},
'right': {
'type': 'integer',
'default': DEFAULTS['container_padding']['right']
}
},
'default': DEFAULTS['container_padding']
},
'callbacks': {
'type': 'dict',
'schema': {
Expand Down
24 changes: 24 additions & 0 deletions src/core/validation/widgets/yasb/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'type': 'fadeInOut',
'duration': 200
},
'container_padding': {'top': 0, 'left': 0, 'bottom': 0, 'right': 0},
'callbacks': {
'on_left': 'toggle_label',
'on_middle': 'do_nothing',
Expand Down Expand Up @@ -75,6 +76,29 @@
},
'default': DEFAULTS['animation']
},
'container_padding': {
'type': 'dict',
'required': False,
'schema': {
'top': {
'type': 'integer',
'default': DEFAULTS['container_padding']['top']
},
'left': {
'type': 'integer',
'default': DEFAULTS['container_padding']['left']
},
'bottom': {
'type': 'integer',
'default': DEFAULTS['container_padding']['bottom']
},
'right': {
'type': 'integer',
'default': DEFAULTS['container_padding']['right']
}
},
'default': DEFAULTS['container_padding']
},
'callbacks': {
'type': 'dict',
'schema': {
Expand Down
24 changes: 24 additions & 0 deletions src/core/validation/widgets/yasb/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'type': 'fadeInOut',
'duration': 200
},
'container_padding': {'top': 0, 'left': 0, 'bottom': 0, 'right': 0},
'callbacks': {
'on_left': "toggle_label",
'on_middle': "do_nothing",
Expand Down Expand Up @@ -88,6 +89,29 @@
},
'default': DEFAULTS['animation']
},
'container_padding': {
'type': 'dict',
'required': False,
'schema': {
'top': {
'type': 'integer',
'default': DEFAULTS['container_padding']['top']
},
'left': {
'type': 'integer',
'default': DEFAULTS['container_padding']['left']
},
'bottom': {
'type': 'integer',
'default': DEFAULTS['container_padding']['bottom']
},
'right': {
'type': 'integer',
'default': DEFAULTS['container_padding']['right']
}
},
'default': DEFAULTS['container_padding']
},
'callbacks': {
'type': 'dict',
'schema': {
Expand Down
26 changes: 25 additions & 1 deletion src/core/validation/widgets/yasb/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
'enabled': True,
'type': 'fadeInOut',
'duration': 200
}
},
'container_padding': {'top': 0, 'left': 0, 'bottom': 0, 'right': 0}
}

VALIDATION_SCHEMA = {
Expand Down Expand Up @@ -83,5 +84,28 @@
}
},
'default': DEFAULTS['animation']
},
'container_padding': {
'type': 'dict',
'required': False,
'schema': {
'top': {
'type': 'integer',
'default': DEFAULTS['container_padding']['top']
},
'left': {
'type': 'integer',
'default': DEFAULTS['container_padding']['left']
},
'bottom': {
'type': 'integer',
'default': DEFAULTS['container_padding']['bottom']
},
'right': {
'type': 'integer',
'default': DEFAULTS['container_padding']['right']
}
},
'default': DEFAULTS['container_padding']
}
}
22 changes: 20 additions & 2 deletions src/core/validation/widgets/yasb/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,26 @@
},
'container_padding': {
'type': 'dict',
'default': DEFAULTS['container_padding'],
'required': False
'required': False,
'schema': {
'top': {
'type': 'integer',
'default': DEFAULTS['container_padding']['top']
},
'left': {
'type': 'integer',
'default': DEFAULTS['container_padding']['left']
},
'bottom': {
'type': 'integer',
'default': DEFAULTS['container_padding']['bottom']
},
'right': {
'type': 'integer',
'default': DEFAULTS['container_padding']['right']
}
},
'default': DEFAULTS['container_padding']
},
'power_menu': {
'type': 'boolean',
Expand Down
24 changes: 24 additions & 0 deletions src/core/validation/widgets/yasb/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'type': 'fadeInOut',
'duration': 200
},
'container_padding': {'top': 0, 'left': 0, 'bottom': 0, 'right': 0},
'callbacks': {
'on_left': 'toggle_label',
'on_middle': 'do_nothing',
Expand Down Expand Up @@ -48,6 +49,29 @@
},
'default': DEFAULTS['animation']
},
'container_padding': {
'type': 'dict',
'required': False,
'schema': {
'top': {
'type': 'integer',
'default': DEFAULTS['container_padding']['top']
},
'left': {
'type': 'integer',
'default': DEFAULTS['container_padding']['left']
},
'bottom': {
'type': 'integer',
'default': DEFAULTS['container_padding']['bottom']
},
'right': {
'type': 'integer',
'default': DEFAULTS['container_padding']['right']
}
},
'default': DEFAULTS['container_padding']
},
'callbacks': {
'type': 'dict',
'schema': {
Expand Down
Loading

0 comments on commit 8a2e1cc

Please sign in to comment.