1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# fs-usage.yazi
A [Yazi](https://github.com/sxyazi/yazi) plugin to show the current partition's used space in the header or status.


## Installation
> [!IMPORTANT]
>
> - This plugin is only supported on Linux (uses `df`)
> - It *might* work with WSL, but that is untested
> - Requires Yazi v25.5.31 or later
Install with `ya`:
```sh
ya pkg add walldmtd/fs-usage
```
## Usage
To use the default setup, add this somewhere in `~/.config/yazi/init.lua`:
```lua
require("fs-usage"):setup()
```
To customize it, add this instead and adjust/remove the options as needed:
```lua
require("fs-usage"):setup({
-- All values are optional
-- Position of the component
-- parent: Parent component ("Header" or "Status")
-- align: Anchor point within parent object ("LEFT" or "RIGHT")
-- order: Order relative to others in the same parent
-- Default: { parent = "Header", align = "RIGHT", order = 2000 }
position = { parent = "Header", align = "RIGHT", order = 2000 },
-- Text format
-- One of:
-- "both": Partition name and percent used
-- "name": Only partition name
-- "usage": Only percent used
-- Default: "both"
format = "both",
-- Option to enable or disable the usage bar
-- Default: true
bar = true,
-- Percent usage to use the warning style (-1 to disable)
-- Default: 90
warning_threshold = 90,
-- For style options, any unset options use the progress bar style
-- from the Yazi flavor if available, otherwise it falls back to
-- the default Yazi style.
-- Label text style
-- fg: Text colour (String like "white", or hex like "#ffffff")
-- (Can also be "" to use the reverse of the bar colour)
-- bold: Make the label bold (bool)
-- italic: Make the label italic (bool)
-- Example: style_label = { fg = "", bold = true, italic = false },
-- Default: {}
style_label = {},
-- Usage bar style
-- fg: Bar colour (String like "blue", or hex like "#0000ff")
-- bg: Bar background colour (Same format as fg)
-- Example: style_normal = { fg = "blue", bg = "black" },
-- Default: {}
style_normal = {},
-- Usage bar style when the used space is above the warning threshold
-- Options are the same as style_normal
-- Default: {}
style_warning = {},
-- Bar padding
-- open: Character on the left (string)
-- close: Character on the right (string)
-- Example: { open = "█", close = "█" } for square corners,
-- or { open = "", close = "" } for no padding
-- Default: { open = "", close = "" }
padding = { open = "", close = "" }
})
```
|