Compare commits
13 Commits
69f0b215bc
...
v1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fd5ed87a2 | ||
|
|
b36f1fd7d7 | ||
|
|
87361a4e6c | ||
|
|
6047399fc7 | ||
|
|
35ec64cbbc | ||
|
|
bb797d75b4 | ||
|
|
92bddadd9d | ||
|
|
d47ce88c0d | ||
|
|
bf9893feba | ||
|
|
4919f74184 | ||
|
|
5770f9106e | ||
|
|
95356ed547 | ||
|
|
418216391b |
52
batteries.go
52
batteries.go
@@ -57,17 +57,20 @@ func UpdateBatteryInfo() {
|
||||
case ch > 85:
|
||||
if Conf.Battery.ChargeColor.Full == "" {
|
||||
chStr = fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>% 3d%%</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>",
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.Full,
|
||||
ch,
|
||||
)
|
||||
} else {
|
||||
chStr = fmt.Sprintf(
|
||||
`<span font='%s' size='%s' foreground='%s'>% 3d%%</span>`,
|
||||
`<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>`,
|
||||
Conf.Battery.ChargeColor.Full,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.Full,
|
||||
ch,
|
||||
)
|
||||
}
|
||||
@@ -75,17 +78,20 @@ func UpdateBatteryInfo() {
|
||||
case ch < 85 && ch > 40:
|
||||
if Conf.Battery.ChargeColor.AlmostFull == "" {
|
||||
chStr = fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>% 3d%%</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>",
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.Full,
|
||||
ch,
|
||||
)
|
||||
} else {
|
||||
chStr = fmt.Sprintf(
|
||||
`<span font='%s' size='%s' foreground='%s'>% 3d%%</span>`,
|
||||
`<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>`,
|
||||
Conf.Battery.ChargeColor.AlmostFull,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.AlmostFull,
|
||||
ch,
|
||||
)
|
||||
}
|
||||
@@ -93,17 +99,20 @@ func UpdateBatteryInfo() {
|
||||
case ch <= 40 && ch >= 10:
|
||||
if Conf.Battery.ChargeColor.AlmostEmpty == "" {
|
||||
chStr = fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>% 3d%%</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>",
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.Full,
|
||||
ch,
|
||||
)
|
||||
} else {
|
||||
chStr = fmt.Sprintf(
|
||||
`<span font='%s' size='%s' foreground='%s'>% 3d%%</span>`,
|
||||
`<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>`,
|
||||
Conf.Battery.ChargeColor.AlmostEmpty,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.AlmostEmpty,
|
||||
ch,
|
||||
)
|
||||
}
|
||||
@@ -111,31 +120,40 @@ func UpdateBatteryInfo() {
|
||||
case ch < 10:
|
||||
if Conf.Battery.ChargeColor.Empty == "" {
|
||||
chStr = fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>% 3d%%</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>",
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.Full,
|
||||
ch,
|
||||
)
|
||||
} else {
|
||||
chStr = fmt.Sprintf(
|
||||
`<span font='%s' size='%s' foreground='%s'>% 3d%%</span>`,
|
||||
`<span color='%s' background='%s' font='%s' size='%s'>% 3d%%</span>`,
|
||||
Conf.Battery.ChargeColor.Empty,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
Conf.Battery.ChargeColor.Empty,
|
||||
ch,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
battsInfo += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>%s</span><span font='%s' size='%s'>B%d </span>%s<span font='%s' size='%s'> %s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span><span color='%s' background='%s' font='%s' size='%s'>B%d </span>%s<span color='%s' background='%s' font='%s' size='%s'> %s</span>",
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.SymbolFont,
|
||||
Conf.Battery.SymbolFontSize,
|
||||
Conf.Battery.Symbol,
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
i,
|
||||
chStr,
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
status,
|
||||
|
||||
21
config.go
21
config.go
@@ -248,14 +248,15 @@ type MyConfig struct {
|
||||
} `json:"vpn,omitempty"`
|
||||
|
||||
SimpleVolumePa struct {
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
Color string `json:"color,omitempty"`
|
||||
Background string `json:"background,omitempty"`
|
||||
Font string `json:"font,omitempty"`
|
||||
FontSize string `json:"font_size,omitempty"`
|
||||
Symbol string `json:"symbol,omitempty"`
|
||||
SymbolFont string `json:"symbol_font,omitempty"`
|
||||
SymbolFontSize string `json:"symbol_font_size,omitempty"`
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
Color string `json:"color,omitempty"`
|
||||
Background string `json:"background,omitempty"`
|
||||
Font string `json:"font,omitempty"`
|
||||
FontSize string `json:"font_size,omitempty"`
|
||||
Symbol string `json:"symbol,omitempty"`
|
||||
SymbolFont string `json:"symbol_font,omitempty"`
|
||||
SymbolFontSize string `json:"symbol_font_size,omitempty"`
|
||||
DontExitOnLogin bool `json:"dont_exit_on_login,omitempty"`
|
||||
|
||||
Separator struct {
|
||||
Left struct {
|
||||
@@ -743,14 +744,14 @@ func readConf() (MyConfig, error) {
|
||||
} else {
|
||||
matched, err := regexp.MatchString(
|
||||
`^(xx-small|x-small|small|medium|large|x-large|xx-large|smaller|larger)$`,
|
||||
sampleConfig.Clock.Separator.Right.FontSize,
|
||||
sampleConfig.Mem.Separator.Right.FontSize,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
log.Printf(
|
||||
"Unable to set sampleConfig.Mem.Separator.Right.FontSize: %s, fallback to %s",
|
||||
err,
|
||||
sampleConfig.Clock.Separator.Right.FontSize,
|
||||
sampleConfig.Mem.Separator.Right.FontSize,
|
||||
)
|
||||
|
||||
sampleConfig.Mem.Separator.Right.FontSize = sampleConfig.Separator.Right.FontSize
|
||||
|
||||
793
config_examples/example0.json
Normal file
793
config_examples/example0.json
Normal file
@@ -0,0 +1,793 @@
|
||||
{
|
||||
// Memory stats
|
||||
"mem" : {
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined up here.
|
||||
"color": "#ffffff",
|
||||
|
||||
// If omitted set to default background color defined up here.
|
||||
"background": "#008099",
|
||||
|
||||
// If omitted set to default font defined up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
|
||||
"font_size": "large",
|
||||
|
||||
// Do we show used swap megs?
|
||||
"show_swap": false,
|
||||
|
||||
// Re-define separator parameters for net-if block here.
|
||||
"separator" : {
|
||||
"left": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#000000",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#008099",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": " ",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "large"
|
||||
},
|
||||
|
||||
"right": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#008099",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#fae864",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": " ",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "large"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Load Average
|
||||
"la" : {
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined up here.
|
||||
"background": "#fae864",
|
||||
|
||||
// If omitted set to default font defined up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
|
||||
"font_size": "x-large",
|
||||
|
||||
// Re-define separator parameters for net-if block here.
|
||||
"separator" : {
|
||||
"left": {
|
||||
// Set to false if omitted.
|
||||
"enabled": false,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#e00000",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#e00000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "large"
|
||||
},
|
||||
|
||||
"right": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#fae864",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#5bde52",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": " ",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "large"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"net-if" : {
|
||||
"enabled" : false,
|
||||
|
||||
// If omitted set to default color defined up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default font defined up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
|
||||
"font_size": "medium",
|
||||
|
||||
// Net interface down symbol color, in html notation.
|
||||
"down_color" : "red",
|
||||
|
||||
// Net interface up symbol color, in html notation.
|
||||
"up_color" : "green",
|
||||
|
||||
// Re-define separator parameters for net-if block here.
|
||||
"separator": {
|
||||
"left": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "medium"
|
||||
},
|
||||
|
||||
"right": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "◀",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "medium"
|
||||
}
|
||||
},
|
||||
|
||||
"if" : [
|
||||
{
|
||||
// Name as it displayed on i3bar
|
||||
"name" : "eth0",
|
||||
|
||||
// Directory containing net if status files
|
||||
"dir" : "/sys/class/net/eth0"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// OpenVPN status. Note that directive status in openvpn.conf should point to state file and *update* its timestamp at
|
||||
// least as frequent as mtime_threshold in seconds.
|
||||
"vpn": {
|
||||
"enabled": false,
|
||||
|
||||
// If omitted set to default color defined up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default font defined up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
|
||||
"font_size": "medium",
|
||||
|
||||
// Status file location. Plugin will be disabled if this value omitted.
|
||||
"statusfile" : "/tmp/openvpn-status.stat",
|
||||
|
||||
// mtime check period.
|
||||
"mtime_threshold": 10,
|
||||
|
||||
// Vpn down symbol color, in html notation.
|
||||
"down_color" : "red",
|
||||
|
||||
// Vpn up symbol color, in html notation.
|
||||
"up_color" : "green",
|
||||
|
||||
// Re-define separator parameters for net-if block here.
|
||||
"separator": {
|
||||
"left": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "▶",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "medium"
|
||||
},
|
||||
|
||||
"right": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "◀",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "medium"
|
||||
}
|
||||
},
|
||||
|
||||
// Also we can tcp-ping some service inside vpn network to ensure that connection is not stoned.
|
||||
"tcp_check" : {
|
||||
"enabled": false,
|
||||
"host": "somehost.tld",
|
||||
"port": 443,
|
||||
"timeout" : 3
|
||||
}
|
||||
},
|
||||
|
||||
// Simple sound volume indicator
|
||||
"simple-volume-pa": {
|
||||
"enabled": false,
|
||||
|
||||
// If omitted set to default color defined up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined up here.
|
||||
"background": "#666666",
|
||||
|
||||
// If omitted set to default font defined up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
|
||||
"font_size": "large",
|
||||
|
||||
"symbol": "🔊",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of the relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to value of simple-volume-pa.font_size by default.
|
||||
"symbol_font_size": "large",
|
||||
|
||||
// If not defined - will be "true"
|
||||
"right_click_cmd": ["pavucontrol"],
|
||||
|
||||
// Change volume step in %, if not configured it is 5
|
||||
"step": 3,
|
||||
|
||||
// We'll change volume level with mouse wheel. Under X11 it is mapped to some buttons, typically 4 and 5 (z-axis).
|
||||
// If omited, default value is 4
|
||||
"wheel_up": 4,
|
||||
|
||||
// If omited, default value is 5
|
||||
"wheel_down": 5,
|
||||
|
||||
// Maximum sound volume, can be over 100%, but sould not be :) Default value 100 if not set.
|
||||
"max_volume_limit": 120,
|
||||
|
||||
// Re-define separator parameters for net-if block here.
|
||||
"separator": {
|
||||
"left": {
|
||||
// Set to false if omitted.
|
||||
"enabled": false,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "▶",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "medium"
|
||||
},
|
||||
|
||||
"right": {
|
||||
// Set to false if omitted.
|
||||
"enabled": false,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "◀",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "medium"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Just clock
|
||||
"clock": {
|
||||
"enabled" : true,
|
||||
|
||||
// If omitted set to default color defined up here.
|
||||
"color": "#000000",
|
||||
|
||||
// If omitted set to default background color defined up here.
|
||||
"background": "#5bde52",
|
||||
|
||||
// If omitted set to default font defined up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
|
||||
"font_size": "large",
|
||||
|
||||
// Re-define separator parameters for net-if block here.
|
||||
"separator": {
|
||||
"left": {
|
||||
// Set to false if omitted.
|
||||
"enabled": false,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "▶",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "medium"
|
||||
},
|
||||
|
||||
"right": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#5bde52",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": " ",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "large"
|
||||
}
|
||||
},
|
||||
|
||||
"left_click" : {
|
||||
"enabled" : false,
|
||||
// cmd is array of command itself and its arguments
|
||||
"cmd" : [ "orage" ]
|
||||
},
|
||||
|
||||
"right_click" : {
|
||||
"enabled" : false,
|
||||
"cmd" : [ "true" ]
|
||||
}
|
||||
},
|
||||
|
||||
// Battery, useful for laptops
|
||||
"battery": {
|
||||
"enabled": false,
|
||||
|
||||
// If omitted set to default color defined up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default font defined up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
|
||||
"font_size": "medium",
|
||||
|
||||
// If omitted "⚡" (no quotes) is used.
|
||||
"symbol": "⚡",
|
||||
|
||||
// If omitted battery.font is used.
|
||||
"symbol_font" : "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of the relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to value of simple-volume-pa.font_size by default.
|
||||
"symbol_font_size": "large",
|
||||
|
||||
"charge_color": {
|
||||
// colors in html notation
|
||||
"full": "green",
|
||||
"empty": "red",
|
||||
"almost_full": "yellow",
|
||||
"almost_empty": "orange"
|
||||
},
|
||||
|
||||
// Re-define separator parameters for net-if block here.
|
||||
"separator": {
|
||||
"left": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "▶",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "medium"
|
||||
},
|
||||
|
||||
"right": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "◀",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "medium"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// CPU Temperature monitor, shows average value among given sources
|
||||
"cpu_temp": {
|
||||
"enabled": false,
|
||||
|
||||
// If omitted set to default color defined up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default font defined up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined up here.
|
||||
"font_size": "medium",
|
||||
|
||||
// Re-define separator parameters for net-if block here.
|
||||
"separator": {
|
||||
"left": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "▶",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "medium"
|
||||
},
|
||||
|
||||
"right": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "◀",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "medium"
|
||||
}
|
||||
},
|
||||
|
||||
// Files in sysfs that contains cpu temperatures
|
||||
"file": [
|
||||
"/sys/class/hwmon/hwmon4/temp2_input",
|
||||
"/sys/class/hwmon/hwmon4/temp3_input",
|
||||
"/sys/class/hwmon/hwmon4/temp4_input",
|
||||
"/sys/class/hwmon/hwmon4/temp5_input",
|
||||
"/sys/class/hwmon/hwmon4/temp6_input",
|
||||
"/sys/class/hwmon/hwmon4/temp7_input"
|
||||
]
|
||||
},
|
||||
|
||||
// Intended mainly for use with desktop notifications
|
||||
// Because it inherits all env vars from i3, it can intercat with dbus and other
|
||||
// such user session services.
|
||||
"cron" : {
|
||||
"enabled" : false,
|
||||
|
||||
"tasks" : [
|
||||
{
|
||||
// Time in crontab notation
|
||||
"time" : "55 23 * * *",
|
||||
"cmd" : [
|
||||
"notify-send", "Sleeping Time!", "Take a nap."
|
||||
]
|
||||
},
|
||||
{
|
||||
// time in crontab format
|
||||
"time" : "55 12 * * 2,4",
|
||||
// commands as it should be invoked in bash script
|
||||
"cmd" : [
|
||||
"notify-send", "Pizza time!", "M-m-m, tasty!"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// Whether to display Application Buttons.
|
||||
"app_buttons": {
|
||||
"enabled": true,
|
||||
|
||||
// Re-define separator parameters for net-if block here.
|
||||
"separator": {
|
||||
"left": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "-",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "medium"
|
||||
},
|
||||
|
||||
"right": {
|
||||
// Set to false if omitted.
|
||||
"enabled": true,
|
||||
|
||||
// If omitted set to default color defined for separator up here.
|
||||
"color": "#3e78fd",
|
||||
|
||||
// If omitted set to default background color defined for separator up here.
|
||||
"background": "#000000",
|
||||
|
||||
// If omitted set to default symbol defined for separator up here.
|
||||
"symbol": "◀",
|
||||
|
||||
// If omitted set to default font defined for separator up here.
|
||||
"font": "Noto Sans",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for separator up here.
|
||||
"font_size": "medium"
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// Buttons - application launch "buttons"
|
||||
"apps": [
|
||||
{
|
||||
// Text dispalyed on button
|
||||
"full_text" : "📂",
|
||||
// Internal name, can be any string, but unique for each app button
|
||||
"name" : "thunar",
|
||||
// Command itself
|
||||
"cmd" : "thunar",
|
||||
// Array of command args, optional
|
||||
"args": [ "." ],
|
||||
// Regexp that match with Instance component of WM_CLASS(STRING) of xprop output
|
||||
"instance": "^thunar$",
|
||||
// Regexp that match with Class component of WM_CLASS(STRING) of xprop output
|
||||
"class": "^Thunar$",
|
||||
// text color in html notation
|
||||
"color": "#ffa500",
|
||||
// background color in html notation
|
||||
"background" : "#000000",
|
||||
// border color in html notation
|
||||
"border": "#666666",
|
||||
// border color if there is at least one window with given Instance and/or Class exist
|
||||
"border_active": "#3e78fd",
|
||||
// Vertical line between objects on bar - if omitted true value is assumed by i3bar, but we set it to false
|
||||
// in that case. It is limitation of golang json parser.
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " ♬ ",
|
||||
"name" : "deadbeef",
|
||||
"cmd" : "deadbeef",
|
||||
"instance" : "^deadbeef$",
|
||||
"class" : "^Deadbeef$",
|
||||
"color" : "#00aa33",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " Term ",
|
||||
"name" : "xterm",
|
||||
"cmd" : "xterm",
|
||||
"instance" : "^xterm$",
|
||||
"class" : "^XTerm$",
|
||||
"color" : "#666666",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " Ff ",
|
||||
"name" : "firefox",
|
||||
"cmd" : "firefox",
|
||||
"instance" : "^Navigator$",
|
||||
"class" : "^Firefox$",
|
||||
"color" : "#ffa500",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " C ",
|
||||
"name" : "chrome",
|
||||
"cmd" : "chrome",
|
||||
"instance" : "^google-chrome$",
|
||||
"class" : "^Google-chrome$",
|
||||
"color" : "#ffa500",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " @ ",
|
||||
"name" : "thunderbird",
|
||||
"cmd" : "thunderbird",
|
||||
"instance" : "^Mail$",
|
||||
"class" : "^Thunderbird$",
|
||||
"color" : "#006994",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " Tg ",
|
||||
"name" : "telegram",
|
||||
"cmd" : "Telegram",
|
||||
"instance" : "^Telegram$",
|
||||
"class" : "^TelegramDesktop$",
|
||||
"color" : "#5a8850",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " T ",
|
||||
"name" : "mousepad",
|
||||
"cmd" : "mousepad",
|
||||
"instance" : "^mousepad$",
|
||||
"class" : "^Mousepad$",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
438
config_examples/example1.json
Normal file
438
config_examples/example1.json
Normal file
@@ -0,0 +1,438 @@
|
||||
{
|
||||
// Default text and *block* border colors. If not set #3e78fd is used.
|
||||
"color" : "#3e78fd",
|
||||
|
||||
// Default backbround color. If not set value of #edeceb is used.
|
||||
"background" : "#000000",
|
||||
|
||||
"separator": {
|
||||
"left": {
|
||||
"enabled": false,
|
||||
"color": "#3e78fd",
|
||||
"background": "#000000",
|
||||
"symbol": "|",
|
||||
"font": "Noto Sans",
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’
|
||||
"font_size": "medium"
|
||||
},
|
||||
|
||||
"right": {
|
||||
// False if value omitted
|
||||
"enabled": false,
|
||||
// Used #edeceb as default if value omitted
|
||||
"color": "#3e78fd",
|
||||
// If not set #3e78fd is used.
|
||||
"background": "#000000",
|
||||
// If omitted, used "|" (no quotes) as default
|
||||
"symbol": "|",
|
||||
"font": "Noto Sans",
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of relative sizes
|
||||
// ‘smaller’ or ‘larger’
|
||||
"font_size": "medium"
|
||||
}
|
||||
},
|
||||
|
||||
// Memory stats
|
||||
"mem" : {
|
||||
"enabled": true,
|
||||
"show_swap": false,
|
||||
|
||||
"separator" : {
|
||||
"left": {
|
||||
"enabled": true,
|
||||
"symbol": " |"
|
||||
}
|
||||
|
||||
"right": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Load Average
|
||||
"la" : {
|
||||
"enabled": true,
|
||||
|
||||
"separator" : {
|
||||
"right": {
|
||||
"enabled": true,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"net-if" : {
|
||||
"enabled" : false,
|
||||
// In html notation
|
||||
"down_color" : "red",
|
||||
"up_color" : "green",
|
||||
|
||||
"separator" : {
|
||||
"right": {
|
||||
"enabled": true,
|
||||
}
|
||||
},
|
||||
|
||||
"if" : [
|
||||
{
|
||||
// Name as it displayed on i3bar
|
||||
"name" : "eth0",
|
||||
// Directory containing net if status files
|
||||
"dir" : "/sys/class/net/eth0"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// OpenVPN status. Note that directive status in openvpn.conf should point to
|
||||
// state file and *update* its timestamp at least as frequent as mtime_threshold in seconds
|
||||
"vpn": {
|
||||
"enabled": false,
|
||||
"statusfile" : "/tmp/openvpn-status.stat",
|
||||
"mtime_threshold": 10,
|
||||
// Color in html notation
|
||||
"down_color" : "red",
|
||||
"up_color" : "green",
|
||||
|
||||
"separator" : {
|
||||
"right": {
|
||||
"enabled": true,
|
||||
}
|
||||
},
|
||||
|
||||
// Also we can tcp-ping some service inside vpn network to ensure that connection is not stoned
|
||||
"tcp_check" : {
|
||||
"enabled": false,
|
||||
"host": "somehost.tld",
|
||||
"port": 443,
|
||||
"timeout" : 3
|
||||
}
|
||||
},
|
||||
|
||||
// Simple sound volume indicator
|
||||
"simple-volume-pa": {
|
||||
"enabled": true,
|
||||
"symbol": "VOL",
|
||||
|
||||
// ‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’, or one of the relative sizes
|
||||
// ‘smaller’ or ‘larger’. If omitted set to medium by default.
|
||||
"font_size": "medium",
|
||||
|
||||
// If not defined - will be "true"
|
||||
"right_click_cmd": ["pavucontrol"],
|
||||
|
||||
// Change volume step in %, if not configured it is 5
|
||||
"step": 3,
|
||||
|
||||
// We'll change volume level with mouse wheel. Under X11 it is mapped to some buttons, typically 4 and 5 (z-axis).
|
||||
// If omited, default value is 4
|
||||
"wheel_up": 4,
|
||||
|
||||
// If omited, default value is 5
|
||||
"wheel_down": 5,
|
||||
|
||||
// Maximum sound volume, can be over 100%, but sould not be :) Default value 100 if not set.
|
||||
"max_volume_limit": 120,
|
||||
|
||||
"separator" : {
|
||||
"right": {
|
||||
"enabled": true,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Just clock
|
||||
"clock": {
|
||||
"enabled" : true,
|
||||
// Text color in html (actually, pango) notation
|
||||
"color" : "#666666",
|
||||
"font_size": "large",
|
||||
|
||||
"separator" : {
|
||||
"right": {
|
||||
"enabled": false,
|
||||
}
|
||||
},
|
||||
|
||||
"left_click" : {
|
||||
"enabled" : false,
|
||||
// cmd is array of command itself and its arguments
|
||||
"cmd" : [ "orage" ]
|
||||
},
|
||||
|
||||
"right_click" : {
|
||||
"enabled" : false,
|
||||
"cmd" : [ "true" ]
|
||||
}
|
||||
},
|
||||
|
||||
// Battery, useful for laptops
|
||||
"battery": {
|
||||
"enabled": false,
|
||||
|
||||
"charge_color": {
|
||||
// colors in html notation
|
||||
"full": "green",
|
||||
"empty": "red",
|
||||
"almost_full": "yellow",
|
||||
"almost_empty": "orange"
|
||||
},
|
||||
|
||||
"separator" : {
|
||||
"right": {
|
||||
"enabled": true,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// CPU Temperature monitor, shows average value among given sources
|
||||
"cpu_temp": {
|
||||
"enabled": false,
|
||||
|
||||
"separator" : {
|
||||
"right": {
|
||||
"enabled": true,
|
||||
}
|
||||
},
|
||||
|
||||
// Files in sysfs that contains cpu temperatures
|
||||
"file": [
|
||||
"/sys/class/hwmon/hwmon4/temp2_input",
|
||||
"/sys/class/hwmon/hwmon4/temp3_input",
|
||||
"/sys/class/hwmon/hwmon4/temp4_input",
|
||||
"/sys/class/hwmon/hwmon4/temp5_input",
|
||||
"/sys/class/hwmon/hwmon4/temp6_input",
|
||||
"/sys/class/hwmon/hwmon4/temp7_input"
|
||||
]
|
||||
},
|
||||
|
||||
// Intended mainly for use with desktop notifications
|
||||
// Because it inherits all env vars from i3, it can intercat with dbus and other
|
||||
// such user session services.
|
||||
"cron" : {
|
||||
"enabled" : false,
|
||||
|
||||
"tasks" : [
|
||||
{
|
||||
// Time in crontab notation
|
||||
"time" : "55 23 * * *",
|
||||
"cmd" : [
|
||||
"notify-send", "Sleeping Time!", "Take a nap."
|
||||
]
|
||||
},
|
||||
{
|
||||
// time in crontab format
|
||||
"time" : "55 12 * * 2,4",
|
||||
// commands as it should be invoked in bash script
|
||||
"cmd" : [
|
||||
"notify-send", "Pizza time!", "M-m-m, tasty!"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// Weather to display Application Buttons
|
||||
"app_buttons": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
// Buttons - application launch "buttons"
|
||||
"apps": [
|
||||
{
|
||||
"full_text" : "📂",
|
||||
"name" : "thunar",
|
||||
"cmd" : "thunar",
|
||||
"instance": "thunar",
|
||||
"class": "Thunar",
|
||||
"color": "#ffa500",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 9
|
||||
},
|
||||
{
|
||||
"full_text" : " ♬ ",
|
||||
"name" : "deadbeef",
|
||||
"cmd" : "deadbeef",
|
||||
"instance" : "deadbeef",
|
||||
"class" : "Deadbeef",
|
||||
"color" : "#00aa33",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " Term ",
|
||||
"name" : "alacritty",
|
||||
"cmd" : "alacritty",
|
||||
"instance" : "Alacritty",
|
||||
"class" : "Alacritty",
|
||||
"color" : "#666666",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 9
|
||||
},
|
||||
{
|
||||
"full_text" : " E ",
|
||||
"name" : "edge",
|
||||
"cmd" : "edge",
|
||||
"instance" : "microsoft-edge",
|
||||
"class" : "Microsoft-edge",
|
||||
"color" : "#ffa500",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " Ff ",
|
||||
"name" : "firefox",
|
||||
"cmd" : "firefox",
|
||||
"instance" : "Navigator",
|
||||
"class" : "Firefox",
|
||||
"color" : "#ff5f1f",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " V ",
|
||||
"name" : "vivaldi",
|
||||
"cmd" : "Vivaldi",
|
||||
"instance" : "vivaldi-stable",
|
||||
"class" : "Vivaldi-stable",
|
||||
"color" : "#ffa500",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " C ",
|
||||
"name" : "chrome",
|
||||
"cmd" : "chrome",
|
||||
"instance" : "google-chrome",
|
||||
"class" : "Google-chrome",
|
||||
"color" : "#ffa500",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 9
|
||||
},
|
||||
{
|
||||
"full_text" : " @ ",
|
||||
"name" : "thunderbird",
|
||||
"cmd" : "thunderbird",
|
||||
"instance" : "Mail",
|
||||
"class" : "Thunderbird",
|
||||
"color" : "#006994",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " Tg ",
|
||||
"name" : "telegram",
|
||||
"cmd" : "Telegram",
|
||||
"instance" : "Telegram",
|
||||
"class" : "TelegramDesktop",
|
||||
"color" : "#5a8850",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " D ",
|
||||
"name" : "discord",
|
||||
"cmd" : "Discord",
|
||||
"instance" : "discord",
|
||||
"class" : "discord",
|
||||
"color" : "#5a8850",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " H ",
|
||||
"name" : "hexchat",
|
||||
"cmd" : "hexchat",
|
||||
"instance" : "hexchat",
|
||||
"class" : "Hexchat",
|
||||
"color" : "#5a8850",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : "Psi",
|
||||
"name" : "psi-plus",
|
||||
"cmd" : "psi-plus",
|
||||
"instance" : "psi-plus",
|
||||
"class" : "Psi-plus",
|
||||
"color" : "#5a8850",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 9
|
||||
},
|
||||
{
|
||||
"full_text" : " T ",
|
||||
"name" : "mousepad",
|
||||
"cmd" : "mousepad",
|
||||
"instance" : "mousepad",
|
||||
"class" : "Mousepad",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " VSC ",
|
||||
"name" : "code",
|
||||
"cmd" : "code",
|
||||
"instance" : "code",
|
||||
"class" : "Code",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " G ",
|
||||
"name" : "goland",
|
||||
"cmd" : "goland",
|
||||
"instance" : "goland",
|
||||
"class" : "Goland",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 2
|
||||
},
|
||||
{
|
||||
"full_text" : " ▢ ",
|
||||
"name" : "ToolBox",
|
||||
"cmd" : "/home/eleksir/.local/share/JetBrains/Toolbox/bin/jetbrains-toolbox",
|
||||
"instance" : "JetBrains Toolbox",
|
||||
"class" : "jetbrains-toolbox",
|
||||
"border": "#666666",
|
||||
"border_active": "#3e78fd",
|
||||
"separator": false,
|
||||
"separator_block_width": 9
|
||||
},
|
||||
{
|
||||
"full_text" : " 🔑 ",
|
||||
"name" : "keepassxc",
|
||||
"cmd" : "kee",
|
||||
"instance" : "keepassxc",
|
||||
"class" : "KeePassXC",
|
||||
"color" : "#7ec850",
|
||||
"border" : "#666666",
|
||||
"border_active" : "#3e78fd"
|
||||
}
|
||||
]
|
||||
}
|
||||
12
go.mod
12
go.mod
@@ -5,9 +5,9 @@ go 1.21
|
||||
require (
|
||||
github.com/adrg/xdg v0.4.0
|
||||
github.com/distatus/battery v0.11.0
|
||||
github.com/go-co-op/gocron/v2 v2.1.2
|
||||
github.com/go-co-op/gocron/v2 v2.2.9
|
||||
github.com/hjson/hjson-go v3.3.0+incompatible
|
||||
github.com/mafik/pulseaudio v0.0.0-20200511091429-8449222912dd
|
||||
github.com/mafik/pulseaudio v0.0.0-20240327130323-384e01075e6e
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
||||
go.i3wm.org/i3 v0.0.0-20190720062127-36e6ec85cc5a
|
||||
)
|
||||
@@ -16,11 +16,11 @@ require (
|
||||
github.com/BurntSushi/xgb v0.0.0-20210121224620-deaf085860bc // indirect
|
||||
github.com/BurntSushi/xgbutil v0.0.0-20190907113008-ad855c713046 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
github.com/google/uuid v1.5.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/jonboulle/clockwork v0.4.0 // indirect
|
||||
github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.3 // indirect
|
||||
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect
|
||||
golang.org/x/sys v0.16.0 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
||||
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
howett.net/plist v1.0.1 // indirect
|
||||
)
|
||||
|
||||
32
go.sum
32
go.sum
@@ -11,23 +11,23 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/distatus/battery v0.11.0 h1:KJk89gz90Iq/wJtbjjM9yUzBXV+ASV/EG2WOOL7N8lc=
|
||||
github.com/distatus/battery v0.11.0/go.mod h1:KmVkE8A8hpIX4T78QRdMktYpEp35QfOL8A8dwZBxq2k=
|
||||
github.com/go-co-op/gocron/v2 v2.1.2 h1:+6tTOA9aBaKXpDWExw07hYoGEBzT+4CkGSVAiJ7WSXs=
|
||||
github.com/go-co-op/gocron/v2 v2.1.2/go.mod h1:0MfNAXEchzeSH1vtkZrTAcSMWqyL435kL6CA4b0bjrg=
|
||||
github.com/go-co-op/gocron/v2 v2.2.9 h1:aoKosYWSSdXFLecjFWX1i8+R6V7XdZb8sB2ZKAY5Yis=
|
||||
github.com/go-co-op/gocron/v2 v2.2.9/go.mod h1:mZx3gMSlFnb97k3hRqX3+GdlG3+DUwTh6B8fnsTScXg=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
||||
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
||||
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
|
||||
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/hjson/hjson-go v3.3.0+incompatible h1:Rqr+Ya+0aCJMjaE4s8E9YKvuJLuLVpEvz4ONum52vnI=
|
||||
github.com/hjson/hjson-go v3.3.0+incompatible/go.mod h1:qsetwF8NlsTsOTwZTApNlTCerV+b2GjYRRcIk4JMFio=
|
||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4=
|
||||
github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc=
|
||||
github.com/mafik/pulseaudio v0.0.0-20200511091429-8449222912dd h1:gn6oLpDCn3wY+1WfbbP0OwxXL+2eHi3mxF/DsNyPHUM=
|
||||
github.com/mafik/pulseaudio v0.0.0-20200511091429-8449222912dd/go.mod h1:dlpd1fnLAhI6g9tM/aCobgN/Yka1/SkHrBTfAgDdb9Q=
|
||||
github.com/mafik/pulseaudio v0.0.0-20240327130323-384e01075e6e h1:y6jINFpNNS+IEizD6s9j35aKVNRsfsoEKN8IStRDQm0=
|
||||
github.com/mafik/pulseaudio v0.0.0-20240327130323-384e01075e6e/go.mod h1:dlpd1fnLAhI6g9tM/aCobgN/Yka1/SkHrBTfAgDdb9Q=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
||||
@@ -36,25 +36,25 @@ github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKl
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
|
||||
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
go.i3wm.org/i3 v0.0.0-20190720062127-36e6ec85cc5a h1:yeQv6GWN8DsA2f3b+u1zhRIJg2HmsGYqXsd+W7ULr7Q=
|
||||
go.i3wm.org/i3 v0.0.0-20190720062127-36e6ec85cc5a/go.mod h1:7w17+r1F28Yxb1pHu8SxARJo+RGvJCAGOEf+GLw+2aQ=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM=
|
||||
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
|
||||
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc h1:ZMCWScCvS2fUVFw8LOpxyUUW5qiviqr4Dg5NdjLeiLU=
|
||||
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY=
|
||||
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI=
|
||||
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
|
||||
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
|
||||
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
@@ -386,6 +386,14 @@
|
||||
// Maximum sound volume, can be over 100%, but sould not be :) Default value 100 if not set.
|
||||
"max_volume_limit": 120,
|
||||
|
||||
// PA has annoying feature - socket activation. Sound system must persist and be available to all users regardless
|
||||
// of init or other things. They just fail to understand that. Or they fucked up pulseaudio just because they scary
|
||||
// of security something of resposibility. Anyway this is grand disign flaw, but we still have to bear with it.
|
||||
// This setting defines if pulseaudion will be run in manner that allows it to exit is other login detected (how
|
||||
// they guess it - I do not know). In general case we do not want allow pa to exit and leave our session without
|
||||
// audio.
|
||||
"dont_exit_on_login": true,
|
||||
|
||||
// Re-define separator parameters for net-if block here.
|
||||
"separator": {
|
||||
"left": {
|
||||
|
||||
169
main.go
169
main.go
@@ -19,10 +19,10 @@ type I3BarOutBlock struct {
|
||||
Color string `json:"color,omitempty"`
|
||||
Background string `json:"background,omitempty"`
|
||||
Border string `json:"border,omitempty"`
|
||||
BorderTop int `json:"border_top,omitempty"`
|
||||
BorderRight int `json:"border_right,omitempty"`
|
||||
BorderBottom int `json:"border_bottom,omitempty"`
|
||||
BorderLeft int `json:"border_left,omitempty"`
|
||||
BorderTop int `json:"border_top"`
|
||||
BorderRight int `json:"border_right"`
|
||||
BorderBottom int `json:"border_bottom"`
|
||||
BorderLeft int `json:"border_left"`
|
||||
// measured either in pixels or in characters, so either int or string, let's make it string :)
|
||||
MinWidth string `json:"min_width,omitempty"`
|
||||
Align string `json:"align,omitempty"`
|
||||
@@ -36,6 +36,7 @@ type I3BarOutBlock struct {
|
||||
|
||||
// UpdateReady channel that "refreshes" i3bar (generates stdout json line).
|
||||
var UpdateReady = make(chan bool)
|
||||
var MsgChan = make(chan []I3BarOutBlock, 64)
|
||||
|
||||
//go:embed i3status-go-example.json
|
||||
var EmbeddedDefaultConfig embed.FS
|
||||
@@ -51,6 +52,48 @@ func main() {
|
||||
|
||||
Conf, err = readConf()
|
||||
|
||||
// TODO: Проставить дефолтные значения для глобальных переменных модулей.
|
||||
Batt = fmt.Sprintf(
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.SymbolFont,
|
||||
Conf.Battery.SymbolFontSize,
|
||||
Conf.Battery.Symbol,
|
||||
)
|
||||
|
||||
Batt += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' font='%s' size='%s'> ??%% •</span>",
|
||||
Conf.Battery.Color,
|
||||
Conf.Battery.Background,
|
||||
Conf.Battery.Font,
|
||||
Conf.Battery.FontSize,
|
||||
)
|
||||
|
||||
SoundVolume = fmt.Sprintf(
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>🔊</span>",
|
||||
Conf.SimpleVolumePa.Color,
|
||||
Conf.SimpleVolumePa.Background,
|
||||
Conf.SimpleVolumePa.SymbolFont,
|
||||
Conf.SimpleVolumePa.SymbolFontSize,
|
||||
)
|
||||
|
||||
SoundVolume += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>:0%%</span>",
|
||||
Conf.SimpleVolumePa.Color,
|
||||
Conf.SimpleVolumePa.Background,
|
||||
Conf.SimpleVolumePa.Font,
|
||||
Conf.SimpleVolumePa.FontSize,
|
||||
)
|
||||
|
||||
Clock = fmt.Sprintf(
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>Thu, 1 Jan 1970 1:00</span>",
|
||||
Conf.Clock.Color,
|
||||
Conf.Clock.Background,
|
||||
Conf.Clock.Font,
|
||||
Conf.Clock.FontSize,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
log.Panicln(err)
|
||||
}
|
||||
@@ -58,6 +101,8 @@ func main() {
|
||||
go Spawner()
|
||||
go ParseStdin()
|
||||
go CleanZombies()
|
||||
go SVPAHandler()
|
||||
go PrintToI3bar()
|
||||
|
||||
if Conf.AppButtons.Enabled {
|
||||
go UpdateI3WinList()
|
||||
@@ -67,7 +112,10 @@ func main() {
|
||||
go sigHandler()
|
||||
signal.Notify(sigChan,
|
||||
syscall.SIGUSR1,
|
||||
syscall.SIGUSR2)
|
||||
syscall.SIGUSR2,
|
||||
syscall.SIGQUIT,
|
||||
syscall.SIGTERM,
|
||||
syscall.SIGINT)
|
||||
|
||||
// Populate memory stats
|
||||
if Conf.Mem.Enabled {
|
||||
@@ -138,9 +186,10 @@ func main() {
|
||||
|
||||
if num == 0 {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.AppButtons.Separator.Left.Color,
|
||||
Conf.AppButtons.Separator.Left.Background,
|
||||
Conf.AppButtons.Separator.Left.Font,
|
||||
Conf.AppButtons.Separator.Left.FontSize,
|
||||
Conf.AppButtons.Separator.Left.Symbol,
|
||||
)
|
||||
@@ -150,9 +199,10 @@ func main() {
|
||||
|
||||
if num == len(Conf.Apps) {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.AppButtons.Separator.Right.Color,
|
||||
Conf.AppButtons.Separator.Right.Background,
|
||||
Conf.AppButtons.Separator.Right.Font,
|
||||
Conf.AppButtons.Separator.Right.FontSize,
|
||||
Conf.AppButtons.Separator.Right.Symbol,
|
||||
)
|
||||
@@ -172,6 +222,11 @@ func main() {
|
||||
b.Border = app.Border
|
||||
}
|
||||
|
||||
b.BorderTop = 1
|
||||
b.BorderRight = 1
|
||||
b.BorderBottom = 1
|
||||
b.BorderLeft = 1
|
||||
|
||||
j = append(j, b)
|
||||
}
|
||||
}
|
||||
@@ -184,16 +239,19 @@ func main() {
|
||||
|
||||
if Conf.CPUTemp.Separator.Left.Enabled {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.CPUTemp.Separator.Left.Color,
|
||||
Conf.CPUTemp.Separator.Left.Background,
|
||||
Conf.CPUTemp.Separator.Left.Font,
|
||||
Conf.CPUTemp.Separator.Left.FontSize,
|
||||
Conf.CPUTemp.Separator.Left.Symbol,
|
||||
)
|
||||
}
|
||||
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>CPU: %d°</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>CPU: %d°</span>",
|
||||
Conf.CPUTemp.Color,
|
||||
Conf.CPUTemp.Background,
|
||||
Conf.CPUTemp.Font,
|
||||
Conf.CPUTemp.FontSize,
|
||||
CPUTemperature,
|
||||
@@ -201,9 +259,10 @@ func main() {
|
||||
|
||||
if Conf.CPUTemp.Separator.Right.Enabled {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.CPUTemp.Separator.Right.Color,
|
||||
Conf.CPUTemp.Separator.Right.Background,
|
||||
Conf.CPUTemp.Separator.Right.Font,
|
||||
Conf.CPUTemp.Separator.Right.FontSize,
|
||||
Conf.CPUTemp.Separator.Right.Symbol,
|
||||
)
|
||||
@@ -223,9 +282,10 @@ func main() {
|
||||
|
||||
if Conf.Mem.Separator.Left.Enabled {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Mem.Separator.Left.Color,
|
||||
Conf.Mem.Separator.Left.Background,
|
||||
Conf.Mem.Separator.Left.Font,
|
||||
Conf.Mem.Separator.Left.FontSize,
|
||||
Conf.Mem.Separator.Left.Symbol,
|
||||
)
|
||||
@@ -233,7 +293,9 @@ func main() {
|
||||
|
||||
if Conf.Mem.ShowSwap {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>M:%d%% SHM:%dM SW:%dM</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>M:%d%% SHM:%dM SW:%dM</span>",
|
||||
Conf.Mem.Color,
|
||||
Conf.Mem.Background,
|
||||
Conf.Mem.Font,
|
||||
Conf.Mem.FontSize,
|
||||
Memory.Usedpct,
|
||||
@@ -242,7 +304,9 @@ func main() {
|
||||
)
|
||||
} else {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>M:%d%% SHM:%dM</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>M:%d%% SHM:%dM</span>",
|
||||
Conf.Mem.Color,
|
||||
Conf.Mem.Background,
|
||||
Conf.Mem.Font,
|
||||
Conf.Mem.FontSize,
|
||||
Memory.Usedpct,
|
||||
@@ -252,9 +316,10 @@ func main() {
|
||||
|
||||
if Conf.Mem.Separator.Right.Enabled {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Mem.Separator.Right.Color,
|
||||
Conf.Mem.Separator.Right.Background,
|
||||
Conf.Mem.Separator.Right.Font,
|
||||
Conf.Mem.Separator.Right.FontSize,
|
||||
Conf.Mem.Separator.Right.Symbol,
|
||||
)
|
||||
@@ -274,16 +339,19 @@ func main() {
|
||||
|
||||
if Conf.LA.Separator.Left.Enabled {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.LA.Separator.Left.Color,
|
||||
Conf.LA.Separator.Left.Background,
|
||||
Conf.LA.Separator.Left.Font,
|
||||
Conf.LA.Separator.Left.FontSize,
|
||||
Conf.LA.Separator.Left.Symbol,
|
||||
)
|
||||
}
|
||||
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>LA:%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>LA:%s</span>",
|
||||
Conf.LA.Color,
|
||||
Conf.LA.Background,
|
||||
Conf.LA.Font,
|
||||
Conf.LA.FontSize,
|
||||
La,
|
||||
@@ -291,9 +359,10 @@ func main() {
|
||||
|
||||
if Conf.LA.Separator.Right.Enabled {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.LA.Separator.Right.Color,
|
||||
Conf.LA.Separator.Right.Background,
|
||||
Conf.LA.Separator.Right.Font,
|
||||
Conf.LA.Separator.Right.FontSize,
|
||||
Conf.LA.Separator.Right.Symbol,
|
||||
)
|
||||
@@ -313,16 +382,19 @@ func main() {
|
||||
|
||||
if Conf.NetIf.Separator.Left.Enabled {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.NetIf.Separator.Left.Color,
|
||||
Conf.NetIf.Separator.Left.Background,
|
||||
Conf.NetIf.Separator.Left.Font,
|
||||
Conf.NetIf.Separator.Left.FontSize,
|
||||
Conf.NetIf.Separator.Left.Symbol,
|
||||
)
|
||||
}
|
||||
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size= '%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size= '%s'>%s</span>",
|
||||
Conf.NetIf.Color,
|
||||
Conf.NetIf.Background,
|
||||
Conf.NetIf.Font,
|
||||
Conf.NetIf.FontSize,
|
||||
IfStatus,
|
||||
@@ -330,9 +402,10 @@ func main() {
|
||||
|
||||
if Conf.NetIf.Separator.Right.Enabled {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.NetIf.Separator.Right.Color,
|
||||
Conf.NetIf.Separator.Right.Background,
|
||||
Conf.NetIf.Separator.Right.Font,
|
||||
Conf.NetIf.Separator.Right.FontSize,
|
||||
Conf.NetIf.Separator.Right.Symbol,
|
||||
)
|
||||
@@ -352,16 +425,19 @@ func main() {
|
||||
|
||||
if Conf.Vpn.Separator.Left.Enabled {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Vpn.Separator.Left.Color,
|
||||
Conf.Vpn.Separator.Left.Background,
|
||||
Conf.Vpn.Separator.Left.Font,
|
||||
Conf.Vpn.Separator.Left.FontSize,
|
||||
Conf.Vpn.Separator.Left.Symbol,
|
||||
)
|
||||
}
|
||||
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Vpn.Color,
|
||||
Conf.Vpn.Background,
|
||||
Conf.Vpn.Font,
|
||||
Conf.Vpn.FontSize,
|
||||
VPNStatus,
|
||||
@@ -369,9 +445,10 @@ func main() {
|
||||
|
||||
if Conf.Vpn.Separator.Right.Enabled {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Vpn.Separator.Right.Color,
|
||||
Conf.Vpn.Separator.Right.Background,
|
||||
Conf.Vpn.Separator.Right.Font,
|
||||
Conf.Vpn.Separator.Right.FontSize,
|
||||
Conf.Vpn.Separator.Right.Symbol,
|
||||
)
|
||||
@@ -391,9 +468,10 @@ func main() {
|
||||
|
||||
if Conf.Battery.Separator.Left.Enabled {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Battery.Separator.Left.Color,
|
||||
Conf.Battery.Separator.Left.Background,
|
||||
Conf.Battery.Separator.Left.Font,
|
||||
Conf.Battery.Separator.Left.FontSize,
|
||||
Conf.Battery.Separator.Left.Symbol,
|
||||
)
|
||||
@@ -403,9 +481,10 @@ func main() {
|
||||
|
||||
if Conf.Battery.Separator.Right.Enabled {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Battery.Separator.Right.Color,
|
||||
Conf.Battery.Separator.Right.Background,
|
||||
Conf.Battery.Separator.Right.Font,
|
||||
Conf.Battery.Separator.Right.FontSize,
|
||||
Conf.Battery.Separator.Right.Symbol,
|
||||
)
|
||||
@@ -426,9 +505,10 @@ func main() {
|
||||
|
||||
if Conf.SimpleVolumePa.Separator.Left.Enabled {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.SimpleVolumePa.Separator.Left.Color,
|
||||
Conf.SimpleVolumePa.Separator.Left.Background,
|
||||
Conf.SimpleVolumePa.Separator.Left.Font,
|
||||
Conf.SimpleVolumePa.Separator.Left.FontSize,
|
||||
Conf.SimpleVolumePa.Separator.Left.Symbol,
|
||||
)
|
||||
@@ -439,9 +519,10 @@ func main() {
|
||||
|
||||
if Conf.SimpleVolumePa.Separator.Right.Enabled {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.SimpleVolumePa.Separator.Right.Color,
|
||||
Conf.SimpleVolumePa.Separator.Right.Background,
|
||||
Conf.SimpleVolumePa.Separator.Right.Font,
|
||||
Conf.SimpleVolumePa.Separator.Right.FontSize,
|
||||
Conf.SimpleVolumePa.Separator.Right.Symbol,
|
||||
)
|
||||
@@ -462,16 +543,19 @@ func main() {
|
||||
|
||||
if Conf.Clock.Separator.Left.Enabled {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Clock.Separator.Left.Color,
|
||||
Conf.Clock.Separator.Left.Background,
|
||||
Conf.Clock.Separator.Left.Font,
|
||||
Conf.Clock.Separator.Left.FontSize,
|
||||
Conf.Clock.Separator.Left.Symbol,
|
||||
)
|
||||
}
|
||||
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Clock.Color,
|
||||
Conf.Clock.Background,
|
||||
Conf.Clock.Font,
|
||||
Conf.Clock.FontSize,
|
||||
Clock,
|
||||
@@ -479,9 +563,10 @@ func main() {
|
||||
|
||||
if Conf.Clock.Separator.Right.Enabled {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' size='%s'>%s</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Clock.Separator.Right.Color,
|
||||
Conf.Clock.Separator.Right.Background,
|
||||
Conf.Clock.Separator.Right.Font,
|
||||
Conf.Clock.Separator.Right.FontSize,
|
||||
Conf.Clock.Separator.Right.Symbol,
|
||||
)
|
||||
@@ -494,23 +579,25 @@ func main() {
|
||||
}
|
||||
|
||||
if PrintOutput && len(j) > 0 {
|
||||
PrintToI3bar(j)
|
||||
MsgChan <- j
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PrintToI3bar prints info to stdout according to ipc docs (https://i3wm.org/docs/i3bar-protocol.html)
|
||||
func PrintToI3bar(message []I3BarOutBlock) {
|
||||
// we do not need to html-encode output, json.Marshal does this forcefully, so invent our own Marshal
|
||||
buf := new(bytes.Buffer)
|
||||
encoder := json.NewEncoder(buf)
|
||||
encoder.SetEscapeHTML(false)
|
||||
err := encoder.Encode(message)
|
||||
func PrintToI3bar() {
|
||||
for message := range MsgChan {
|
||||
// we do not need to html-encode output, json.Marshal does this forcefully, so invent our own Marshal
|
||||
buf := new(bytes.Buffer)
|
||||
encoder := json.NewEncoder(buf)
|
||||
encoder.SetEscapeHTML(false)
|
||||
err := encoder.Encode(message)
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Unable to json-encode message, %s\n", err)
|
||||
if err != nil {
|
||||
log.Printf("Unable to json-encode message, %s\n", err)
|
||||
}
|
||||
|
||||
fmt.Println(strings.TrimSuffix(buf.String(), "\n") + ",")
|
||||
}
|
||||
|
||||
fmt.Println(strings.TrimSuffix(buf.String(), "\n") + ",")
|
||||
}
|
||||
|
||||
119
pulseaudio.go
119
pulseaudio.go
@@ -1,9 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"os/exec"
|
||||
"time"
|
||||
|
||||
p "github.com/mafik/pulseaudio"
|
||||
)
|
||||
@@ -11,6 +13,10 @@ import (
|
||||
var SoundVolume = "🔊:0%"
|
||||
var pa *p.Client
|
||||
|
||||
var SVPAHandlerChan = make(chan ClickEvent, 256)
|
||||
|
||||
// TODO: https://twin.sh/articles/44/add-a-timeout-to-any-function-in-go timeout pulseaudio calls
|
||||
|
||||
// UpdateVolumeInfo updates info about current Sound Volume.
|
||||
func UpdateVolumeInfo() {
|
||||
var err error
|
||||
@@ -36,10 +42,18 @@ func UpdateVolumeInfo() {
|
||||
}
|
||||
|
||||
SoundVolume = fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>%s</span><span font='%s' size='%s'>:%d%%</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.SimpleVolumePa.Color,
|
||||
Conf.SimpleVolumePa.Background,
|
||||
Conf.SimpleVolumePa.SymbolFont,
|
||||
Conf.SimpleVolumePa.SymbolFontSize,
|
||||
Conf.SimpleVolumePa.Symbol,
|
||||
)
|
||||
|
||||
SoundVolume += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>:%d%%</span>",
|
||||
Conf.SimpleVolumePa.Color,
|
||||
Conf.SimpleVolumePa.Background,
|
||||
Conf.SimpleVolumePa.Font,
|
||||
Conf.SimpleVolumePa.FontSize,
|
||||
int64(vol*100),
|
||||
@@ -57,7 +71,7 @@ func UpdateVolumeInfo() {
|
||||
return
|
||||
}
|
||||
|
||||
// Rake update events
|
||||
// Rake update events.
|
||||
for range pulseUpdate {
|
||||
vol, err = pa.Volume()
|
||||
|
||||
@@ -68,10 +82,18 @@ func UpdateVolumeInfo() {
|
||||
}
|
||||
|
||||
SoundVolume = fmt.Sprintf(
|
||||
"<span font='%s' size='%s'>%s</span><span font='%s' size='%s'>:%d%%</span>",
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.SimpleVolumePa.Color,
|
||||
Conf.SimpleVolumePa.Background,
|
||||
Conf.SimpleVolumePa.SymbolFont,
|
||||
Conf.SimpleVolumePa.SymbolFontSize,
|
||||
Conf.SimpleVolumePa.Symbol,
|
||||
)
|
||||
|
||||
SoundVolume += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>:%d%%</span>",
|
||||
Conf.SimpleVolumePa.Color,
|
||||
Conf.SimpleVolumePa.Background,
|
||||
Conf.SimpleVolumePa.Font,
|
||||
Conf.SimpleVolumePa.FontSize,
|
||||
int64(vol*100),
|
||||
@@ -99,10 +121,49 @@ func PaReinit() error {
|
||||
cmd := exec.Command("pulseaudio", "--check")
|
||||
|
||||
if err := cmd.Run(); err == nil {
|
||||
return fmt.Errorf("pulseaudio is already running, but we have troubles contacting it: %w", err)
|
||||
log.Printf("pulseaudio already running, but seems not responding, try gracefully kill it")
|
||||
|
||||
cmd = exec.Command("pulseaudio", "--kill")
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
return fmt.Errorf("unable to kill pulseaudio: %w", err)
|
||||
}
|
||||
|
||||
cnt := 0
|
||||
|
||||
for {
|
||||
cmd := exec.Command("pulseaudio", "--check")
|
||||
|
||||
// PA not running. Breakout of loop.
|
||||
if err := cmd.Run(); err != nil {
|
||||
break
|
||||
}
|
||||
|
||||
if cnt >= 5 {
|
||||
return errors.New("timeout waiting pulseaudio to exit") //nolint: goerr113
|
||||
}
|
||||
|
||||
log.Print("Waiting for pulseaudio to exit")
|
||||
|
||||
cnt++
|
||||
|
||||
time.Sleep(300 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
||||
cmd = exec.Command("pulseaudio", "--start")
|
||||
// PA has annoying feature: socket activation. Sound system must be persistent and available to all users regardless
|
||||
// of init or other things. They just fail to understand that. Or they fucked up pulseaudio just because they scary
|
||||
// of security something responsibility. Anyway this is grand design flaw, but we still have to bear with it.
|
||||
// This setting defines if pulseaudio will be run in manner that allows it to exit is other login detected (how
|
||||
// they guess it - I do not know). In general case we do not want to allow pa to exit and leave our session without
|
||||
// audio.
|
||||
if Conf.SimpleVolumePa.DontExitOnLogin {
|
||||
// Do not exit on any kind of login/logout events.
|
||||
cmd = exec.Command("pulseaudio", "--exit-idle-time=-1", "--start")
|
||||
} else {
|
||||
// Exit immediately on logout(?).
|
||||
cmd = exec.Command("pulseaudio", "--exit-idle-time=0", "--start")
|
||||
}
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
return fmt.Errorf("unable to initialize pulseaudio server instance: %w", err)
|
||||
@@ -116,3 +177,51 @@ func PaReinit() error {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func SVPAHandler() {
|
||||
for e := range SVPAHandlerChan {
|
||||
if e.Button == 3 {
|
||||
RunChan <- Conf.SimpleVolumePa.RightClickCmd
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
vol, err := pa.Volume()
|
||||
|
||||
if err != nil {
|
||||
if err := PaReinit(); err != nil {
|
||||
log.Printf("Unable to get pulseaudio volume: %s", err)
|
||||
} else {
|
||||
vol, err = pa.Volume()
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Unable to get volume pulseaudio server behaves weirdly: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch e.Button {
|
||||
case Conf.SimpleVolumePa.WheelUp:
|
||||
vol += float32(Conf.SimpleVolumePa.Step) / 100
|
||||
|
||||
if vol > (float32(Conf.SimpleVolumePa.MaxVolumeLimit) / 100) {
|
||||
vol = float32(Conf.SimpleVolumePa.MaxVolumeLimit) / 100
|
||||
}
|
||||
|
||||
if err := pa.SetVolume(vol); err != nil {
|
||||
log.Printf("Unable to set pulseaudio volume: %s", err)
|
||||
}
|
||||
|
||||
case Conf.SimpleVolumePa.WheelDown:
|
||||
vol -= float32(Conf.SimpleVolumePa.Step) / 100
|
||||
|
||||
if vol < 0 {
|
||||
vol = 0
|
||||
}
|
||||
|
||||
if err := pa.SetVolume(vol); err != nil {
|
||||
log.Printf("Unable to set pulseaudio volume: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ func sigHandler() {
|
||||
|
||||
UpdateReady <- true
|
||||
|
||||
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
|
||||
os.Exit(0)
|
||||
|
||||
// We have signal that we're not interested in, so make a new loop iteration.
|
||||
default:
|
||||
continue
|
||||
|
||||
2
spawn.go
2
spawn.go
@@ -11,7 +11,7 @@ import (
|
||||
// RunChan to this channel we send command and its argv to execute as separate process.
|
||||
var RunChan = make(chan []string, 128)
|
||||
|
||||
// Spawn forks and execs given program, and also detaches form its control tty.
|
||||
// Spawner forks and execs given program, and also detaches form its control tty.
|
||||
func Spawner() {
|
||||
for prg := range RunChan {
|
||||
devnullR, _ := os.Open(os.DevNull)
|
||||
|
||||
44
stdin.go
44
stdin.go
@@ -95,49 +95,7 @@ func ParseStdin() {
|
||||
|
||||
if e.Name == "simple-volume-pa" {
|
||||
if Conf.SimpleVolumePa.Enabled {
|
||||
if e.Button == 3 {
|
||||
RunChan <- Conf.SimpleVolumePa.RightClickCmd
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
vol, err := pa.Volume()
|
||||
|
||||
if err != nil {
|
||||
if err := PaReinit(); err != nil {
|
||||
log.Printf("Unable to get pulseaudio volume: %s", err)
|
||||
} else {
|
||||
vol, err = pa.Volume()
|
||||
|
||||
if err != nil {
|
||||
log.Printf("Unable to get volume pulseaudio server behaves weirdly: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch e.Button {
|
||||
case Conf.SimpleVolumePa.WheelUp:
|
||||
vol += float32(Conf.SimpleVolumePa.Step) / 100
|
||||
|
||||
if vol > (float32(Conf.SimpleVolumePa.MaxVolumeLimit) / 100) {
|
||||
vol = float32(Conf.SimpleVolumePa.MaxVolumeLimit) / 100
|
||||
}
|
||||
|
||||
if err := pa.SetVolume(vol); err != nil {
|
||||
log.Printf("Unable to set pulseaudio volume: %s", err)
|
||||
}
|
||||
|
||||
case Conf.SimpleVolumePa.WheelDown:
|
||||
vol -= float32(Conf.SimpleVolumePa.Step) / 100
|
||||
|
||||
if vol < 0 {
|
||||
vol = 0
|
||||
}
|
||||
|
||||
if err := pa.SetVolume(vol); err != nil {
|
||||
log.Printf("Unable to set pulseaudio volume: %s", err)
|
||||
}
|
||||
}
|
||||
SVPAHandlerChan <- e
|
||||
}
|
||||
|
||||
continue
|
||||
|
||||
23
vendor/github.com/go-co-op/gocron/v2/README.md
generated
vendored
23
vendor/github.com/go-co-op/gocron/v2/README.md
generated
vendored
@@ -53,6 +53,11 @@ func main() {
|
||||
// start the scheduler
|
||||
s.Start()
|
||||
|
||||
// block until you are ready to shut down
|
||||
select {
|
||||
case <-time.After(time.Minute):
|
||||
}
|
||||
|
||||
// when you're done, shut it down
|
||||
err = s.Shutdown()
|
||||
if err != nil {
|
||||
@@ -61,6 +66,11 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
- [Go doc examples](https://pkg.go.dev/github.com/go-co-op/gocron/v2#pkg-examples)
|
||||
- [Examples directory](examples)
|
||||
|
||||
## Concepts
|
||||
|
||||
- **Job**: The job encapsulates a "task", which is made up of a go function and any function parameters. The Job then
|
||||
@@ -106,10 +116,12 @@ Multiple instances of gocron can be run.
|
||||
- [**Elector**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#WithDistributedElector):
|
||||
An elector can be used to elect a single instance of gocron to run as the primary with the
|
||||
other instances checking to see if a new leader needs to be elected.
|
||||
- Implementations: [go-co-op electors](https://github.com/go-co-op?q=-elector&type=all&language=&sort=)
|
||||
- Implementations: [go-co-op electors](https://github.com/go-co-op?q=-elector&type=all&language=&sort=)
|
||||
(don't see what you need? request on slack to get a repo created to contribute it!)
|
||||
- [**Locker**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#WithDistributedLocker):
|
||||
A locker can be used to lock each run of a job to a single instance of gocron.
|
||||
- Implementations: [go-co-op lockers](https://github.com/go-co-op?q=-lock&type=all&language=&sort=)
|
||||
- Implementations: [go-co-op lockers](https://github.com/go-co-op?q=-lock&type=all&language=&sort=)
|
||||
(don't see what you need? request on slack to get a repo created to contribute it!)
|
||||
|
||||
### Events
|
||||
Job events can trigger actions.
|
||||
@@ -135,6 +147,13 @@ Logs can be enabled.
|
||||
The Logger interface can be implemented with your desired logging library.
|
||||
The provided NewLogger uses the standard library's log package.
|
||||
|
||||
### Metrics
|
||||
Metrics may be collected from the execution of each job.
|
||||
- [**Monitor**](https://pkg.go.dev/github.com/go-co-op/gocron/v2#Monitor):
|
||||
A monitor can be used to collect metrics for each job from a scheduler.
|
||||
- Implementations: [go-co-op monitors](https://github.com/go-co-op?q=-monitor&type=all&language=&sort=)
|
||||
(don't see what you need? request on slack to get a repo created to contribute it!)
|
||||
|
||||
### Testing
|
||||
The gocron library is set up to enable testing.
|
||||
- Mocks are provided in [the mock package](mocks) using [gomock](https://github.com/uber-go/mock).
|
||||
|
||||
5
vendor/github.com/go-co-op/gocron/v2/codecov.yml
generated
vendored
5
vendor/github.com/go-co-op/gocron/v2/codecov.yml
generated
vendored
@@ -1,5 +0,0 @@
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
if_ci_failed: success
|
||||
2
vendor/github.com/go-co-op/gocron/v2/errors.go
generated
vendored
2
vendor/github.com/go-co-op/gocron/v2/errors.go
generated
vendored
@@ -9,6 +9,7 @@ var (
|
||||
ErrDailyJobAtTimesNil = fmt.Errorf("gocron: DailyJob: atTimes must not be nil")
|
||||
ErrDailyJobHours = fmt.Errorf("gocron: DailyJob: atTimes hours must be between 0 and 23 inclusive")
|
||||
ErrDailyJobMinutesSeconds = fmt.Errorf("gocron: DailyJob: atTimes minutes and seconds must be between 0 and 59 inclusive")
|
||||
ErrDurationJobIntervalZero = fmt.Errorf("gocron: DurationJob: time interval is 0")
|
||||
ErrDurationRandomJobMinMax = fmt.Errorf("gocron: DurationRandomJob: minimum duration must be less than maximum duration")
|
||||
ErrEventListenerFuncNil = fmt.Errorf("gocron: eventListenerFunc must not be nil")
|
||||
ErrJobNotFound = fmt.Errorf("gocron: job not found")
|
||||
@@ -38,6 +39,7 @@ var (
|
||||
ErrWithLimitConcurrentJobsZero = fmt.Errorf("gocron: WithLimitConcurrentJobs: limit must be greater than 0")
|
||||
ErrWithLocationNil = fmt.Errorf("gocron: WithLocation: location must not be nil")
|
||||
ErrWithLoggerNil = fmt.Errorf("gocron: WithLogger: logger must not be nil")
|
||||
ErrWithMonitorNil = fmt.Errorf("gocron: WithMonitor: monitor must not be nil")
|
||||
ErrWithNameEmpty = fmt.Errorf("gocron: WithName: name must not be empty")
|
||||
ErrWithStartDateTimePast = fmt.Errorf("gocron: WithStartDateTime: start must not be in the past")
|
||||
ErrWithStopTimeoutZeroOrNegative = fmt.Errorf("gocron: WithStopTimeout: timeout must be greater than 0")
|
||||
|
||||
117
vendor/github.com/go-co-op/gocron/v2/executor.go
generated
vendored
117
vendor/github.com/go-co-op/gocron/v2/executor.go
generated
vendored
@@ -10,19 +10,21 @@ import (
|
||||
)
|
||||
|
||||
type executor struct {
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
logger Logger
|
||||
stopCh chan struct{}
|
||||
jobsIn chan jobIn
|
||||
jobIDsOut chan uuid.UUID
|
||||
jobOutRequest chan jobOutRequest
|
||||
stopTimeout time.Duration
|
||||
done chan error
|
||||
singletonRunners map[uuid.UUID]singletonRunner
|
||||
limitMode *limitModeConfig
|
||||
elector Elector
|
||||
locker Locker
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
logger Logger
|
||||
stopCh chan struct{}
|
||||
jobsIn chan jobIn
|
||||
jobsOutForRescheduling chan uuid.UUID
|
||||
jobsOutCompleted chan uuid.UUID
|
||||
jobOutRequest chan jobOutRequest
|
||||
stopTimeout time.Duration
|
||||
done chan error
|
||||
singletonRunners *sync.Map // map[uuid.UUID]singletonRunner
|
||||
limitMode *limitModeConfig
|
||||
elector Elector
|
||||
locker Locker
|
||||
monitor Monitor
|
||||
}
|
||||
|
||||
type jobIn struct {
|
||||
@@ -66,7 +68,7 @@ func (e *executor) start() {
|
||||
limitModeJobsWg := &waitGroupWithMutex{}
|
||||
|
||||
// create a fresh map for tracking singleton runners
|
||||
e.singletonRunners = make(map[uuid.UUID]singletonRunner)
|
||||
e.singletonRunners = &sync.Map{}
|
||||
|
||||
// start the for leap that is the executor
|
||||
// selecting on channels for work to do
|
||||
@@ -121,12 +123,7 @@ func (e *executor) start() {
|
||||
// all runners are busy, reschedule the work for later
|
||||
// which means we just skip it here and do nothing
|
||||
// TODO when metrics are added, this should increment a rescheduled metric
|
||||
if jIn.shouldSendOut {
|
||||
select {
|
||||
case e.jobIDsOut <- jIn.id:
|
||||
default:
|
||||
}
|
||||
}
|
||||
e.sendOutForRescheduling(&jIn)
|
||||
}
|
||||
} else {
|
||||
// since we're not using LimitModeReschedule, but instead using LimitModeWait
|
||||
@@ -135,6 +132,7 @@ func (e *executor) start() {
|
||||
// at which point this call would block.
|
||||
// TODO when metrics are added, this should increment a wait metric
|
||||
e.limitMode.in <- jIn
|
||||
e.sendOutForRescheduling(&jIn)
|
||||
}
|
||||
} else {
|
||||
// no limit mode, so we're either running a regular job or
|
||||
@@ -150,15 +148,18 @@ func (e *executor) start() {
|
||||
if j.singletonMode {
|
||||
// for singleton mode, get the existing runner for the job
|
||||
// or spin up a new one
|
||||
runner, ok := e.singletonRunners[jIn.id]
|
||||
runner := &singletonRunner{}
|
||||
runnerSrc, ok := e.singletonRunners.Load(jIn.id)
|
||||
if !ok {
|
||||
runner.in = make(chan jobIn, 1000)
|
||||
if j.singletonLimitMode == LimitModeReschedule {
|
||||
runner.rescheduleLimiter = make(chan struct{}, 1)
|
||||
}
|
||||
e.singletonRunners[jIn.id] = runner
|
||||
e.singletonRunners.Store(jIn.id, runner)
|
||||
singletonJobsWg.Add(1)
|
||||
go e.singletonModeRunner("singleton-"+jIn.id.String(), runner.in, singletonJobsWg, j.singletonLimitMode, runner.rescheduleLimiter)
|
||||
} else {
|
||||
runner = runnerSrc.(*singletonRunner)
|
||||
}
|
||||
|
||||
if j.singletonLimitMode == LimitModeReschedule {
|
||||
@@ -167,20 +168,17 @@ func (e *executor) start() {
|
||||
select {
|
||||
case runner.rescheduleLimiter <- struct{}{}:
|
||||
runner.in <- jIn
|
||||
e.sendOutForRescheduling(&jIn)
|
||||
default:
|
||||
// runner is busy, reschedule the work for later
|
||||
// which means we just skip it here and do nothing
|
||||
// TODO when metrics are added, this should increment a rescheduled metric
|
||||
if jIn.shouldSendOut {
|
||||
select {
|
||||
case e.jobIDsOut <- jIn.id:
|
||||
default:
|
||||
}
|
||||
}
|
||||
e.sendOutForRescheduling(&jIn)
|
||||
}
|
||||
} else {
|
||||
// wait mode, fill up that queue (buffered channel, so it's ok)
|
||||
runner.in <- jIn
|
||||
e.sendOutForRescheduling(&jIn)
|
||||
}
|
||||
} else {
|
||||
select {
|
||||
@@ -196,7 +194,7 @@ func (e *executor) start() {
|
||||
// complete.
|
||||
standardJobsWg.Add(1)
|
||||
go func(j internalJob) {
|
||||
e.runJob(j, jIn.shouldSendOut)
|
||||
e.runJob(j, jIn)
|
||||
standardJobsWg.Done()
|
||||
}(*j)
|
||||
}
|
||||
@@ -209,6 +207,20 @@ func (e *executor) start() {
|
||||
}
|
||||
}
|
||||
|
||||
func (e *executor) sendOutForRescheduling(jIn *jobIn) {
|
||||
if jIn.shouldSendOut {
|
||||
select {
|
||||
case e.jobsOutForRescheduling <- jIn.id:
|
||||
case <-e.ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
// we need to set this to false now, because to handle
|
||||
// non-limit jobs, we send out from the e.runJob function
|
||||
// and in this case we don't want to send out twice.
|
||||
jIn.shouldSendOut = false
|
||||
}
|
||||
|
||||
func (e *executor) limitModeRunner(name string, in chan jobIn, wg *waitGroupWithMutex, limitMode LimitMode, rescheduleLimiter chan struct{}) {
|
||||
e.logger.Debug("gocron: limitModeRunner starting", "name", name)
|
||||
for {
|
||||
@@ -239,24 +251,21 @@ func (e *executor) limitModeRunner(name string, in chan jobIn, wg *waitGroupWith
|
||||
return
|
||||
case <-j.ctx.Done():
|
||||
return
|
||||
case e.jobIDsOut <- j.id:
|
||||
case e.jobsOutForRescheduling <- j.id:
|
||||
}
|
||||
}
|
||||
// remove the limiter block, as this particular job
|
||||
// was a singleton already running, and we want to
|
||||
// allow another job to be scheduled
|
||||
if limitMode == LimitModeReschedule {
|
||||
select {
|
||||
case <-rescheduleLimiter:
|
||||
default:
|
||||
}
|
||||
<-rescheduleLimiter
|
||||
}
|
||||
continue
|
||||
}
|
||||
e.limitMode.singletonJobs[jIn.id] = struct{}{}
|
||||
e.limitMode.singletonJobsMu.Unlock()
|
||||
}
|
||||
e.runJob(*j, jIn.shouldSendOut)
|
||||
e.runJob(*j, jIn)
|
||||
|
||||
if j.singletonMode {
|
||||
e.limitMode.singletonJobsMu.Lock()
|
||||
@@ -267,10 +276,7 @@ func (e *executor) limitModeRunner(name string, in chan jobIn, wg *waitGroupWith
|
||||
|
||||
// remove the limiter block to allow another job to be scheduled
|
||||
if limitMode == LimitModeReschedule {
|
||||
select {
|
||||
case <-rescheduleLimiter:
|
||||
default:
|
||||
}
|
||||
<-rescheduleLimiter
|
||||
}
|
||||
case <-e.ctx.Done():
|
||||
e.logger.Debug("limitModeRunner shutting down", "name", name)
|
||||
@@ -297,15 +303,12 @@ func (e *executor) singletonModeRunner(name string, in chan jobIn, wg *waitGroup
|
||||
j := requestJobCtx(ctx, jIn.id, e.jobOutRequest)
|
||||
cancel()
|
||||
if j != nil {
|
||||
e.runJob(*j, jIn.shouldSendOut)
|
||||
e.runJob(*j, jIn)
|
||||
}
|
||||
|
||||
// remove the limiter block to allow another job to be scheduled
|
||||
if limitMode == LimitModeReschedule {
|
||||
select {
|
||||
case <-rescheduleLimiter:
|
||||
default:
|
||||
}
|
||||
<-rescheduleLimiter
|
||||
}
|
||||
case <-e.ctx.Done():
|
||||
e.logger.Debug("singletonModeRunner shutting down", "name", name)
|
||||
@@ -315,7 +318,7 @@ func (e *executor) singletonModeRunner(name string, in chan jobIn, wg *waitGroup
|
||||
}
|
||||
}
|
||||
|
||||
func (e *executor) runJob(j internalJob, shouldSendOut bool) {
|
||||
func (e *executor) runJob(j internalJob, jIn jobIn) {
|
||||
if j.ctx == nil {
|
||||
return
|
||||
}
|
||||
@@ -329,32 +332,40 @@ func (e *executor) runJob(j internalJob, shouldSendOut bool) {
|
||||
|
||||
if e.elector != nil {
|
||||
if err := e.elector.IsLeader(j.ctx); err != nil {
|
||||
e.sendOutForRescheduling(&jIn)
|
||||
return
|
||||
}
|
||||
} else if e.locker != nil {
|
||||
lock, err := e.locker.Lock(j.ctx, j.name)
|
||||
if err != nil {
|
||||
e.sendOutForRescheduling(&jIn)
|
||||
return
|
||||
}
|
||||
defer func() { _ = lock.Unlock(j.ctx) }()
|
||||
}
|
||||
_ = callJobFuncWithParams(j.beforeJobRuns, j.id, j.name)
|
||||
|
||||
if shouldSendOut {
|
||||
select {
|
||||
case <-e.ctx.Done():
|
||||
return
|
||||
case <-j.ctx.Done():
|
||||
return
|
||||
case e.jobIDsOut <- j.id:
|
||||
}
|
||||
e.sendOutForRescheduling(&jIn)
|
||||
select {
|
||||
case e.jobsOutCompleted <- j.id:
|
||||
case <-e.ctx.Done():
|
||||
}
|
||||
|
||||
startTime := time.Now()
|
||||
err := callJobFuncWithParams(j.function, j.parameters...)
|
||||
if e.monitor != nil {
|
||||
e.monitor.RecordJobTiming(startTime, time.Now(), j.id, j.name, j.tags)
|
||||
}
|
||||
if err != nil {
|
||||
_ = callJobFuncWithParams(j.afterJobRunsWithError, j.id, j.name, err)
|
||||
if e.monitor != nil {
|
||||
e.monitor.IncrementJob(j.id, j.name, j.tags, Fail)
|
||||
}
|
||||
} else {
|
||||
_ = callJobFuncWithParams(j.afterJobRuns, j.id, j.name)
|
||||
if e.monitor != nil {
|
||||
e.monitor.IncrementJob(j.id, j.name, j.tags, Success)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
66
vendor/github.com/go-co-op/gocron/v2/job.go
generated
vendored
66
vendor/github.com/go-co-op/gocron/v2/job.go
generated
vendored
@@ -24,7 +24,9 @@ type internalJob struct {
|
||||
name string
|
||||
tags []string
|
||||
jobSchedule
|
||||
lastRun, nextRun time.Time
|
||||
lastScheduledRun time.Time
|
||||
nextScheduled time.Time
|
||||
lastRun time.Time
|
||||
function any
|
||||
parameters []any
|
||||
timer clockwork.Timer
|
||||
@@ -148,6 +150,9 @@ type durationJobDefinition struct {
|
||||
}
|
||||
|
||||
func (d durationJobDefinition) setup(j *internalJob, _ *time.Location) error {
|
||||
if d.duration == 0 {
|
||||
return ErrDurationJobIntervalZero
|
||||
}
|
||||
j.jobSchedule = &durationJob{duration: d.duration}
|
||||
return nil
|
||||
}
|
||||
@@ -579,8 +584,8 @@ func WithTags(tags ...string) JobOption {
|
||||
// listeners that can be used to listen for job events.
|
||||
type EventListener func(*internalJob) error
|
||||
|
||||
// AfterJobRuns is used to listen for when a job has run regardless
|
||||
// of any returned error value, and run the provided function.
|
||||
// AfterJobRuns is used to listen for when a job has run
|
||||
// without an error, and then run the provided function.
|
||||
func AfterJobRuns(eventListenerFunc func(jobID uuid.UUID, jobName string)) EventListener {
|
||||
return func(j *internalJob) error {
|
||||
if eventListenerFunc == nil {
|
||||
@@ -678,18 +683,18 @@ func (d dailyJob) next(lastRun time.Time) time.Time {
|
||||
|
||||
func (d dailyJob) nextDay(lastRun time.Time, firstPass bool) time.Time {
|
||||
for _, at := range d.atTimes {
|
||||
// sub the at time hour/min/sec onto the lastRun's values
|
||||
// sub the at time hour/min/sec onto the lastScheduledRun's values
|
||||
// to use in checks to see if we've got our next run time
|
||||
atDate := time.Date(lastRun.Year(), lastRun.Month(), lastRun.Day(), at.Hour(), at.Minute(), at.Second(), lastRun.Nanosecond(), lastRun.Location())
|
||||
|
||||
if firstPass && atDate.After(lastRun) {
|
||||
// checking to see if it is after i.e. greater than,
|
||||
// and not greater or equal as our lastRun day/time
|
||||
// and not greater or equal as our lastScheduledRun day/time
|
||||
// will be in the loop, and we don't want to select it again
|
||||
return atDate
|
||||
} else if !firstPass && !atDate.Before(lastRun) {
|
||||
// now that we're looking at the next day, it's ok to consider
|
||||
// the same at time that was last run (as lastRun has been incremented)
|
||||
// the same at time that was last run (as lastScheduledRun has been incremented)
|
||||
return atDate
|
||||
}
|
||||
}
|
||||
@@ -724,18 +729,18 @@ func (w weeklyJob) nextWeekDayAtTime(lastRun time.Time, firstPass bool) time.Tim
|
||||
// weekDayDiff is used to add the correct amount to the atDate day below
|
||||
weekDayDiff := wd - lastRun.Weekday()
|
||||
for _, at := range w.atTimes {
|
||||
// sub the at time hour/min/sec onto the lastRun's values
|
||||
// sub the at time hour/min/sec onto the lastScheduledRun's values
|
||||
// to use in checks to see if we've got our next run time
|
||||
atDate := time.Date(lastRun.Year(), lastRun.Month(), lastRun.Day()+int(weekDayDiff), at.Hour(), at.Minute(), at.Second(), lastRun.Nanosecond(), lastRun.Location())
|
||||
|
||||
if firstPass && atDate.After(lastRun) {
|
||||
// checking to see if it is after i.e. greater than,
|
||||
// and not greater or equal as our lastRun day/time
|
||||
// and not greater or equal as our lastScheduledRun day/time
|
||||
// will be in the loop, and we don't want to select it again
|
||||
return atDate
|
||||
} else if !firstPass && !atDate.Before(lastRun) {
|
||||
// now that we're looking at the next week, it's ok to consider
|
||||
// the same at time that was last run (as lastRun has been incremented)
|
||||
// the same at time that was last run (as lastScheduledRun has been incremented)
|
||||
return atDate
|
||||
}
|
||||
}
|
||||
@@ -756,38 +761,43 @@ type monthlyJob struct {
|
||||
func (m monthlyJob) next(lastRun time.Time) time.Time {
|
||||
daysList := make([]int, len(m.days))
|
||||
copy(daysList, m.days)
|
||||
firstDayNextMonth := time.Date(lastRun.Year(), lastRun.Month()+1, 1, 0, 0, 0, 0, lastRun.Location())
|
||||
for _, daySub := range m.daysFromEnd {
|
||||
// getting a combined list of all the daysList and the negative daysList
|
||||
// which count backwards from the first day of the next month
|
||||
// -1 == the last day of the month
|
||||
day := firstDayNextMonth.AddDate(0, 0, daySub).Day()
|
||||
daysList = append(daysList, day)
|
||||
}
|
||||
slices.Sort(daysList)
|
||||
|
||||
firstPass := true
|
||||
next := m.nextMonthDayAtTime(lastRun, daysList, firstPass)
|
||||
daysFromEnd := m.handleNegativeDays(lastRun, daysList, m.daysFromEnd)
|
||||
next := m.nextMonthDayAtTime(lastRun, daysFromEnd, true)
|
||||
if !next.IsZero() {
|
||||
return next
|
||||
}
|
||||
firstPass = false
|
||||
|
||||
from := time.Date(lastRun.Year(), lastRun.Month()+time.Month(m.interval), 1, 0, 0, 0, 0, lastRun.Location())
|
||||
for next.IsZero() {
|
||||
next = m.nextMonthDayAtTime(from, daysList, firstPass)
|
||||
daysFromEnd = m.handleNegativeDays(from, daysList, m.daysFromEnd)
|
||||
next = m.nextMonthDayAtTime(from, daysFromEnd, false)
|
||||
from = from.AddDate(0, int(m.interval), 0)
|
||||
}
|
||||
|
||||
return next
|
||||
}
|
||||
|
||||
func (m monthlyJob) handleNegativeDays(from time.Time, days, negativeDays []int) []int {
|
||||
var out []int
|
||||
// getting a list of the days from the end of the following month
|
||||
// -1 == the last day of the month
|
||||
firstDayNextMonth := time.Date(from.Year(), from.Month()+1, 1, 0, 0, 0, 0, from.Location())
|
||||
for _, daySub := range negativeDays {
|
||||
day := firstDayNextMonth.AddDate(0, 0, daySub).Day()
|
||||
out = append(out, day)
|
||||
}
|
||||
out = append(out, days...)
|
||||
slices.Sort(out)
|
||||
return out
|
||||
}
|
||||
|
||||
func (m monthlyJob) nextMonthDayAtTime(lastRun time.Time, days []int, firstPass bool) time.Time {
|
||||
// find the next day in the month that should run and then check for an at time
|
||||
for _, day := range days {
|
||||
if day >= lastRun.Day() {
|
||||
for _, at := range m.atTimes {
|
||||
// sub the day, and the at time hour/min/sec onto the lastRun's values
|
||||
// sub the day, and the at time hour/min/sec onto the lastScheduledRun's values
|
||||
// to use in checks to see if we've got our next run time
|
||||
atDate := time.Date(lastRun.Year(), lastRun.Month(), day, at.Hour(), at.Minute(), at.Second(), lastRun.Nanosecond(), lastRun.Location())
|
||||
|
||||
@@ -799,12 +809,12 @@ func (m monthlyJob) nextMonthDayAtTime(lastRun time.Time, days []int, firstPass
|
||||
|
||||
if firstPass && atDate.After(lastRun) {
|
||||
// checking to see if it is after i.e. greater than,
|
||||
// and not greater or equal as our lastRun day/time
|
||||
// and not greater or equal as our lastScheduledRun day/time
|
||||
// will be in the loop, and we don't want to select it again
|
||||
return atDate
|
||||
} else if !firstPass && !atDate.Before(lastRun) {
|
||||
// now that we're looking at the next month, it's ok to consider
|
||||
// the same at time that was lastRun (as lastRun has been incremented)
|
||||
// the same at time that was lastScheduledRun (as lastScheduledRun has been incremented)
|
||||
return atDate
|
||||
}
|
||||
}
|
||||
@@ -841,7 +851,9 @@ type Job interface {
|
||||
NextRun() (time.Time, error)
|
||||
// RunNow runs the job once, now. This does not alter
|
||||
// the existing run schedule, and will respect all job
|
||||
// and scheduler limits.
|
||||
// and scheduler limits. This means that running a job now may
|
||||
// cause the job's regular interval to be rescheduled due to
|
||||
// the instance being run by RunNow blocking your run limit.
|
||||
RunNow() error
|
||||
// Tags returns the job's string tags.
|
||||
Tags() []string
|
||||
@@ -882,7 +894,7 @@ func (j job) NextRun() (time.Time, error) {
|
||||
if ij == nil || ij.id == uuid.Nil {
|
||||
return time.Time{}, ErrJobNotFound
|
||||
}
|
||||
return ij.nextRun, nil
|
||||
return ij.nextScheduled, nil
|
||||
}
|
||||
|
||||
func (j job) Tags() []string {
|
||||
|
||||
26
vendor/github.com/go-co-op/gocron/v2/monitor.go
generated
vendored
Normal file
26
vendor/github.com/go-co-op/gocron/v2/monitor.go
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
package gocron
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// JobStatus is the status of job run that should be collected with the metric.
|
||||
type JobStatus string
|
||||
|
||||
// The different statuses of job that can be used.
|
||||
const (
|
||||
Fail JobStatus = "fail"
|
||||
Success JobStatus = "success"
|
||||
)
|
||||
|
||||
// Monitor represents the interface to collect jobs metrics.
|
||||
type Monitor interface {
|
||||
// IncrementJob will provide details about the job and expects the underlying implementation
|
||||
// to handle instantiating and incrementing a value
|
||||
IncrementJob(id uuid.UUID, name string, tags []string, status JobStatus)
|
||||
// RecordJobTiming will provide details about the job and the timing and expects the underlying implementation
|
||||
// to handle instantiating and recording the value
|
||||
RecordJobTiming(startTime, endTime time.Time, id uuid.UUID, name string, tags []string)
|
||||
}
|
||||
155
vendor/github.com/go-co-op/gocron/v2/scheduler.go
generated
vendored
155
vendor/github.com/go-co-op/gocron/v2/scheduler.go
generated
vendored
@@ -70,11 +70,17 @@ type scheduler struct {
|
||||
allJobsOutRequest chan allJobsOutRequest
|
||||
jobOutRequestCh chan jobOutRequest
|
||||
runJobRequestCh chan runJobRequest
|
||||
newJobCh chan internalJob
|
||||
newJobCh chan newJobIn
|
||||
removeJobCh chan uuid.UUID
|
||||
removeJobsByTagsCh chan []string
|
||||
}
|
||||
|
||||
type newJobIn struct {
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
job internalJob
|
||||
}
|
||||
|
||||
type jobOutRequest struct {
|
||||
id uuid.UUID
|
||||
outChan chan internalJob
|
||||
@@ -100,13 +106,14 @@ func NewScheduler(options ...SchedulerOption) (Scheduler, error) {
|
||||
exec := executor{
|
||||
stopCh: make(chan struct{}),
|
||||
stopTimeout: time.Second * 10,
|
||||
singletonRunners: make(map[uuid.UUID]singletonRunner),
|
||||
singletonRunners: nil,
|
||||
logger: &noOpLogger{},
|
||||
|
||||
jobsIn: make(chan jobIn),
|
||||
jobIDsOut: make(chan uuid.UUID),
|
||||
jobOutRequest: make(chan jobOutRequest, 1000),
|
||||
done: make(chan error),
|
||||
jobsIn: make(chan jobIn),
|
||||
jobsOutForRescheduling: make(chan uuid.UUID),
|
||||
jobsOutCompleted: make(chan uuid.UUID),
|
||||
jobOutRequest: make(chan jobOutRequest, 1000),
|
||||
done: make(chan error),
|
||||
}
|
||||
|
||||
s := &scheduler{
|
||||
@@ -118,7 +125,7 @@ func NewScheduler(options ...SchedulerOption) (Scheduler, error) {
|
||||
clock: clockwork.NewRealClock(),
|
||||
logger: &noOpLogger{},
|
||||
|
||||
newJobCh: make(chan internalJob),
|
||||
newJobCh: make(chan newJobIn),
|
||||
removeJobCh: make(chan uuid.UUID),
|
||||
removeJobsByTagsCh: make(chan []string),
|
||||
startCh: make(chan struct{}),
|
||||
@@ -141,11 +148,14 @@ func NewScheduler(options ...SchedulerOption) (Scheduler, error) {
|
||||
s.logger.Info("gocron: new scheduler created")
|
||||
for {
|
||||
select {
|
||||
case id := <-s.exec.jobIDsOut:
|
||||
s.selectExecJobIDsOut(id)
|
||||
case id := <-s.exec.jobsOutForRescheduling:
|
||||
s.selectExecJobsOutForRescheduling(id)
|
||||
|
||||
case j := <-s.newJobCh:
|
||||
s.selectNewJob(j)
|
||||
case id := <-s.exec.jobsOutCompleted:
|
||||
s.selectExecJobsOutCompleted(id)
|
||||
|
||||
case in := <-s.newJobCh:
|
||||
s.selectNewJob(in)
|
||||
|
||||
case id := <-s.removeJobCh:
|
||||
s.selectRemoveJob(id)
|
||||
@@ -281,9 +291,54 @@ func (s *scheduler) selectRemoveJob(id uuid.UUID) {
|
||||
|
||||
// Jobs coming back from the executor to the scheduler that
|
||||
// need to evaluated for rescheduling.
|
||||
func (s *scheduler) selectExecJobIDsOut(id uuid.UUID) {
|
||||
j := s.jobs[id]
|
||||
j.lastRun = j.nextRun
|
||||
func (s *scheduler) selectExecJobsOutForRescheduling(id uuid.UUID) {
|
||||
j, ok := s.jobs[id]
|
||||
if !ok {
|
||||
// the job was removed while it was running, and
|
||||
// so we don't need to reschedule it.
|
||||
return
|
||||
}
|
||||
j.lastScheduledRun = j.nextScheduled
|
||||
|
||||
next := j.next(j.lastScheduledRun)
|
||||
if next.IsZero() {
|
||||
// the job's next function will return zero for OneTime jobs.
|
||||
// since they are one time only, they do not need rescheduling.
|
||||
return
|
||||
}
|
||||
if next.Before(s.now()) {
|
||||
// in some cases the next run time can be in the past, for example:
|
||||
// - the time on the machine was incorrect and has been synced with ntp
|
||||
// - the machine went to sleep, and woke up some time later
|
||||
// in those cases, we want to increment to the next run in the future
|
||||
// and schedule the job for that time.
|
||||
for next.Before(s.now()) {
|
||||
next = j.next(next)
|
||||
}
|
||||
}
|
||||
j.nextScheduled = next
|
||||
j.timer = s.clock.AfterFunc(next.Sub(s.now()), func() {
|
||||
// set the actual timer on the job here and listen for
|
||||
// shut down events so that the job doesn't attempt to
|
||||
// run if the scheduler has been shutdown.
|
||||
select {
|
||||
case <-s.shutdownCtx.Done():
|
||||
return
|
||||
case s.exec.jobsIn <- jobIn{
|
||||
id: j.id,
|
||||
shouldSendOut: true,
|
||||
}:
|
||||
}
|
||||
})
|
||||
// update the job with its new next and last run times and timer.
|
||||
s.jobs[id] = j
|
||||
}
|
||||
|
||||
func (s *scheduler) selectExecJobsOutCompleted(id uuid.UUID) {
|
||||
j, ok := s.jobs[id]
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
// if the job has a limited number of runs set, we need to
|
||||
// check how many runs have occurred and stop running this
|
||||
@@ -302,37 +357,7 @@ func (s *scheduler) selectExecJobIDsOut(id uuid.UUID) {
|
||||
}
|
||||
}
|
||||
|
||||
next := j.next(j.lastRun)
|
||||
if next.IsZero() {
|
||||
// the job's next function will return zero for OneTime jobs.
|
||||
// since they are one time only, they do not need rescheduling.
|
||||
return
|
||||
}
|
||||
if next.Before(s.now()) {
|
||||
// in some cases the next run time can be in the past, for example:
|
||||
// - the time on the machine was incorrect and has been synced with ntp
|
||||
// - the machine went to sleep, and woke up some time later
|
||||
// in those cases, we want to increment to the next run in the future
|
||||
// and schedule the job for that time.
|
||||
for next.Before(s.now()) {
|
||||
next = j.next(next)
|
||||
}
|
||||
}
|
||||
j.nextRun = next
|
||||
j.timer = s.clock.AfterFunc(next.Sub(s.now()), func() {
|
||||
// set the actual timer on the job here and listen for
|
||||
// shut down events so that the job doesn't attempt to
|
||||
// run if the scheduler has been shutdown.
|
||||
select {
|
||||
case <-s.shutdownCtx.Done():
|
||||
return
|
||||
case s.exec.jobsIn <- jobIn{
|
||||
id: j.id,
|
||||
shouldSendOut: true,
|
||||
}:
|
||||
}
|
||||
})
|
||||
// update the job with its new next and last run times and timer.
|
||||
j.lastRun = s.now()
|
||||
s.jobs[id] = j
|
||||
}
|
||||
|
||||
@@ -346,7 +371,8 @@ func (s *scheduler) selectJobOutRequest(out jobOutRequest) {
|
||||
close(out.outChan)
|
||||
}
|
||||
|
||||
func (s *scheduler) selectNewJob(j internalJob) {
|
||||
func (s *scheduler) selectNewJob(in newJobIn) {
|
||||
j := in.job
|
||||
if s.started {
|
||||
next := j.startTime
|
||||
if j.startImmediately {
|
||||
@@ -374,10 +400,11 @@ func (s *scheduler) selectNewJob(j internalJob) {
|
||||
}
|
||||
})
|
||||
}
|
||||
j.nextRun = next
|
||||
j.nextScheduled = next
|
||||
}
|
||||
|
||||
s.jobs[j.id] = j
|
||||
in.cancel()
|
||||
}
|
||||
|
||||
func (s *scheduler) selectRemoveJobsByTags(tags []string) {
|
||||
@@ -424,7 +451,7 @@ func (s *scheduler) selectStart() {
|
||||
}
|
||||
})
|
||||
}
|
||||
j.nextRun = next
|
||||
j.nextScheduled = next
|
||||
s.jobs[id] = j
|
||||
}
|
||||
select {
|
||||
@@ -446,10 +473,11 @@ func (s *scheduler) now() time.Time {
|
||||
|
||||
func (s *scheduler) jobFromInternalJob(in internalJob) job {
|
||||
return job{
|
||||
id: in.id,
|
||||
name: in.name,
|
||||
tags: slices.Clone(in.tags),
|
||||
jobOutRequest: s.jobOutRequestCh,
|
||||
in.id,
|
||||
in.name,
|
||||
slices.Clone(in.tags),
|
||||
s.jobOutRequestCh,
|
||||
s.runJobRequestCh,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,9 +576,19 @@ func (s *scheduler) addOrUpdateJob(id uuid.UUID, definition JobDefinition, taskW
|
||||
return nil, err
|
||||
}
|
||||
|
||||
newJobCtx, newJobCancel := context.WithCancel(context.Background())
|
||||
select {
|
||||
case <-s.shutdownCtx.Done():
|
||||
case s.newJobCh <- j:
|
||||
case s.newJobCh <- newJobIn{
|
||||
ctx: newJobCtx,
|
||||
cancel: newJobCancel,
|
||||
job: j,
|
||||
}:
|
||||
}
|
||||
|
||||
select {
|
||||
case <-newJobCtx.Done():
|
||||
case <-s.shutdownCtx.Done():
|
||||
}
|
||||
|
||||
return &job{
|
||||
@@ -774,3 +812,14 @@ func WithStopTimeout(timeout time.Duration) SchedulerOption {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithMonitor sets the metrics provider to be used by the Scheduler.
|
||||
func WithMonitor(monitor Monitor) SchedulerOption {
|
||||
return func(s *scheduler) error {
|
||||
if monitor == nil {
|
||||
return ErrWithMonitorNil
|
||||
}
|
||||
s.exec.monitor = monitor
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
8
vendor/github.com/go-co-op/gocron/v2/util.go
generated
vendored
8
vendor/github.com/go-co-op/gocron/v2/util.go
generated
vendored
@@ -44,18 +44,12 @@ func requestJob(id uuid.UUID, ch chan jobOutRequest) *internalJob {
|
||||
|
||||
func requestJobCtx(ctx context.Context, id uuid.UUID, ch chan jobOutRequest) *internalJob {
|
||||
resp := make(chan internalJob, 1)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return nil
|
||||
default:
|
||||
}
|
||||
|
||||
select {
|
||||
case ch <- jobOutRequest{
|
||||
id: id,
|
||||
outChan: resp,
|
||||
}:
|
||||
default:
|
||||
case <-ctx.Done():
|
||||
return nil
|
||||
}
|
||||
var j internalJob
|
||||
|
||||
13
vendor/github.com/google/uuid/CHANGELOG.md
generated
vendored
13
vendor/github.com/google/uuid/CHANGELOG.md
generated
vendored
@@ -1,5 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
## [1.6.0](https://github.com/google/uuid/compare/v1.5.0...v1.6.0) (2024-01-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add Max UUID constant ([#149](https://github.com/google/uuid/issues/149)) ([c58770e](https://github.com/google/uuid/commit/c58770eb495f55fe2ced6284f93c5158a62e53e3))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix typo in version 7 uuid documentation ([#153](https://github.com/google/uuid/issues/153)) ([016b199](https://github.com/google/uuid/commit/016b199544692f745ffc8867b914129ecb47ef06))
|
||||
* Monotonicity in UUIDv7 ([#150](https://github.com/google/uuid/issues/150)) ([a2b2b32](https://github.com/google/uuid/commit/a2b2b32373ff0b1a312b7fdf6d38a977099698a6))
|
||||
|
||||
## [1.5.0](https://github.com/google/uuid/compare/v1.4.0...v1.5.0) (2023-12-12)
|
||||
|
||||
|
||||
|
||||
6
vendor/github.com/google/uuid/hash.go
generated
vendored
6
vendor/github.com/google/uuid/hash.go
generated
vendored
@@ -17,6 +17,12 @@ var (
|
||||
NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8"))
|
||||
NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8"))
|
||||
Nil UUID // empty UUID, all zeros
|
||||
|
||||
// The Max UUID is special form of UUID that is specified to have all 128 bits set to 1.
|
||||
Max = UUID{
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
}
|
||||
)
|
||||
|
||||
// NewHash returns a new UUID derived from the hash of space concatenated with
|
||||
|
||||
39
vendor/github.com/google/uuid/version7.go
generated
vendored
39
vendor/github.com/google/uuid/version7.go
generated
vendored
@@ -44,7 +44,7 @@ func NewV7FromReader(r io.Reader) (UUID, error) {
|
||||
|
||||
// makeV7 fill 48 bits time (uuid[0] - uuid[5]), set version b0111 (uuid[6])
|
||||
// uuid[8] already has the right version number (Variant is 10)
|
||||
// see function NewV7 and NewV7FromReader
|
||||
// see function NewV7 and NewV7FromReader
|
||||
func makeV7(uuid []byte) {
|
||||
/*
|
||||
0 1 2 3
|
||||
@@ -52,7 +52,7 @@ func makeV7(uuid []byte) {
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| unix_ts_ms |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| unix_ts_ms | ver | rand_a |
|
||||
| unix_ts_ms | ver | rand_a (12 bit seq) |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|var| rand_b |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
@@ -61,7 +61,7 @@ func makeV7(uuid []byte) {
|
||||
*/
|
||||
_ = uuid[15] // bounds check
|
||||
|
||||
t := timeNow().UnixMilli()
|
||||
t, s := getV7Time()
|
||||
|
||||
uuid[0] = byte(t >> 40)
|
||||
uuid[1] = byte(t >> 32)
|
||||
@@ -70,6 +70,35 @@ func makeV7(uuid []byte) {
|
||||
uuid[4] = byte(t >> 8)
|
||||
uuid[5] = byte(t)
|
||||
|
||||
uuid[6] = 0x70 | (uuid[6] & 0x0F)
|
||||
// uuid[8] has already has right version
|
||||
uuid[6] = 0x70 | (0x0F & byte(s>>8))
|
||||
uuid[7] = byte(s)
|
||||
}
|
||||
|
||||
// lastV7time is the last time we returned stored as:
|
||||
//
|
||||
// 52 bits of time in milliseconds since epoch
|
||||
// 12 bits of (fractional nanoseconds) >> 8
|
||||
var lastV7time int64
|
||||
|
||||
const nanoPerMilli = 1000000
|
||||
|
||||
// getV7Time returns the time in milliseconds and nanoseconds / 256.
|
||||
// The returned (milli << 12 + seq) is guarenteed to be greater than
|
||||
// (milli << 12 + seq) returned by any previous call to getV7Time.
|
||||
func getV7Time() (milli, seq int64) {
|
||||
timeMu.Lock()
|
||||
defer timeMu.Unlock()
|
||||
|
||||
nano := timeNow().UnixNano()
|
||||
milli = nano / nanoPerMilli
|
||||
// Sequence number is between 0 and 3906 (nanoPerMilli>>8)
|
||||
seq = (nano - milli*nanoPerMilli) >> 8
|
||||
now := milli<<12 + seq
|
||||
if now <= lastV7time {
|
||||
now = lastV7time + 1
|
||||
milli = now >> 12
|
||||
seq = now & 0xfff
|
||||
}
|
||||
lastV7time = now
|
||||
return milli, seq
|
||||
}
|
||||
|
||||
8
vendor/github.com/mafik/pulseaudio/client.go
generated
vendored
8
vendor/github.com/mafik/pulseaudio/client.go
generated
vendored
@@ -35,8 +35,6 @@ import (
|
||||
|
||||
const version = 32
|
||||
|
||||
var defaultAddr = fmt.Sprintf("/run/user/%d/pulse/native", os.Getuid())
|
||||
|
||||
type packetResponse struct {
|
||||
buff *bytes.Buffer
|
||||
err error
|
||||
@@ -67,7 +65,11 @@ type Client struct {
|
||||
// NewClient establishes a connection to the PulseAudio server.
|
||||
func NewClient(addressArr ...string) (*Client, error) {
|
||||
if len(addressArr) < 1 {
|
||||
addressArr = []string{defaultAddr}
|
||||
xdgRuntimeDir, ok := os.LookupEnv("XDG_RUNTIME_DIR")
|
||||
if !ok {
|
||||
xdgRuntimeDir = fmt.Sprintf("/run/user/%d", os.Getuid())
|
||||
}
|
||||
addressArr = []string{fmt.Sprintf("%s/pulse/native", xdgRuntimeDir)}
|
||||
}
|
||||
|
||||
conn, err := net.Dial("unix", addressArr[0])
|
||||
|
||||
12
vendor/github.com/yusufpapurcu/wmi/wmi.go
generated
vendored
12
vendor/github.com/yusufpapurcu/wmi/wmi.go
generated
vendored
@@ -456,6 +456,18 @@ func (c *Client) loadEntity(dst interface{}, src *ole.IDispatch) (errFieldMismat
|
||||
Reason: "not a Float32",
|
||||
}
|
||||
}
|
||||
case float64:
|
||||
switch f.Kind() {
|
||||
case reflect.Float32, reflect.Float64:
|
||||
f.SetFloat(val)
|
||||
default:
|
||||
return &ErrFieldMismatch{
|
||||
StructType: of.Type(),
|
||||
FieldName: n,
|
||||
Reason: "not a Float64",
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
if f.Kind() == reflect.Slice {
|
||||
switch f.Type().Elem().Kind() {
|
||||
|
||||
50
vendor/golang.org/x/exp/slices/slices.go
generated
vendored
50
vendor/golang.org/x/exp/slices/slices.go
generated
vendored
@@ -209,25 +209,37 @@ func Insert[S ~[]E, E any](s S, i int, v ...E) S {
|
||||
return s
|
||||
}
|
||||
|
||||
// Delete removes the elements s[i:j] from s, returning the modified slice.
|
||||
// Delete panics if s[i:j] is not a valid slice of s.
|
||||
// Delete is O(len(s)-j), so if many items must be deleted, it is better to
|
||||
// make a single call deleting them all together than to delete one at a time.
|
||||
// Delete might not modify the elements s[len(s)-(j-i):len(s)]. If those
|
||||
// elements contain pointers you might consider zeroing those elements so that
|
||||
// objects they reference can be garbage collected.
|
||||
func Delete[S ~[]E, E any](s S, i, j int) S {
|
||||
_ = s[i:j] // bounds check
|
||||
// clearSlice sets all elements up to the length of s to the zero value of E.
|
||||
// We may use the builtin clear func instead, and remove clearSlice, when upgrading
|
||||
// to Go 1.21+.
|
||||
func clearSlice[S ~[]E, E any](s S) {
|
||||
var zero E
|
||||
for i := range s {
|
||||
s[i] = zero
|
||||
}
|
||||
}
|
||||
|
||||
return append(s[:i], s[j:]...)
|
||||
// Delete removes the elements s[i:j] from s, returning the modified slice.
|
||||
// Delete panics if j > len(s) or s[i:j] is not a valid slice of s.
|
||||
// Delete is O(len(s)-i), so if many items must be deleted, it is better to
|
||||
// make a single call deleting them all together than to delete one at a time.
|
||||
// Delete zeroes the elements s[len(s)-(j-i):len(s)].
|
||||
func Delete[S ~[]E, E any](s S, i, j int) S {
|
||||
_ = s[i:j:len(s)] // bounds check
|
||||
|
||||
if i == j {
|
||||
return s
|
||||
}
|
||||
|
||||
oldlen := len(s)
|
||||
s = append(s[:i], s[j:]...)
|
||||
clearSlice(s[len(s):oldlen]) // zero/nil out the obsolete elements, for GC
|
||||
return s
|
||||
}
|
||||
|
||||
// DeleteFunc removes any elements from s for which del returns true,
|
||||
// returning the modified slice.
|
||||
// When DeleteFunc removes m elements, it might not modify the elements
|
||||
// s[len(s)-m:len(s)]. If those elements contain pointers you might consider
|
||||
// zeroing those elements so that objects they reference can be garbage
|
||||
// collected.
|
||||
// DeleteFunc zeroes the elements between the new length and the original length.
|
||||
func DeleteFunc[S ~[]E, E any](s S, del func(E) bool) S {
|
||||
i := IndexFunc(s, del)
|
||||
if i == -1 {
|
||||
@@ -240,11 +252,13 @@ func DeleteFunc[S ~[]E, E any](s S, del func(E) bool) S {
|
||||
i++
|
||||
}
|
||||
}
|
||||
clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC
|
||||
return s[:i]
|
||||
}
|
||||
|
||||
// Replace replaces the elements s[i:j] by the given v, and returns the
|
||||
// modified slice. Replace panics if s[i:j] is not a valid slice of s.
|
||||
// When len(v) < (j-i), Replace zeroes the elements between the new length and the original length.
|
||||
func Replace[S ~[]E, E any](s S, i, j int, v ...E) S {
|
||||
_ = s[i:j] // verify that i:j is a valid subslice
|
||||
|
||||
@@ -272,6 +286,7 @@ func Replace[S ~[]E, E any](s S, i, j int, v ...E) S {
|
||||
if i+len(v) != j {
|
||||
copy(r[i+len(v):], s[j:])
|
||||
}
|
||||
clearSlice(s[tot:]) // zero/nil out the obsolete elements, for GC
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -345,9 +360,7 @@ func Clone[S ~[]E, E any](s S) S {
|
||||
// This is like the uniq command found on Unix.
|
||||
// Compact modifies the contents of the slice s and returns the modified slice,
|
||||
// which may have a smaller length.
|
||||
// When Compact discards m elements in total, it might not modify the elements
|
||||
// s[len(s)-m:len(s)]. If those elements contain pointers you might consider
|
||||
// zeroing those elements so that objects they reference can be garbage collected.
|
||||
// Compact zeroes the elements between the new length and the original length.
|
||||
func Compact[S ~[]E, E comparable](s S) S {
|
||||
if len(s) < 2 {
|
||||
return s
|
||||
@@ -361,11 +374,13 @@ func Compact[S ~[]E, E comparable](s S) S {
|
||||
i++
|
||||
}
|
||||
}
|
||||
clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC
|
||||
return s[:i]
|
||||
}
|
||||
|
||||
// CompactFunc is like [Compact] but uses an equality function to compare elements.
|
||||
// For runs of elements that compare equal, CompactFunc keeps the first one.
|
||||
// CompactFunc zeroes the elements between the new length and the original length.
|
||||
func CompactFunc[S ~[]E, E any](s S, eq func(E, E) bool) S {
|
||||
if len(s) < 2 {
|
||||
return s
|
||||
@@ -379,6 +394,7 @@ func CompactFunc[S ~[]E, E any](s S, eq func(E, E) bool) S {
|
||||
i++
|
||||
}
|
||||
}
|
||||
clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC
|
||||
return s[:i]
|
||||
}
|
||||
|
||||
|
||||
2
vendor/golang.org/x/sys/unix/aliases.go
generated
vendored
2
vendor/golang.org/x/sys/unix/aliases.go
generated
vendored
@@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9
|
||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||
|
||||
package unix
|
||||
|
||||
|
||||
2
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
2
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
@@ -584,7 +584,7 @@ ccflags="$@"
|
||||
$2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
|
||||
$2 ~ /^KEYCTL_/ ||
|
||||
$2 ~ /^PERF_/ ||
|
||||
$2 ~ /^SECCOMP_MODE_/ ||
|
||||
$2 ~ /^SECCOMP_/ ||
|
||||
$2 ~ /^SEEK_/ ||
|
||||
$2 ~ /^SCHED_/ ||
|
||||
$2 ~ /^SPLICE_/ ||
|
||||
|
||||
2
vendor/golang.org/x/sys/unix/mmap_nomremap.go
generated
vendored
2
vendor/golang.org/x/sys/unix/mmap_nomremap.go
generated
vendored
@@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build aix || darwin || dragonfly || freebsd || openbsd || solaris
|
||||
//go:build aix || darwin || dragonfly || freebsd || openbsd || solaris || zos
|
||||
|
||||
package unix
|
||||
|
||||
|
||||
2
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
@@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build darwin && go1.12
|
||||
//go:build darwin
|
||||
|
||||
package unix
|
||||
|
||||
|
||||
12
vendor/golang.org/x/sys/unix/syscall_freebsd.go
generated
vendored
12
vendor/golang.org/x/sys/unix/syscall_freebsd.go
generated
vendored
@@ -13,6 +13,7 @@
|
||||
package unix
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"sync"
|
||||
"unsafe"
|
||||
)
|
||||
@@ -169,25 +170,26 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||
func Uname(uname *Utsname) error {
|
||||
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
|
||||
n := unsafe.Sizeof(uname.Sysname)
|
||||
if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil {
|
||||
// Suppress ENOMEM errors to be compatible with the C library __xuname() implementation.
|
||||
if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
|
||||
n = unsafe.Sizeof(uname.Nodename)
|
||||
if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil {
|
||||
if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
|
||||
n = unsafe.Sizeof(uname.Release)
|
||||
if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil {
|
||||
if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_VERSION}
|
||||
n = unsafe.Sizeof(uname.Version)
|
||||
if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil {
|
||||
if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -205,7 +207,7 @@ func Uname(uname *Utsname) error {
|
||||
|
||||
mib = []_C_int{CTL_HW, HW_MACHINE}
|
||||
n = unsafe.Sizeof(uname.Machine)
|
||||
if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil {
|
||||
if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
99
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
99
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
@@ -1849,6 +1849,105 @@ func Dup2(oldfd, newfd int) error {
|
||||
//sys Fsmount(fd int, flags int, mountAttrs int) (fsfd int, err error)
|
||||
//sys Fsopen(fsName string, flags int) (fd int, err error)
|
||||
//sys Fspick(dirfd int, pathName string, flags int) (fd int, err error)
|
||||
|
||||
//sys fsconfig(fd int, cmd uint, key *byte, value *byte, aux int) (err error)
|
||||
|
||||
func fsconfigCommon(fd int, cmd uint, key string, value *byte, aux int) (err error) {
|
||||
var keyp *byte
|
||||
if keyp, err = BytePtrFromString(key); err != nil {
|
||||
return
|
||||
}
|
||||
return fsconfig(fd, cmd, keyp, value, aux)
|
||||
}
|
||||
|
||||
// FsconfigSetFlag is equivalent to fsconfig(2) called
|
||||
// with cmd == FSCONFIG_SET_FLAG.
|
||||
//
|
||||
// fd is the filesystem context to act upon.
|
||||
// key the parameter key to set.
|
||||
func FsconfigSetFlag(fd int, key string) (err error) {
|
||||
return fsconfigCommon(fd, FSCONFIG_SET_FLAG, key, nil, 0)
|
||||
}
|
||||
|
||||
// FsconfigSetString is equivalent to fsconfig(2) called
|
||||
// with cmd == FSCONFIG_SET_STRING.
|
||||
//
|
||||
// fd is the filesystem context to act upon.
|
||||
// key the parameter key to set.
|
||||
// value is the parameter value to set.
|
||||
func FsconfigSetString(fd int, key string, value string) (err error) {
|
||||
var valuep *byte
|
||||
if valuep, err = BytePtrFromString(value); err != nil {
|
||||
return
|
||||
}
|
||||
return fsconfigCommon(fd, FSCONFIG_SET_STRING, key, valuep, 0)
|
||||
}
|
||||
|
||||
// FsconfigSetBinary is equivalent to fsconfig(2) called
|
||||
// with cmd == FSCONFIG_SET_BINARY.
|
||||
//
|
||||
// fd is the filesystem context to act upon.
|
||||
// key the parameter key to set.
|
||||
// value is the parameter value to set.
|
||||
func FsconfigSetBinary(fd int, key string, value []byte) (err error) {
|
||||
if len(value) == 0 {
|
||||
return EINVAL
|
||||
}
|
||||
return fsconfigCommon(fd, FSCONFIG_SET_BINARY, key, &value[0], len(value))
|
||||
}
|
||||
|
||||
// FsconfigSetPath is equivalent to fsconfig(2) called
|
||||
// with cmd == FSCONFIG_SET_PATH.
|
||||
//
|
||||
// fd is the filesystem context to act upon.
|
||||
// key the parameter key to set.
|
||||
// path is a non-empty path for specified key.
|
||||
// atfd is a file descriptor at which to start lookup from or AT_FDCWD.
|
||||
func FsconfigSetPath(fd int, key string, path string, atfd int) (err error) {
|
||||
var valuep *byte
|
||||
if valuep, err = BytePtrFromString(path); err != nil {
|
||||
return
|
||||
}
|
||||
return fsconfigCommon(fd, FSCONFIG_SET_PATH, key, valuep, atfd)
|
||||
}
|
||||
|
||||
// FsconfigSetPathEmpty is equivalent to fsconfig(2) called
|
||||
// with cmd == FSCONFIG_SET_PATH_EMPTY. The same as
|
||||
// FconfigSetPath but with AT_PATH_EMPTY implied.
|
||||
func FsconfigSetPathEmpty(fd int, key string, path string, atfd int) (err error) {
|
||||
var valuep *byte
|
||||
if valuep, err = BytePtrFromString(path); err != nil {
|
||||
return
|
||||
}
|
||||
return fsconfigCommon(fd, FSCONFIG_SET_PATH_EMPTY, key, valuep, atfd)
|
||||
}
|
||||
|
||||
// FsconfigSetFd is equivalent to fsconfig(2) called
|
||||
// with cmd == FSCONFIG_SET_FD.
|
||||
//
|
||||
// fd is the filesystem context to act upon.
|
||||
// key the parameter key to set.
|
||||
// value is a file descriptor to be assigned to specified key.
|
||||
func FsconfigSetFd(fd int, key string, value int) (err error) {
|
||||
return fsconfigCommon(fd, FSCONFIG_SET_FD, key, nil, value)
|
||||
}
|
||||
|
||||
// FsconfigCreate is equivalent to fsconfig(2) called
|
||||
// with cmd == FSCONFIG_CMD_CREATE.
|
||||
//
|
||||
// fd is the filesystem context to act upon.
|
||||
func FsconfigCreate(fd int) (err error) {
|
||||
return fsconfig(fd, FSCONFIG_CMD_CREATE, nil, nil, 0)
|
||||
}
|
||||
|
||||
// FsconfigReconfigure is equivalent to fsconfig(2) called
|
||||
// with cmd == FSCONFIG_CMD_RECONFIGURE.
|
||||
//
|
||||
// fd is the filesystem context to act upon.
|
||||
func FsconfigReconfigure(fd int) (err error) {
|
||||
return fsconfig(fd, FSCONFIG_CMD_RECONFIGURE, nil, nil, 0)
|
||||
}
|
||||
|
||||
//sys Getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64
|
||||
//sysnb Getpgid(pid int) (pgid int, err error)
|
||||
|
||||
|
||||
8
vendor/golang.org/x/sys/unix/syscall_zos_s390x.go
generated
vendored
8
vendor/golang.org/x/sys/unix/syscall_zos_s390x.go
generated
vendored
@@ -1520,6 +1520,14 @@ func (m *mmapper) Munmap(data []byte) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
|
||||
return mapper.Mmap(fd, offset, length, prot, flags)
|
||||
}
|
||||
|
||||
func Munmap(b []byte) (err error) {
|
||||
return mapper.Munmap(b)
|
||||
}
|
||||
|
||||
func Read(fd int, p []byte) (n int, err error) {
|
||||
n, err = read(fd, p)
|
||||
if raceenabled {
|
||||
|
||||
36
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
36
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
@@ -1785,6 +1785,8 @@ const (
|
||||
LANDLOCK_ACCESS_FS_REMOVE_FILE = 0x20
|
||||
LANDLOCK_ACCESS_FS_TRUNCATE = 0x4000
|
||||
LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2
|
||||
LANDLOCK_ACCESS_NET_BIND_TCP = 0x1
|
||||
LANDLOCK_ACCESS_NET_CONNECT_TCP = 0x2
|
||||
LANDLOCK_CREATE_RULESET_VERSION = 0x1
|
||||
LINUX_REBOOT_CMD_CAD_OFF = 0x0
|
||||
LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef
|
||||
@@ -2465,6 +2467,7 @@ const (
|
||||
PR_MCE_KILL_GET = 0x22
|
||||
PR_MCE_KILL_LATE = 0x0
|
||||
PR_MCE_KILL_SET = 0x1
|
||||
PR_MDWE_NO_INHERIT = 0x2
|
||||
PR_MDWE_REFUSE_EXEC_GAIN = 0x1
|
||||
PR_MPX_DISABLE_MANAGEMENT = 0x2c
|
||||
PR_MPX_ENABLE_MANAGEMENT = 0x2b
|
||||
@@ -2669,8 +2672,9 @@ const (
|
||||
RTAX_FEATURES = 0xc
|
||||
RTAX_FEATURE_ALLFRAG = 0x8
|
||||
RTAX_FEATURE_ECN = 0x1
|
||||
RTAX_FEATURE_MASK = 0xf
|
||||
RTAX_FEATURE_MASK = 0x1f
|
||||
RTAX_FEATURE_SACK = 0x2
|
||||
RTAX_FEATURE_TCP_USEC_TS = 0x10
|
||||
RTAX_FEATURE_TIMESTAMP = 0x4
|
||||
RTAX_HOPLIMIT = 0xa
|
||||
RTAX_INITCWND = 0xb
|
||||
@@ -2913,9 +2917,38 @@ const (
|
||||
SCM_RIGHTS = 0x1
|
||||
SCM_TIMESTAMP = 0x1d
|
||||
SC_LOG_FLUSH = 0x100000
|
||||
SECCOMP_ADDFD_FLAG_SEND = 0x2
|
||||
SECCOMP_ADDFD_FLAG_SETFD = 0x1
|
||||
SECCOMP_FILTER_FLAG_LOG = 0x2
|
||||
SECCOMP_FILTER_FLAG_NEW_LISTENER = 0x8
|
||||
SECCOMP_FILTER_FLAG_SPEC_ALLOW = 0x4
|
||||
SECCOMP_FILTER_FLAG_TSYNC = 0x1
|
||||
SECCOMP_FILTER_FLAG_TSYNC_ESRCH = 0x10
|
||||
SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV = 0x20
|
||||
SECCOMP_GET_ACTION_AVAIL = 0x2
|
||||
SECCOMP_GET_NOTIF_SIZES = 0x3
|
||||
SECCOMP_IOCTL_NOTIF_RECV = 0xc0502100
|
||||
SECCOMP_IOCTL_NOTIF_SEND = 0xc0182101
|
||||
SECCOMP_IOC_MAGIC = '!'
|
||||
SECCOMP_MODE_DISABLED = 0x0
|
||||
SECCOMP_MODE_FILTER = 0x2
|
||||
SECCOMP_MODE_STRICT = 0x1
|
||||
SECCOMP_RET_ACTION = 0x7fff0000
|
||||
SECCOMP_RET_ACTION_FULL = 0xffff0000
|
||||
SECCOMP_RET_ALLOW = 0x7fff0000
|
||||
SECCOMP_RET_DATA = 0xffff
|
||||
SECCOMP_RET_ERRNO = 0x50000
|
||||
SECCOMP_RET_KILL = 0x0
|
||||
SECCOMP_RET_KILL_PROCESS = 0x80000000
|
||||
SECCOMP_RET_KILL_THREAD = 0x0
|
||||
SECCOMP_RET_LOG = 0x7ffc0000
|
||||
SECCOMP_RET_TRACE = 0x7ff00000
|
||||
SECCOMP_RET_TRAP = 0x30000
|
||||
SECCOMP_RET_USER_NOTIF = 0x7fc00000
|
||||
SECCOMP_SET_MODE_FILTER = 0x1
|
||||
SECCOMP_SET_MODE_STRICT = 0x0
|
||||
SECCOMP_USER_NOTIF_FD_SYNC_WAKE_UP = 0x1
|
||||
SECCOMP_USER_NOTIF_FLAG_CONTINUE = 0x1
|
||||
SECRETMEM_MAGIC = 0x5345434d
|
||||
SECURITYFS_MAGIC = 0x73636673
|
||||
SEEK_CUR = 0x1
|
||||
@@ -3075,6 +3108,7 @@ const (
|
||||
SOL_TIPC = 0x10f
|
||||
SOL_TLS = 0x11a
|
||||
SOL_UDP = 0x11
|
||||
SOL_VSOCK = 0x11f
|
||||
SOL_X25 = 0x106
|
||||
SOL_XDP = 0x11b
|
||||
SOMAXCONN = 0x1000
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
@@ -281,6 +281,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SIOCATMARK = 0x8905
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
@@ -282,6 +282,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SIOCATMARK = 0x8905
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
@@ -288,6 +288,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SIOCATMARK = 0x8905
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
@@ -278,6 +278,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SIOCATMARK = 0x8905
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go
generated
vendored
@@ -275,6 +275,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SIOCATMARK = 0x8905
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
@@ -281,6 +281,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x80
|
||||
SIOCATMARK = 0x40047307
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
@@ -281,6 +281,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x80
|
||||
SIOCATMARK = 0x40047307
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
@@ -281,6 +281,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x80
|
||||
SIOCATMARK = 0x40047307
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
@@ -281,6 +281,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x80
|
||||
SIOCATMARK = 0x40047307
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go
generated
vendored
@@ -336,6 +336,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SIOCATMARK = 0x8905
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
@@ -340,6 +340,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SIOCATMARK = 0x8905
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
@@ -340,6 +340,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SIOCATMARK = 0x8905
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
generated
vendored
@@ -272,6 +272,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SIOCATMARK = 0x8905
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
@@ -344,6 +344,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x40082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x40082104
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SIOCATMARK = 0x8905
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
generated
vendored
@@ -335,6 +335,9 @@ const (
|
||||
SCM_TIMESTAMPNS = 0x21
|
||||
SCM_TXTIME = 0x3f
|
||||
SCM_WIFI_STATUS = 0x25
|
||||
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103
|
||||
SECCOMP_IOCTL_NOTIF_ID_VALID = 0x80082102
|
||||
SECCOMP_IOCTL_NOTIF_SET_FLAGS = 0x80082104
|
||||
SFD_CLOEXEC = 0x400000
|
||||
SFD_NONBLOCK = 0x4000
|
||||
SF_FP = 0x38
|
||||
|
||||
10
vendor/golang.org/x/sys/unix/zsyscall_linux.go
generated
vendored
10
vendor/golang.org/x/sys/unix/zsyscall_linux.go
generated
vendored
@@ -906,6 +906,16 @@ func Fspick(dirfd int, pathName string, flags int) (fd int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func fsconfig(fd int, cmd uint, key *byte, value *byte, aux int) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_FSCONFIG, uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(value)), uintptr(aux), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Getdents(fd int, buf []byte) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
generated
vendored
@@ -448,4 +448,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 450
|
||||
SYS_CACHESTAT = 451
|
||||
SYS_FCHMODAT2 = 452
|
||||
SYS_MAP_SHADOW_STACK = 453
|
||||
SYS_FUTEX_WAKE = 454
|
||||
SYS_FUTEX_WAIT = 455
|
||||
SYS_FUTEX_REQUEUE = 456
|
||||
)
|
||||
|
||||
3
vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
generated
vendored
3
vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
generated
vendored
@@ -371,4 +371,7 @@ const (
|
||||
SYS_CACHESTAT = 451
|
||||
SYS_FCHMODAT2 = 452
|
||||
SYS_MAP_SHADOW_STACK = 453
|
||||
SYS_FUTEX_WAKE = 454
|
||||
SYS_FUTEX_WAIT = 455
|
||||
SYS_FUTEX_REQUEUE = 456
|
||||
)
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
generated
vendored
@@ -412,4 +412,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 450
|
||||
SYS_CACHESTAT = 451
|
||||
SYS_FCHMODAT2 = 452
|
||||
SYS_MAP_SHADOW_STACK = 453
|
||||
SYS_FUTEX_WAKE = 454
|
||||
SYS_FUTEX_WAIT = 455
|
||||
SYS_FUTEX_REQUEUE = 456
|
||||
)
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
generated
vendored
@@ -315,4 +315,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 450
|
||||
SYS_CACHESTAT = 451
|
||||
SYS_FCHMODAT2 = 452
|
||||
SYS_MAP_SHADOW_STACK = 453
|
||||
SYS_FUTEX_WAKE = 454
|
||||
SYS_FUTEX_WAIT = 455
|
||||
SYS_FUTEX_REQUEUE = 456
|
||||
)
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go
generated
vendored
@@ -309,4 +309,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 450
|
||||
SYS_CACHESTAT = 451
|
||||
SYS_FCHMODAT2 = 452
|
||||
SYS_MAP_SHADOW_STACK = 453
|
||||
SYS_FUTEX_WAKE = 454
|
||||
SYS_FUTEX_WAIT = 455
|
||||
SYS_FUTEX_REQUEUE = 456
|
||||
)
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
generated
vendored
@@ -432,4 +432,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 4450
|
||||
SYS_CACHESTAT = 4451
|
||||
SYS_FCHMODAT2 = 4452
|
||||
SYS_MAP_SHADOW_STACK = 4453
|
||||
SYS_FUTEX_WAKE = 4454
|
||||
SYS_FUTEX_WAIT = 4455
|
||||
SYS_FUTEX_REQUEUE = 4456
|
||||
)
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
generated
vendored
@@ -362,4 +362,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 5450
|
||||
SYS_CACHESTAT = 5451
|
||||
SYS_FCHMODAT2 = 5452
|
||||
SYS_MAP_SHADOW_STACK = 5453
|
||||
SYS_FUTEX_WAKE = 5454
|
||||
SYS_FUTEX_WAIT = 5455
|
||||
SYS_FUTEX_REQUEUE = 5456
|
||||
)
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
generated
vendored
@@ -362,4 +362,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 5450
|
||||
SYS_CACHESTAT = 5451
|
||||
SYS_FCHMODAT2 = 5452
|
||||
SYS_MAP_SHADOW_STACK = 5453
|
||||
SYS_FUTEX_WAKE = 5454
|
||||
SYS_FUTEX_WAIT = 5455
|
||||
SYS_FUTEX_REQUEUE = 5456
|
||||
)
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
generated
vendored
@@ -432,4 +432,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 4450
|
||||
SYS_CACHESTAT = 4451
|
||||
SYS_FCHMODAT2 = 4452
|
||||
SYS_MAP_SHADOW_STACK = 4453
|
||||
SYS_FUTEX_WAKE = 4454
|
||||
SYS_FUTEX_WAIT = 4455
|
||||
SYS_FUTEX_REQUEUE = 4456
|
||||
)
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go
generated
vendored
@@ -439,4 +439,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 450
|
||||
SYS_CACHESTAT = 451
|
||||
SYS_FCHMODAT2 = 452
|
||||
SYS_MAP_SHADOW_STACK = 453
|
||||
SYS_FUTEX_WAKE = 454
|
||||
SYS_FUTEX_WAIT = 455
|
||||
SYS_FUTEX_REQUEUE = 456
|
||||
)
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
generated
vendored
@@ -411,4 +411,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 450
|
||||
SYS_CACHESTAT = 451
|
||||
SYS_FCHMODAT2 = 452
|
||||
SYS_MAP_SHADOW_STACK = 453
|
||||
SYS_FUTEX_WAKE = 454
|
||||
SYS_FUTEX_WAIT = 455
|
||||
SYS_FUTEX_REQUEUE = 456
|
||||
)
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
generated
vendored
@@ -411,4 +411,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 450
|
||||
SYS_CACHESTAT = 451
|
||||
SYS_FCHMODAT2 = 452
|
||||
SYS_MAP_SHADOW_STACK = 453
|
||||
SYS_FUTEX_WAKE = 454
|
||||
SYS_FUTEX_WAIT = 455
|
||||
SYS_FUTEX_REQUEUE = 456
|
||||
)
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
generated
vendored
@@ -316,4 +316,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 450
|
||||
SYS_CACHESTAT = 451
|
||||
SYS_FCHMODAT2 = 452
|
||||
SYS_MAP_SHADOW_STACK = 453
|
||||
SYS_FUTEX_WAKE = 454
|
||||
SYS_FUTEX_WAIT = 455
|
||||
SYS_FUTEX_REQUEUE = 456
|
||||
)
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
generated
vendored
@@ -377,4 +377,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 450
|
||||
SYS_CACHESTAT = 451
|
||||
SYS_FCHMODAT2 = 452
|
||||
SYS_MAP_SHADOW_STACK = 453
|
||||
SYS_FUTEX_WAKE = 454
|
||||
SYS_FUTEX_WAIT = 455
|
||||
SYS_FUTEX_REQUEUE = 456
|
||||
)
|
||||
|
||||
4
vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
generated
vendored
4
vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
generated
vendored
@@ -390,4 +390,8 @@ const (
|
||||
SYS_SET_MEMPOLICY_HOME_NODE = 450
|
||||
SYS_CACHESTAT = 451
|
||||
SYS_FCHMODAT2 = 452
|
||||
SYS_MAP_SHADOW_STACK = 453
|
||||
SYS_FUTEX_WAKE = 454
|
||||
SYS_FUTEX_WAIT = 455
|
||||
SYS_FUTEX_REQUEUE = 456
|
||||
)
|
||||
|
||||
185
vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
185
vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
@@ -174,7 +174,8 @@ type FscryptPolicyV2 struct {
|
||||
Contents_encryption_mode uint8
|
||||
Filenames_encryption_mode uint8
|
||||
Flags uint8
|
||||
_ [4]uint8
|
||||
Log2_data_unit_size uint8
|
||||
_ [3]uint8
|
||||
Master_key_identifier [16]uint8
|
||||
}
|
||||
|
||||
@@ -455,60 +456,63 @@ type Ucred struct {
|
||||
}
|
||||
|
||||
type TCPInfo struct {
|
||||
State uint8
|
||||
Ca_state uint8
|
||||
Retransmits uint8
|
||||
Probes uint8
|
||||
Backoff uint8
|
||||
Options uint8
|
||||
Rto uint32
|
||||
Ato uint32
|
||||
Snd_mss uint32
|
||||
Rcv_mss uint32
|
||||
Unacked uint32
|
||||
Sacked uint32
|
||||
Lost uint32
|
||||
Retrans uint32
|
||||
Fackets uint32
|
||||
Last_data_sent uint32
|
||||
Last_ack_sent uint32
|
||||
Last_data_recv uint32
|
||||
Last_ack_recv uint32
|
||||
Pmtu uint32
|
||||
Rcv_ssthresh uint32
|
||||
Rtt uint32
|
||||
Rttvar uint32
|
||||
Snd_ssthresh uint32
|
||||
Snd_cwnd uint32
|
||||
Advmss uint32
|
||||
Reordering uint32
|
||||
Rcv_rtt uint32
|
||||
Rcv_space uint32
|
||||
Total_retrans uint32
|
||||
Pacing_rate uint64
|
||||
Max_pacing_rate uint64
|
||||
Bytes_acked uint64
|
||||
Bytes_received uint64
|
||||
Segs_out uint32
|
||||
Segs_in uint32
|
||||
Notsent_bytes uint32
|
||||
Min_rtt uint32
|
||||
Data_segs_in uint32
|
||||
Data_segs_out uint32
|
||||
Delivery_rate uint64
|
||||
Busy_time uint64
|
||||
Rwnd_limited uint64
|
||||
Sndbuf_limited uint64
|
||||
Delivered uint32
|
||||
Delivered_ce uint32
|
||||
Bytes_sent uint64
|
||||
Bytes_retrans uint64
|
||||
Dsack_dups uint32
|
||||
Reord_seen uint32
|
||||
Rcv_ooopack uint32
|
||||
Snd_wnd uint32
|
||||
Rcv_wnd uint32
|
||||
Rehash uint32
|
||||
State uint8
|
||||
Ca_state uint8
|
||||
Retransmits uint8
|
||||
Probes uint8
|
||||
Backoff uint8
|
||||
Options uint8
|
||||
Rto uint32
|
||||
Ato uint32
|
||||
Snd_mss uint32
|
||||
Rcv_mss uint32
|
||||
Unacked uint32
|
||||
Sacked uint32
|
||||
Lost uint32
|
||||
Retrans uint32
|
||||
Fackets uint32
|
||||
Last_data_sent uint32
|
||||
Last_ack_sent uint32
|
||||
Last_data_recv uint32
|
||||
Last_ack_recv uint32
|
||||
Pmtu uint32
|
||||
Rcv_ssthresh uint32
|
||||
Rtt uint32
|
||||
Rttvar uint32
|
||||
Snd_ssthresh uint32
|
||||
Snd_cwnd uint32
|
||||
Advmss uint32
|
||||
Reordering uint32
|
||||
Rcv_rtt uint32
|
||||
Rcv_space uint32
|
||||
Total_retrans uint32
|
||||
Pacing_rate uint64
|
||||
Max_pacing_rate uint64
|
||||
Bytes_acked uint64
|
||||
Bytes_received uint64
|
||||
Segs_out uint32
|
||||
Segs_in uint32
|
||||
Notsent_bytes uint32
|
||||
Min_rtt uint32
|
||||
Data_segs_in uint32
|
||||
Data_segs_out uint32
|
||||
Delivery_rate uint64
|
||||
Busy_time uint64
|
||||
Rwnd_limited uint64
|
||||
Sndbuf_limited uint64
|
||||
Delivered uint32
|
||||
Delivered_ce uint32
|
||||
Bytes_sent uint64
|
||||
Bytes_retrans uint64
|
||||
Dsack_dups uint32
|
||||
Reord_seen uint32
|
||||
Rcv_ooopack uint32
|
||||
Snd_wnd uint32
|
||||
Rcv_wnd uint32
|
||||
Rehash uint32
|
||||
Total_rto uint16
|
||||
Total_rto_recoveries uint16
|
||||
Total_rto_time uint32
|
||||
}
|
||||
|
||||
type CanFilter struct {
|
||||
@@ -551,7 +555,7 @@ const (
|
||||
SizeofIPv6MTUInfo = 0x20
|
||||
SizeofICMPv6Filter = 0x20
|
||||
SizeofUcred = 0xc
|
||||
SizeofTCPInfo = 0xf0
|
||||
SizeofTCPInfo = 0xf8
|
||||
SizeofCanFilter = 0x8
|
||||
SizeofTCPRepairOpt = 0x8
|
||||
)
|
||||
@@ -832,6 +836,15 @@ const (
|
||||
FSPICK_EMPTY_PATH = 0x8
|
||||
|
||||
FSMOUNT_CLOEXEC = 0x1
|
||||
|
||||
FSCONFIG_SET_FLAG = 0x0
|
||||
FSCONFIG_SET_STRING = 0x1
|
||||
FSCONFIG_SET_BINARY = 0x2
|
||||
FSCONFIG_SET_PATH = 0x3
|
||||
FSCONFIG_SET_PATH_EMPTY = 0x4
|
||||
FSCONFIG_SET_FD = 0x5
|
||||
FSCONFIG_CMD_CREATE = 0x6
|
||||
FSCONFIG_CMD_RECONFIGURE = 0x7
|
||||
)
|
||||
|
||||
type OpenHow struct {
|
||||
@@ -1546,6 +1559,7 @@ const (
|
||||
IFLA_DEVLINK_PORT = 0x3e
|
||||
IFLA_GSO_IPV4_MAX_SIZE = 0x3f
|
||||
IFLA_GRO_IPV4_MAX_SIZE = 0x40
|
||||
IFLA_DPLL_PIN = 0x41
|
||||
IFLA_PROTO_DOWN_REASON_UNSPEC = 0x0
|
||||
IFLA_PROTO_DOWN_REASON_MASK = 0x1
|
||||
IFLA_PROTO_DOWN_REASON_VALUE = 0x2
|
||||
@@ -1561,6 +1575,7 @@ const (
|
||||
IFLA_INET6_ICMP6STATS = 0x6
|
||||
IFLA_INET6_TOKEN = 0x7
|
||||
IFLA_INET6_ADDR_GEN_MODE = 0x8
|
||||
IFLA_INET6_RA_MTU = 0x9
|
||||
IFLA_BR_UNSPEC = 0x0
|
||||
IFLA_BR_FORWARD_DELAY = 0x1
|
||||
IFLA_BR_HELLO_TIME = 0x2
|
||||
@@ -1608,6 +1623,9 @@ const (
|
||||
IFLA_BR_MCAST_MLD_VERSION = 0x2c
|
||||
IFLA_BR_VLAN_STATS_PER_PORT = 0x2d
|
||||
IFLA_BR_MULTI_BOOLOPT = 0x2e
|
||||
IFLA_BR_MCAST_QUERIER_STATE = 0x2f
|
||||
IFLA_BR_FDB_N_LEARNED = 0x30
|
||||
IFLA_BR_FDB_MAX_LEARNED = 0x31
|
||||
IFLA_BRPORT_UNSPEC = 0x0
|
||||
IFLA_BRPORT_STATE = 0x1
|
||||
IFLA_BRPORT_PRIORITY = 0x2
|
||||
@@ -1645,6 +1663,14 @@ const (
|
||||
IFLA_BRPORT_BACKUP_PORT = 0x22
|
||||
IFLA_BRPORT_MRP_RING_OPEN = 0x23
|
||||
IFLA_BRPORT_MRP_IN_OPEN = 0x24
|
||||
IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT = 0x25
|
||||
IFLA_BRPORT_MCAST_EHT_HOSTS_CNT = 0x26
|
||||
IFLA_BRPORT_LOCKED = 0x27
|
||||
IFLA_BRPORT_MAB = 0x28
|
||||
IFLA_BRPORT_MCAST_N_GROUPS = 0x29
|
||||
IFLA_BRPORT_MCAST_MAX_GROUPS = 0x2a
|
||||
IFLA_BRPORT_NEIGH_VLAN_SUPPRESS = 0x2b
|
||||
IFLA_BRPORT_BACKUP_NHID = 0x2c
|
||||
IFLA_INFO_UNSPEC = 0x0
|
||||
IFLA_INFO_KIND = 0x1
|
||||
IFLA_INFO_DATA = 0x2
|
||||
@@ -1666,6 +1692,9 @@ const (
|
||||
IFLA_MACVLAN_MACADDR = 0x4
|
||||
IFLA_MACVLAN_MACADDR_DATA = 0x5
|
||||
IFLA_MACVLAN_MACADDR_COUNT = 0x6
|
||||
IFLA_MACVLAN_BC_QUEUE_LEN = 0x7
|
||||
IFLA_MACVLAN_BC_QUEUE_LEN_USED = 0x8
|
||||
IFLA_MACVLAN_BC_CUTOFF = 0x9
|
||||
IFLA_VRF_UNSPEC = 0x0
|
||||
IFLA_VRF_TABLE = 0x1
|
||||
IFLA_VRF_PORT_UNSPEC = 0x0
|
||||
@@ -1689,9 +1718,22 @@ const (
|
||||
IFLA_XFRM_UNSPEC = 0x0
|
||||
IFLA_XFRM_LINK = 0x1
|
||||
IFLA_XFRM_IF_ID = 0x2
|
||||
IFLA_XFRM_COLLECT_METADATA = 0x3
|
||||
IFLA_IPVLAN_UNSPEC = 0x0
|
||||
IFLA_IPVLAN_MODE = 0x1
|
||||
IFLA_IPVLAN_FLAGS = 0x2
|
||||
NETKIT_NEXT = -0x1
|
||||
NETKIT_PASS = 0x0
|
||||
NETKIT_DROP = 0x2
|
||||
NETKIT_REDIRECT = 0x7
|
||||
NETKIT_L2 = 0x0
|
||||
NETKIT_L3 = 0x1
|
||||
IFLA_NETKIT_UNSPEC = 0x0
|
||||
IFLA_NETKIT_PEER_INFO = 0x1
|
||||
IFLA_NETKIT_PRIMARY = 0x2
|
||||
IFLA_NETKIT_POLICY = 0x3
|
||||
IFLA_NETKIT_PEER_POLICY = 0x4
|
||||
IFLA_NETKIT_MODE = 0x5
|
||||
IFLA_VXLAN_UNSPEC = 0x0
|
||||
IFLA_VXLAN_ID = 0x1
|
||||
IFLA_VXLAN_GROUP = 0x2
|
||||
@@ -1722,6 +1764,8 @@ const (
|
||||
IFLA_VXLAN_GPE = 0x1b
|
||||
IFLA_VXLAN_TTL_INHERIT = 0x1c
|
||||
IFLA_VXLAN_DF = 0x1d
|
||||
IFLA_VXLAN_VNIFILTER = 0x1e
|
||||
IFLA_VXLAN_LOCALBYPASS = 0x1f
|
||||
IFLA_GENEVE_UNSPEC = 0x0
|
||||
IFLA_GENEVE_ID = 0x1
|
||||
IFLA_GENEVE_REMOTE = 0x2
|
||||
@@ -1736,6 +1780,7 @@ const (
|
||||
IFLA_GENEVE_LABEL = 0xb
|
||||
IFLA_GENEVE_TTL_INHERIT = 0xc
|
||||
IFLA_GENEVE_DF = 0xd
|
||||
IFLA_GENEVE_INNER_PROTO_INHERIT = 0xe
|
||||
IFLA_BAREUDP_UNSPEC = 0x0
|
||||
IFLA_BAREUDP_PORT = 0x1
|
||||
IFLA_BAREUDP_ETHERTYPE = 0x2
|
||||
@@ -1748,6 +1793,8 @@ const (
|
||||
IFLA_GTP_FD1 = 0x2
|
||||
IFLA_GTP_PDP_HASHSIZE = 0x3
|
||||
IFLA_GTP_ROLE = 0x4
|
||||
IFLA_GTP_CREATE_SOCKETS = 0x5
|
||||
IFLA_GTP_RESTART_COUNT = 0x6
|
||||
IFLA_BOND_UNSPEC = 0x0
|
||||
IFLA_BOND_MODE = 0x1
|
||||
IFLA_BOND_ACTIVE_SLAVE = 0x2
|
||||
@@ -1777,6 +1824,9 @@ const (
|
||||
IFLA_BOND_AD_ACTOR_SYSTEM = 0x1a
|
||||
IFLA_BOND_TLB_DYNAMIC_LB = 0x1b
|
||||
IFLA_BOND_PEER_NOTIF_DELAY = 0x1c
|
||||
IFLA_BOND_AD_LACP_ACTIVE = 0x1d
|
||||
IFLA_BOND_MISSED_MAX = 0x1e
|
||||
IFLA_BOND_NS_IP6_TARGET = 0x1f
|
||||
IFLA_BOND_AD_INFO_UNSPEC = 0x0
|
||||
IFLA_BOND_AD_INFO_AGGREGATOR = 0x1
|
||||
IFLA_BOND_AD_INFO_NUM_PORTS = 0x2
|
||||
@@ -1792,6 +1842,7 @@ const (
|
||||
IFLA_BOND_SLAVE_AD_AGGREGATOR_ID = 0x6
|
||||
IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE = 0x7
|
||||
IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE = 0x8
|
||||
IFLA_BOND_SLAVE_PRIO = 0x9
|
||||
IFLA_VF_INFO_UNSPEC = 0x0
|
||||
IFLA_VF_INFO = 0x1
|
||||
IFLA_VF_UNSPEC = 0x0
|
||||
@@ -1850,8 +1901,16 @@ const (
|
||||
IFLA_STATS_LINK_XSTATS_SLAVE = 0x3
|
||||
IFLA_STATS_LINK_OFFLOAD_XSTATS = 0x4
|
||||
IFLA_STATS_AF_SPEC = 0x5
|
||||
IFLA_STATS_GETSET_UNSPEC = 0x0
|
||||
IFLA_STATS_GET_FILTERS = 0x1
|
||||
IFLA_STATS_SET_OFFLOAD_XSTATS_L3_STATS = 0x2
|
||||
IFLA_OFFLOAD_XSTATS_UNSPEC = 0x0
|
||||
IFLA_OFFLOAD_XSTATS_CPU_HIT = 0x1
|
||||
IFLA_OFFLOAD_XSTATS_HW_S_INFO = 0x2
|
||||
IFLA_OFFLOAD_XSTATS_L3_STATS = 0x3
|
||||
IFLA_OFFLOAD_XSTATS_HW_S_INFO_UNSPEC = 0x0
|
||||
IFLA_OFFLOAD_XSTATS_HW_S_INFO_REQUEST = 0x1
|
||||
IFLA_OFFLOAD_XSTATS_HW_S_INFO_USED = 0x2
|
||||
IFLA_XDP_UNSPEC = 0x0
|
||||
IFLA_XDP_FD = 0x1
|
||||
IFLA_XDP_ATTACHED = 0x2
|
||||
@@ -1881,6 +1940,11 @@ const (
|
||||
IFLA_RMNET_UNSPEC = 0x0
|
||||
IFLA_RMNET_MUX_ID = 0x1
|
||||
IFLA_RMNET_FLAGS = 0x2
|
||||
IFLA_MCTP_UNSPEC = 0x0
|
||||
IFLA_MCTP_NET = 0x1
|
||||
IFLA_DSA_UNSPEC = 0x0
|
||||
IFLA_DSA_CONDUIT = 0x1
|
||||
IFLA_DSA_MASTER = 0x1
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -3399,7 +3463,7 @@ const (
|
||||
DEVLINK_PORT_FN_ATTR_STATE = 0x2
|
||||
DEVLINK_PORT_FN_ATTR_OPSTATE = 0x3
|
||||
DEVLINK_PORT_FN_ATTR_CAPS = 0x4
|
||||
DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x4
|
||||
DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x5
|
||||
)
|
||||
|
||||
type FsverityDigest struct {
|
||||
@@ -4183,7 +4247,8 @@ const (
|
||||
)
|
||||
|
||||
type LandlockRulesetAttr struct {
|
||||
Access_fs uint64
|
||||
Access_fs uint64
|
||||
Access_net uint64
|
||||
}
|
||||
|
||||
type LandlockPathBeneathAttr struct {
|
||||
@@ -5134,7 +5199,7 @@ const (
|
||||
NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf
|
||||
NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe
|
||||
NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf
|
||||
NL80211_FREQUENCY_ATTR_MAX = 0x1b
|
||||
NL80211_FREQUENCY_ATTR_MAX = 0x1c
|
||||
NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6
|
||||
NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11
|
||||
NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc
|
||||
@@ -5547,7 +5612,7 @@ const (
|
||||
NL80211_REGDOM_TYPE_CUSTOM_WORLD = 0x2
|
||||
NL80211_REGDOM_TYPE_INTERSECTION = 0x3
|
||||
NL80211_REGDOM_TYPE_WORLD = 0x1
|
||||
NL80211_REG_RULE_ATTR_MAX = 0x7
|
||||
NL80211_REG_RULE_ATTR_MAX = 0x8
|
||||
NL80211_REKEY_DATA_AKM = 0x4
|
||||
NL80211_REKEY_DATA_KCK = 0x2
|
||||
NL80211_REKEY_DATA_KEK = 0x1
|
||||
|
||||
17
vendor/golang.org/x/sys/windows/env_windows.go
generated
vendored
17
vendor/golang.org/x/sys/windows/env_windows.go
generated
vendored
@@ -37,14 +37,17 @@ func (token Token) Environ(inheritExisting bool) (env []string, err error) {
|
||||
return nil, err
|
||||
}
|
||||
defer DestroyEnvironmentBlock(block)
|
||||
blockp := unsafe.Pointer(block)
|
||||
for {
|
||||
entry := UTF16PtrToString((*uint16)(blockp))
|
||||
if len(entry) == 0 {
|
||||
break
|
||||
size := unsafe.Sizeof(*block)
|
||||
for *block != 0 {
|
||||
// find NUL terminator
|
||||
end := unsafe.Pointer(block)
|
||||
for *(*uint16)(end) != 0 {
|
||||
end = unsafe.Add(end, size)
|
||||
}
|
||||
env = append(env, entry)
|
||||
blockp = unsafe.Add(blockp, 2*(len(entry)+1))
|
||||
|
||||
entry := unsafe.Slice(block, (uintptr(end)-uintptr(unsafe.Pointer(block)))/size)
|
||||
env = append(env, UTF16ToString(entry))
|
||||
block = (*uint16)(unsafe.Add(end, size))
|
||||
}
|
||||
return env, nil
|
||||
}
|
||||
|
||||
85
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
85
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
@@ -125,8 +125,7 @@ func UTF16PtrToString(p *uint16) string {
|
||||
for ptr := unsafe.Pointer(p); *(*uint16)(ptr) != 0; n++ {
|
||||
ptr = unsafe.Pointer(uintptr(ptr) + unsafe.Sizeof(*p))
|
||||
}
|
||||
|
||||
return string(utf16.Decode(unsafe.Slice(p, n)))
|
||||
return UTF16ToString(unsafe.Slice(p, n))
|
||||
}
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
@@ -166,6 +165,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||
//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW
|
||||
//sys CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) [failretval==InvalidHandle] = CreateNamedPipeW
|
||||
//sys ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error)
|
||||
//sys DisconnectNamedPipe(pipe Handle) (err error)
|
||||
//sys GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error)
|
||||
//sys GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW
|
||||
//sys SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) = SetNamedPipeHandleState
|
||||
@@ -349,8 +349,19 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||
//sys SetProcessPriorityBoost(process Handle, disable bool) (err error) = kernel32.SetProcessPriorityBoost
|
||||
//sys GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32)
|
||||
//sys SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error)
|
||||
//sys ClearCommBreak(handle Handle) (err error)
|
||||
//sys ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error)
|
||||
//sys EscapeCommFunction(handle Handle, dwFunc uint32) (err error)
|
||||
//sys GetCommState(handle Handle, lpDCB *DCB) (err error)
|
||||
//sys GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error)
|
||||
//sys GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error)
|
||||
//sys PurgeComm(handle Handle, dwFlags uint32) (err error)
|
||||
//sys SetCommBreak(handle Handle) (err error)
|
||||
//sys SetCommMask(handle Handle, dwEvtMask uint32) (err error)
|
||||
//sys SetCommState(handle Handle, lpDCB *DCB) (err error)
|
||||
//sys SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error)
|
||||
//sys SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error)
|
||||
//sys WaitCommEvent(handle Handle, lpEvtMask *uint32, lpOverlapped *Overlapped) (err error)
|
||||
//sys GetActiveProcessorCount(groupNumber uint16) (ret uint32)
|
||||
//sys GetMaximumProcessorCount(groupNumber uint16) (ret uint32)
|
||||
//sys EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) = user32.EnumWindows
|
||||
@@ -1835,3 +1846,73 @@ func ResizePseudoConsole(pconsole Handle, size Coord) error {
|
||||
// accept arguments that can be casted to uintptr, and Coord can't.
|
||||
return resizePseudoConsole(pconsole, *((*uint32)(unsafe.Pointer(&size))))
|
||||
}
|
||||
|
||||
// DCB constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-dcb.
|
||||
const (
|
||||
CBR_110 = 110
|
||||
CBR_300 = 300
|
||||
CBR_600 = 600
|
||||
CBR_1200 = 1200
|
||||
CBR_2400 = 2400
|
||||
CBR_4800 = 4800
|
||||
CBR_9600 = 9600
|
||||
CBR_14400 = 14400
|
||||
CBR_19200 = 19200
|
||||
CBR_38400 = 38400
|
||||
CBR_57600 = 57600
|
||||
CBR_115200 = 115200
|
||||
CBR_128000 = 128000
|
||||
CBR_256000 = 256000
|
||||
|
||||
DTR_CONTROL_DISABLE = 0x00000000
|
||||
DTR_CONTROL_ENABLE = 0x00000010
|
||||
DTR_CONTROL_HANDSHAKE = 0x00000020
|
||||
|
||||
RTS_CONTROL_DISABLE = 0x00000000
|
||||
RTS_CONTROL_ENABLE = 0x00001000
|
||||
RTS_CONTROL_HANDSHAKE = 0x00002000
|
||||
RTS_CONTROL_TOGGLE = 0x00003000
|
||||
|
||||
NOPARITY = 0
|
||||
ODDPARITY = 1
|
||||
EVENPARITY = 2
|
||||
MARKPARITY = 3
|
||||
SPACEPARITY = 4
|
||||
|
||||
ONESTOPBIT = 0
|
||||
ONE5STOPBITS = 1
|
||||
TWOSTOPBITS = 2
|
||||
)
|
||||
|
||||
// EscapeCommFunction constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-escapecommfunction.
|
||||
const (
|
||||
SETXOFF = 1
|
||||
SETXON = 2
|
||||
SETRTS = 3
|
||||
CLRRTS = 4
|
||||
SETDTR = 5
|
||||
CLRDTR = 6
|
||||
SETBREAK = 8
|
||||
CLRBREAK = 9
|
||||
)
|
||||
|
||||
// PurgeComm constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-purgecomm.
|
||||
const (
|
||||
PURGE_TXABORT = 0x0001
|
||||
PURGE_RXABORT = 0x0002
|
||||
PURGE_TXCLEAR = 0x0004
|
||||
PURGE_RXCLEAR = 0x0008
|
||||
)
|
||||
|
||||
// SetCommMask constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setcommmask.
|
||||
const (
|
||||
EV_RXCHAR = 0x0001
|
||||
EV_RXFLAG = 0x0002
|
||||
EV_TXEMPTY = 0x0004
|
||||
EV_CTS = 0x0008
|
||||
EV_DSR = 0x0010
|
||||
EV_RLSD = 0x0020
|
||||
EV_BREAK = 0x0040
|
||||
EV_ERR = 0x0080
|
||||
EV_RING = 0x0100
|
||||
)
|
||||
|
||||
24
vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
24
vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
@@ -3380,3 +3380,27 @@ type BLOB struct {
|
||||
Size uint32
|
||||
BlobData *byte
|
||||
}
|
||||
|
||||
type ComStat struct {
|
||||
Flags uint32
|
||||
CBInQue uint32
|
||||
CBOutQue uint32
|
||||
}
|
||||
|
||||
type DCB struct {
|
||||
DCBlength uint32
|
||||
BaudRate uint32
|
||||
Flags uint32
|
||||
wReserved uint16
|
||||
XonLim uint16
|
||||
XoffLim uint16
|
||||
ByteSize uint8
|
||||
Parity uint8
|
||||
StopBits uint8
|
||||
XonChar byte
|
||||
XoffChar byte
|
||||
ErrorChar byte
|
||||
EofChar byte
|
||||
EvtChar byte
|
||||
wReserved1 uint16
|
||||
}
|
||||
|
||||
126
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
126
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
@@ -188,6 +188,8 @@ var (
|
||||
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
|
||||
procCancelIo = modkernel32.NewProc("CancelIo")
|
||||
procCancelIoEx = modkernel32.NewProc("CancelIoEx")
|
||||
procClearCommBreak = modkernel32.NewProc("ClearCommBreak")
|
||||
procClearCommError = modkernel32.NewProc("ClearCommError")
|
||||
procCloseHandle = modkernel32.NewProc("CloseHandle")
|
||||
procClosePseudoConsole = modkernel32.NewProc("ClosePseudoConsole")
|
||||
procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe")
|
||||
@@ -212,7 +214,9 @@ var (
|
||||
procDeleteProcThreadAttributeList = modkernel32.NewProc("DeleteProcThreadAttributeList")
|
||||
procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW")
|
||||
procDeviceIoControl = modkernel32.NewProc("DeviceIoControl")
|
||||
procDisconnectNamedPipe = modkernel32.NewProc("DisconnectNamedPipe")
|
||||
procDuplicateHandle = modkernel32.NewProc("DuplicateHandle")
|
||||
procEscapeCommFunction = modkernel32.NewProc("EscapeCommFunction")
|
||||
procExitProcess = modkernel32.NewProc("ExitProcess")
|
||||
procExpandEnvironmentStringsW = modkernel32.NewProc("ExpandEnvironmentStringsW")
|
||||
procFindClose = modkernel32.NewProc("FindClose")
|
||||
@@ -236,6 +240,8 @@ var (
|
||||
procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent")
|
||||
procGetACP = modkernel32.NewProc("GetACP")
|
||||
procGetActiveProcessorCount = modkernel32.NewProc("GetActiveProcessorCount")
|
||||
procGetCommModemStatus = modkernel32.NewProc("GetCommModemStatus")
|
||||
procGetCommState = modkernel32.NewProc("GetCommState")
|
||||
procGetCommTimeouts = modkernel32.NewProc("GetCommTimeouts")
|
||||
procGetCommandLineW = modkernel32.NewProc("GetCommandLineW")
|
||||
procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW")
|
||||
@@ -322,6 +328,7 @@ var (
|
||||
procProcess32NextW = modkernel32.NewProc("Process32NextW")
|
||||
procProcessIdToSessionId = modkernel32.NewProc("ProcessIdToSessionId")
|
||||
procPulseEvent = modkernel32.NewProc("PulseEvent")
|
||||
procPurgeComm = modkernel32.NewProc("PurgeComm")
|
||||
procQueryDosDeviceW = modkernel32.NewProc("QueryDosDeviceW")
|
||||
procQueryFullProcessImageNameW = modkernel32.NewProc("QueryFullProcessImageNameW")
|
||||
procQueryInformationJobObject = modkernel32.NewProc("QueryInformationJobObject")
|
||||
@@ -335,6 +342,9 @@ var (
|
||||
procResetEvent = modkernel32.NewProc("ResetEvent")
|
||||
procResizePseudoConsole = modkernel32.NewProc("ResizePseudoConsole")
|
||||
procResumeThread = modkernel32.NewProc("ResumeThread")
|
||||
procSetCommBreak = modkernel32.NewProc("SetCommBreak")
|
||||
procSetCommMask = modkernel32.NewProc("SetCommMask")
|
||||
procSetCommState = modkernel32.NewProc("SetCommState")
|
||||
procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts")
|
||||
procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition")
|
||||
procSetConsoleMode = modkernel32.NewProc("SetConsoleMode")
|
||||
@@ -342,7 +352,6 @@ var (
|
||||
procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories")
|
||||
procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW")
|
||||
procSetEndOfFile = modkernel32.NewProc("SetEndOfFile")
|
||||
procSetFileValidData = modkernel32.NewProc("SetFileValidData")
|
||||
procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW")
|
||||
procSetErrorMode = modkernel32.NewProc("SetErrorMode")
|
||||
procSetEvent = modkernel32.NewProc("SetEvent")
|
||||
@@ -351,6 +360,7 @@ var (
|
||||
procSetFileInformationByHandle = modkernel32.NewProc("SetFileInformationByHandle")
|
||||
procSetFilePointer = modkernel32.NewProc("SetFilePointer")
|
||||
procSetFileTime = modkernel32.NewProc("SetFileTime")
|
||||
procSetFileValidData = modkernel32.NewProc("SetFileValidData")
|
||||
procSetHandleInformation = modkernel32.NewProc("SetHandleInformation")
|
||||
procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject")
|
||||
procSetNamedPipeHandleState = modkernel32.NewProc("SetNamedPipeHandleState")
|
||||
@@ -361,6 +371,7 @@ var (
|
||||
procSetStdHandle = modkernel32.NewProc("SetStdHandle")
|
||||
procSetVolumeLabelW = modkernel32.NewProc("SetVolumeLabelW")
|
||||
procSetVolumeMountPointW = modkernel32.NewProc("SetVolumeMountPointW")
|
||||
procSetupComm = modkernel32.NewProc("SetupComm")
|
||||
procSizeofResource = modkernel32.NewProc("SizeofResource")
|
||||
procSleepEx = modkernel32.NewProc("SleepEx")
|
||||
procTerminateJobObject = modkernel32.NewProc("TerminateJobObject")
|
||||
@@ -379,6 +390,7 @@ var (
|
||||
procVirtualQueryEx = modkernel32.NewProc("VirtualQueryEx")
|
||||
procVirtualUnlock = modkernel32.NewProc("VirtualUnlock")
|
||||
procWTSGetActiveConsoleSessionId = modkernel32.NewProc("WTSGetActiveConsoleSessionId")
|
||||
procWaitCommEvent = modkernel32.NewProc("WaitCommEvent")
|
||||
procWaitForMultipleObjects = modkernel32.NewProc("WaitForMultipleObjects")
|
||||
procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject")
|
||||
procWriteConsoleW = modkernel32.NewProc("WriteConsoleW")
|
||||
@@ -1641,6 +1653,22 @@ func CancelIoEx(s Handle, o *Overlapped) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func ClearCommBreak(handle Handle) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procClearCommBreak.Addr(), 1, uintptr(handle), 0, 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procClearCommError.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpErrors)), uintptr(unsafe.Pointer(lpStat)))
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func CloseHandle(handle Handle) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0)
|
||||
if r1 == 0 {
|
||||
@@ -1845,6 +1873,14 @@ func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBuff
|
||||
return
|
||||
}
|
||||
|
||||
func DisconnectNamedPipe(pipe Handle) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procDisconnectNamedPipe.Addr(), 1, uintptr(pipe), 0, 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) {
|
||||
var _p0 uint32
|
||||
if bInheritHandle {
|
||||
@@ -1857,6 +1893,14 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP
|
||||
return
|
||||
}
|
||||
|
||||
func EscapeCommFunction(handle Handle, dwFunc uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procEscapeCommFunction.Addr(), 2, uintptr(handle), uintptr(dwFunc), 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ExitProcess(exitcode uint32) {
|
||||
syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0)
|
||||
return
|
||||
@@ -2058,6 +2102,22 @@ func GetActiveProcessorCount(groupNumber uint16) (ret uint32) {
|
||||
return
|
||||
}
|
||||
|
||||
func GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procGetCommModemStatus.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpModemStat)), 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetCommState(handle Handle, lpDCB *DCB) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procGetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procGetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0)
|
||||
if r1 == 0 {
|
||||
@@ -2810,6 +2870,14 @@ func PulseEvent(event Handle) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func PurgeComm(handle Handle, dwFlags uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procPurgeComm.Addr(), 2, uintptr(handle), uintptr(dwFlags), 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) {
|
||||
r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max))
|
||||
n = uint32(r0)
|
||||
@@ -2924,6 +2992,30 @@ func ResumeThread(thread Handle) (ret uint32, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func SetCommBreak(handle Handle) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procSetCommBreak.Addr(), 1, uintptr(handle), 0, 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func SetCommMask(handle Handle, dwEvtMask uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procSetCommMask.Addr(), 2, uintptr(handle), uintptr(dwEvtMask), 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func SetCommState(handle Handle, lpDCB *DCB) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procSetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procSetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0)
|
||||
if r1 == 0 {
|
||||
@@ -2989,14 +3081,6 @@ func SetEndOfFile(handle Handle) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func SetFileValidData(handle Handle, validDataLength int64) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procSetFileValidData.Addr(), 2, uintptr(handle), uintptr(validDataLength), 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0)
|
||||
if r1 == 0 {
|
||||
@@ -3060,6 +3144,14 @@ func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim
|
||||
return
|
||||
}
|
||||
|
||||
func SetFileValidData(handle Handle, validDataLength int64) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procSetFileValidData.Addr(), 2, uintptr(handle), uintptr(validDataLength), 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags))
|
||||
if r1 == 0 {
|
||||
@@ -3145,6 +3237,14 @@ func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err erro
|
||||
return
|
||||
}
|
||||
|
||||
func SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procSetupComm.Addr(), 3, uintptr(handle), uintptr(dwInQueue), uintptr(dwOutQueue))
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func SizeofResource(module Handle, resInfo Handle) (size uint32, err error) {
|
||||
r0, _, e1 := syscall.Syscall(procSizeofResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0)
|
||||
size = uint32(r0)
|
||||
@@ -3291,6 +3391,14 @@ func WTSGetActiveConsoleSessionId() (sessionID uint32) {
|
||||
return
|
||||
}
|
||||
|
||||
func WaitCommEvent(handle Handle, lpEvtMask *uint32, lpOverlapped *Overlapped) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procWaitCommEvent.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpEvtMask)), uintptr(unsafe.Pointer(lpOverlapped)))
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) {
|
||||
var _p0 uint32
|
||||
if waitAll {
|
||||
|
||||
12
vendor/modules.txt
vendored
12
vendor/modules.txt
vendored
@@ -14,14 +14,14 @@ github.com/adrg/xdg/internal/pathutil
|
||||
# github.com/distatus/battery v0.11.0
|
||||
## explicit; go 1.18
|
||||
github.com/distatus/battery
|
||||
# github.com/go-co-op/gocron/v2 v2.1.2
|
||||
# github.com/go-co-op/gocron/v2 v2.2.9
|
||||
## explicit; go 1.20
|
||||
github.com/go-co-op/gocron/v2
|
||||
# github.com/go-ole/go-ole v1.3.0
|
||||
## explicit; go 1.12
|
||||
github.com/go-ole/go-ole
|
||||
github.com/go-ole/go-ole/oleutil
|
||||
# github.com/google/uuid v1.5.0
|
||||
# github.com/google/uuid v1.6.0
|
||||
## explicit
|
||||
github.com/google/uuid
|
||||
# github.com/hjson/hjson-go v3.3.0+incompatible
|
||||
@@ -30,7 +30,7 @@ github.com/hjson/hjson-go
|
||||
# github.com/jonboulle/clockwork v0.4.0
|
||||
## explicit; go 1.15
|
||||
github.com/jonboulle/clockwork
|
||||
# github.com/mafik/pulseaudio v0.0.0-20200511091429-8449222912dd
|
||||
# github.com/mafik/pulseaudio v0.0.0-20240327130323-384e01075e6e
|
||||
## explicit
|
||||
github.com/mafik/pulseaudio
|
||||
# github.com/robfig/cron/v3 v3.0.1
|
||||
@@ -41,18 +41,18 @@ github.com/robfig/cron/v3
|
||||
github.com/shirou/gopsutil/internal/common
|
||||
github.com/shirou/gopsutil/load
|
||||
github.com/shirou/gopsutil/mem
|
||||
# github.com/yusufpapurcu/wmi v1.2.3
|
||||
# github.com/yusufpapurcu/wmi v1.2.4
|
||||
## explicit; go 1.16
|
||||
github.com/yusufpapurcu/wmi
|
||||
# go.i3wm.org/i3 v0.0.0-20190720062127-36e6ec85cc5a
|
||||
## explicit
|
||||
go.i3wm.org/i3
|
||||
# golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc
|
||||
# golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
|
||||
## explicit; go 1.20
|
||||
golang.org/x/exp/constraints
|
||||
golang.org/x/exp/maps
|
||||
golang.org/x/exp/slices
|
||||
# golang.org/x/sys v0.16.0
|
||||
# golang.org/x/sys v0.19.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/sys/unix
|
||||
golang.org/x/sys/windows
|
||||
|
||||
Reference in New Issue
Block a user