diff --git a/theme/themeconfig.go b/theme/themeconfig.go index d09ce0a..ca0a873 100644 --- a/theme/themeconfig.go +++ b/theme/themeconfig.go @@ -23,6 +23,7 @@ const ( ThemeAdapterPairable ThemeContext = "AdapterPairable" ThemeDevice ThemeContext = "Device" ThemeDeviceType ThemeContext = "DeviceType" + ThemeDeviceAlias ThemeContext = "DeviceAlias" ThemeDeviceConnected ThemeContext = "DeviceConnected" ThemeDeviceDiscovered ThemeContext = "DeviceDiscovered" ThemeDeviceProperty ThemeContext = "DeviceProperty" @@ -52,6 +53,7 @@ var ThemeConfig = map[ThemeContext]string{ ThemeDevice: "white", ThemeDeviceType: "white", + ThemeDeviceAlias: "white", ThemeDeviceConnected: "white", ThemeDeviceDiscovered: "white", ThemeDeviceProperty: "grey", diff --git a/ui/device.go b/ui/device.go index 7dedea1..cd7bf4c 100644 --- a/ui/device.go +++ b/ui/device.go @@ -131,6 +131,7 @@ func getDeviceInfo() { props := [][]string{ {"Name", device.Name}, + {"Alias", device.Alias}, {"Address", device.Address}, {"Class", strconv.FormatUint(uint64(device.Class), 10)}, {"Adapter", filepath.Base(device.Adapter)}, @@ -245,11 +246,20 @@ func getDeviceFromSelection(lock bool) bluez.Device { func setDeviceTableInfo(row int, device bluez.Device) { var props string + data := []string{ + theme.ColorWrap(theme.ThemeDeviceType, device.Type), + } name := device.Name if name == "" { name = device.Address } - name += theme.ColorWrap(theme.ThemeDeviceType, " ("+device.Type+")") + if device.Alias != device.Name { + data = append( + []string{theme.ColorWrap(theme.ThemeDeviceAlias, device.Alias)}, + data..., + ) + } + name += " (" + strings.Join(data, ", ") + ")" nameColor := theme.ThemeDevice propColor := theme.ThemeDeviceProperty