mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-23 08:47:47 +02:00
Allow individually setting margins and padding for each edge (left, right, top, bottom)
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
from kitty.config import defaults
|
||||
from kitty.constants import WindowGeometry
|
||||
from kitty.fast_data_types import pt_to_px
|
||||
from kitty.layout import Grid, Horizontal, Splits, Stack, Tall, idx_for_id
|
||||
from kitty.window import EdgeWidths
|
||||
|
||||
@@ -22,6 +21,15 @@ class Window:
|
||||
self.padding = EdgeWidths()
|
||||
self.margin = EdgeWidths()
|
||||
|
||||
def effective_border(self):
|
||||
return 1
|
||||
|
||||
def effective_padding(self, edge):
|
||||
return 1
|
||||
|
||||
def effective_margin(self, edge, is_single_window=False):
|
||||
return 0 if is_single_window else 1
|
||||
|
||||
def set_visible_in_layout(self, idx, val):
|
||||
self.is_visible_in_layout = bool(val)
|
||||
|
||||
@@ -32,8 +40,7 @@ class Window:
|
||||
def create_layout(cls, opts=None, border_width=2):
|
||||
if opts is None:
|
||||
opts = defaults
|
||||
mw, pw = map(pt_to_px, (opts.window_margin_width, opts.window_padding_width))
|
||||
ans = cls(1, 1, mw, mw, pw, border_width)
|
||||
ans = cls(1, 1)
|
||||
ans.set_active_window_in_os_window = lambda idx: None
|
||||
ans.swap_windows_in_os_window = lambda a, b: None
|
||||
return ans
|
||||
|
||||
Reference in New Issue
Block a user