Merge branch 'master' of http://git.lan/eleksir/i3status-go
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// Package main simple test for battery funtionality.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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.
|
||||
// Default background color. If not set value of #edeceb is used.
|
||||
"background" : "#000000",
|
||||
|
||||
// Can be omitted, then Liberation Mono will be used.
|
||||
@@ -834,36 +834,36 @@
|
||||
// ‘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
|
||||
// Text displayed on button, pango markup supported.
|
||||
"full_text" : "📂",
|
||||
// Internal name, can be any string, but unique for each app button
|
||||
// Internal name, can be any string, but unique for each app button.
|
||||
"name" : "thunar",
|
||||
// Command itself
|
||||
// Command itself.
|
||||
"cmd" : "thunar",
|
||||
// Array of command args, optional
|
||||
// Array of command args, optional.
|
||||
"args": [ "." ],
|
||||
// Regexp that match with Instance component of WM_CLASS(STRING) of xprop output
|
||||
// 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
|
||||
// Regexp that match with Class component of WM_CLASS(STRING) of xprop output.
|
||||
"class": "^Thunar$",
|
||||
// text color in html notation
|
||||
// Text color in html notation.
|
||||
"color": "#ffa500",
|
||||
// background color in html notation
|
||||
// background color in html notation.
|
||||
"background" : "#000000",
|
||||
// border color in html notation
|
||||
// If omitted set to default font defined for separator up here.
|
||||
// If omitted set to default font defined for app_buttons 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"
|
||||
// ‘smaller’ or ‘larger’. If omitted set to default font size defined for app_buttons up here.
|
||||
"font_size": "medium",
|
||||
// Border color in html notation.
|
||||
"border": "#666666",
|
||||
// border color if there is at least one window with given Instance and/or Class exist
|
||||
// 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.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Package main status string generator for i3bar.
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -8,6 +9,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
@@ -15,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
//go:embed default-config.json
|
||||
var DefaultConfig []byte
|
||||
var DefaultConfig []byte //nolint: godoclint, grouper, nolintlint
|
||||
|
||||
// Program entry point.
|
||||
func main() {
|
||||
@@ -43,14 +45,11 @@ func main() {
|
||||
Conf.Values.SoundVolume = "🔊:0%"
|
||||
|
||||
// TODO: Проставить дефолтные значения для глобальных переменных модулей.
|
||||
Conf.Values.BatteryString = 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,
|
||||
)
|
||||
Conf.Values.BatteryString = "<span color='" + Conf.Battery.Color +
|
||||
"' background='" + Conf.Battery.Background +
|
||||
"' font='" + Conf.Battery.SymbolFont +
|
||||
"' size='" + Conf.Battery.SymbolFontSize +
|
||||
"'>" + Conf.Battery.Symbol + "</span>"
|
||||
|
||||
Conf.Values.BatteryString += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' font='%s' size='%s'> ??%% •</span>",
|
||||
@@ -104,6 +103,7 @@ func main() {
|
||||
|
||||
// Kick signal handler
|
||||
go Conf.SigHandler()
|
||||
|
||||
signal.Notify(Conf.Channels.SigChan,
|
||||
syscall.SIGUSR1,
|
||||
syscall.SIGUSR2,
|
||||
@@ -229,42 +229,55 @@ func main() {
|
||||
}
|
||||
|
||||
if Conf.CPUTemp.Enabled {
|
||||
var b lib.I3BarOutBlock
|
||||
var (
|
||||
b lib.I3BarOutBlock
|
||||
sb strings.Builder
|
||||
)
|
||||
|
||||
b.Color = Conf.CPUTemp.Color
|
||||
b.Background = Conf.CPUTemp.Background
|
||||
|
||||
if Conf.CPUTemp.Separator.Left.Enabled {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<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,
|
||||
)
|
||||
sb.WriteString("<span color='")
|
||||
sb.WriteString(Conf.CPUTemp.Separator.Left.Color)
|
||||
sb.WriteString("' background='")
|
||||
sb.WriteString(Conf.CPUTemp.Separator.Left.Background)
|
||||
sb.WriteString("' font='")
|
||||
sb.WriteString(Conf.CPUTemp.Separator.Left.Font)
|
||||
sb.WriteString("' size='")
|
||||
sb.WriteString(Conf.CPUTemp.Separator.Left.FontSize)
|
||||
sb.WriteString("'>")
|
||||
sb.WriteString(Conf.CPUTemp.Separator.Left.Symbol)
|
||||
sb.WriteString("</span>")
|
||||
}
|
||||
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>CPU: %d°</span>",
|
||||
Conf.CPUTemp.Color,
|
||||
Conf.CPUTemp.Background,
|
||||
Conf.CPUTemp.Font,
|
||||
Conf.CPUTemp.FontSize,
|
||||
Conf.Values.CPUTemperature,
|
||||
)
|
||||
sb.WriteString("<span color='")
|
||||
sb.WriteString(Conf.CPUTemp.Color)
|
||||
sb.WriteString("' background='")
|
||||
sb.WriteString(Conf.CPUTemp.Background)
|
||||
sb.WriteString("' font='")
|
||||
sb.WriteString(Conf.CPUTemp.Font)
|
||||
sb.WriteString("' size='")
|
||||
sb.WriteString(Conf.CPUTemp.FontSize)
|
||||
sb.WriteString("'>CPU: ")
|
||||
sb.WriteString(strconv.FormatInt(Conf.Values.CPUTemperature, 10))
|
||||
sb.WriteString("°</span>")
|
||||
|
||||
if Conf.CPUTemp.Separator.Right.Enabled {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<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,
|
||||
)
|
||||
sb.WriteString("<span color='")
|
||||
sb.WriteString(Conf.CPUTemp.Separator.Right.Color)
|
||||
sb.WriteString("' background='")
|
||||
sb.WriteString(Conf.CPUTemp.Separator.Right.Background)
|
||||
sb.WriteString("' font='")
|
||||
sb.WriteString(Conf.CPUTemp.Separator.Right.Font)
|
||||
sb.WriteString("' size='")
|
||||
sb.WriteString(Conf.CPUTemp.Separator.Right.FontSize)
|
||||
sb.WriteString("'>")
|
||||
sb.WriteString(Conf.CPUTemp.Separator.Right.Symbol)
|
||||
sb.WriteString("</span>")
|
||||
}
|
||||
|
||||
b.FullText = sb.String()
|
||||
b.Markup = "pango"
|
||||
b.Separator = false
|
||||
|
||||
@@ -272,56 +285,66 @@ func main() {
|
||||
}
|
||||
|
||||
if Conf.Mem.Enabled {
|
||||
var b lib.I3BarOutBlock
|
||||
var (
|
||||
b lib.I3BarOutBlock
|
||||
sb strings.Builder
|
||||
)
|
||||
|
||||
b.Color = Conf.Mem.Color
|
||||
b.Background = Conf.Mem.Background
|
||||
|
||||
if Conf.Mem.Separator.Left.Enabled {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<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,
|
||||
)
|
||||
sb.WriteString("<span color='")
|
||||
sb.WriteString(Conf.Mem.Separator.Left.Color)
|
||||
sb.WriteString("' background='")
|
||||
sb.WriteString(Conf.Mem.Separator.Left.Background)
|
||||
sb.WriteString("' font='")
|
||||
sb.WriteString(Conf.Mem.Separator.Left.Font)
|
||||
sb.WriteString("' size='")
|
||||
sb.WriteString(Conf.Mem.Separator.Left.FontSize)
|
||||
sb.WriteString("'>")
|
||||
sb.WriteString(Conf.Mem.Separator.Left.Symbol)
|
||||
sb.WriteString("</span>")
|
||||
}
|
||||
|
||||
sb.WriteString("<span color='")
|
||||
sb.WriteString(Conf.Mem.Color)
|
||||
sb.WriteString("' background='")
|
||||
sb.WriteString(Conf.Mem.Background)
|
||||
sb.WriteString("' font='")
|
||||
sb.WriteString(Conf.Mem.Font)
|
||||
sb.WriteString("' size='")
|
||||
sb.WriteString(Conf.Mem.FontSize)
|
||||
sb.WriteString("'>M:")
|
||||
sb.WriteString(strconv.FormatUint(Conf.Values.Memory.Usedpct, 10))
|
||||
sb.WriteString("% SHM:")
|
||||
sb.WriteString(strconv.FormatUint(Conf.Values.Memory.Shared, 10))
|
||||
|
||||
if Conf.Mem.ShowSwap {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<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,
|
||||
Conf.Values.Memory.Usedpct,
|
||||
Conf.Values.Memory.Shared,
|
||||
Conf.Values.Memory.Swap,
|
||||
)
|
||||
sb.WriteString("% SW:")
|
||||
sb.WriteString(strconv.FormatUint(Conf.Values.Memory.Swap, 10))
|
||||
sb.WriteString("M")
|
||||
} else {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<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,
|
||||
Conf.Values.Memory.Usedpct,
|
||||
Conf.Values.Memory.Shared,
|
||||
)
|
||||
sb.WriteString("%")
|
||||
}
|
||||
|
||||
sb.WriteString("</span>")
|
||||
|
||||
if Conf.Mem.Separator.Right.Enabled {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<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,
|
||||
)
|
||||
sb.WriteString("<span color='")
|
||||
sb.WriteString(Conf.Mem.Separator.Right.Color)
|
||||
sb.WriteString("' background='")
|
||||
sb.WriteString(Conf.Mem.Separator.Right.Background)
|
||||
sb.WriteString("' font='")
|
||||
sb.WriteString(Conf.Mem.Separator.Right.Font)
|
||||
sb.WriteString("' size='")
|
||||
sb.WriteString(Conf.Mem.Separator.Right.FontSize)
|
||||
sb.WriteString("'>")
|
||||
sb.WriteString(Conf.Mem.Separator.Right.Symbol)
|
||||
sb.WriteString("</span>")
|
||||
}
|
||||
|
||||
b.FullText = sb.String()
|
||||
b.Markup = "pango"
|
||||
b.Separator = false
|
||||
|
||||
@@ -329,42 +352,55 @@ func main() {
|
||||
}
|
||||
|
||||
if Conf.LA.Enabled {
|
||||
var b lib.I3BarOutBlock
|
||||
var (
|
||||
b lib.I3BarOutBlock
|
||||
sb strings.Builder
|
||||
)
|
||||
|
||||
b.Color = Conf.LA.Color
|
||||
b.Background = Conf.LA.Background
|
||||
|
||||
if Conf.LA.Separator.Left.Enabled {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<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,
|
||||
)
|
||||
sb.WriteString("<span color='")
|
||||
sb.WriteString(Conf.LA.Separator.Left.Color)
|
||||
sb.WriteString("' background='")
|
||||
sb.WriteString(Conf.LA.Separator.Left.Background)
|
||||
sb.WriteString("' font='")
|
||||
sb.WriteString(Conf.LA.Separator.Left.Font)
|
||||
sb.WriteString("' size='")
|
||||
sb.WriteString(Conf.LA.Separator.Left.FontSize)
|
||||
sb.WriteString("'>")
|
||||
sb.WriteString(Conf.LA.Separator.Left.Symbol)
|
||||
sb.WriteString("</span>")
|
||||
}
|
||||
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>LA:%s</span>",
|
||||
Conf.LA.Color,
|
||||
Conf.LA.Background,
|
||||
Conf.LA.Font,
|
||||
Conf.LA.FontSize,
|
||||
Conf.Values.La,
|
||||
)
|
||||
sb.WriteString("<span color='")
|
||||
sb.WriteString(Conf.LA.Color)
|
||||
sb.WriteString("' background='")
|
||||
sb.WriteString(Conf.LA.Background)
|
||||
sb.WriteString("' font='")
|
||||
sb.WriteString(Conf.LA.Font)
|
||||
sb.WriteString("' size='")
|
||||
sb.WriteString(Conf.LA.FontSize)
|
||||
sb.WriteString("'>LA:")
|
||||
sb.WriteString(Conf.Values.La)
|
||||
sb.WriteString("</span>")
|
||||
|
||||
if Conf.LA.Separator.Right.Enabled {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<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,
|
||||
)
|
||||
sb.WriteString("<span color='")
|
||||
sb.WriteString(Conf.LA.Separator.Right.Color)
|
||||
sb.WriteString("' background='")
|
||||
sb.WriteString(Conf.LA.Separator.Right.Background)
|
||||
sb.WriteString("' font='")
|
||||
sb.WriteString(Conf.LA.Separator.Right.Font)
|
||||
sb.WriteString("' size='")
|
||||
sb.WriteString(Conf.LA.Separator.Right.FontSize)
|
||||
sb.WriteString("'>")
|
||||
sb.WriteString(Conf.LA.Separator.Right.Symbol)
|
||||
sb.WriteString("</span>")
|
||||
}
|
||||
|
||||
b.FullText = sb.String()
|
||||
b.Markup = "pango"
|
||||
b.Separator = false
|
||||
|
||||
@@ -576,43 +612,56 @@ func main() {
|
||||
}
|
||||
|
||||
if Conf.Clock.Enabled {
|
||||
var b lib.I3BarOutBlock
|
||||
var (
|
||||
b lib.I3BarOutBlock
|
||||
sb strings.Builder
|
||||
)
|
||||
|
||||
b.Name = `wallclock`
|
||||
b.Color = Conf.Clock.Color
|
||||
b.Background = Conf.Clock.Background
|
||||
|
||||
if Conf.Clock.Separator.Left.Enabled {
|
||||
b.FullText = fmt.Sprintf(
|
||||
"<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,
|
||||
)
|
||||
sb.WriteString("<span color='")
|
||||
sb.WriteString(Conf.Clock.Separator.Left.Color)
|
||||
sb.WriteString("' background='")
|
||||
sb.WriteString(Conf.Clock.Separator.Left.Background)
|
||||
sb.WriteString("' font='")
|
||||
sb.WriteString(Conf.Clock.Separator.Left.Font)
|
||||
sb.WriteString("' size='")
|
||||
sb.WriteString(Conf.Clock.Separator.Left.FontSize)
|
||||
sb.WriteString("'>")
|
||||
sb.WriteString(Conf.Clock.Separator.Left.Symbol)
|
||||
sb.WriteString("</span>")
|
||||
}
|
||||
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<span color='%s' background='%s' font='%s' size='%s'>%s</span>",
|
||||
Conf.Clock.Color,
|
||||
Conf.Clock.Background,
|
||||
Conf.Clock.Font,
|
||||
Conf.Clock.FontSize,
|
||||
Conf.Values.ClockTime,
|
||||
)
|
||||
sb.WriteString("<span color='")
|
||||
sb.WriteString(Conf.Clock.Color)
|
||||
sb.WriteString("' background='")
|
||||
sb.WriteString(Conf.Clock.Background)
|
||||
sb.WriteString("' font='")
|
||||
sb.WriteString(Conf.Clock.Font)
|
||||
sb.WriteString("' size='")
|
||||
sb.WriteString(Conf.Clock.FontSize)
|
||||
sb.WriteString("'>")
|
||||
sb.WriteString(Conf.Values.ClockTime)
|
||||
sb.WriteString("</span>")
|
||||
|
||||
if Conf.Clock.Separator.Right.Enabled {
|
||||
b.FullText += fmt.Sprintf(
|
||||
"<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,
|
||||
)
|
||||
sb.WriteString("<span color='")
|
||||
sb.WriteString(Conf.Clock.Separator.Right.Color)
|
||||
sb.WriteString("' background='")
|
||||
sb.WriteString(Conf.Clock.Separator.Right.Background)
|
||||
sb.WriteString("' font='")
|
||||
sb.WriteString(Conf.Clock.Separator.Right.Font)
|
||||
sb.WriteString("' size='")
|
||||
sb.WriteString(Conf.Clock.Separator.Right.FontSize)
|
||||
sb.WriteString("'>")
|
||||
sb.WriteString(Conf.Clock.Separator.Right.Symbol)
|
||||
sb.WriteString("</span>")
|
||||
}
|
||||
|
||||
b.FullText = sb.String()
|
||||
b.Markup = "pango"
|
||||
b.Separator = false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user