mirror of
https://github.com/nwg-piotr/nwg-drawer.git
synced 2024-10-26 14:53:57 +03:00
shortening long names fixed (Unicode)
This commit is contained in:
parent
675631949e
commit
fa6ce8ef49
BIN
bin/nwg-drawer
BIN
bin/nwg-drawer
Binary file not shown.
5
main.go
5
main.go
@ -83,8 +83,7 @@ var desktopEntries []desktopEntry
|
||||
|
||||
// UI elements
|
||||
var (
|
||||
resultWindow *gtk.ScrolledWindow
|
||||
//fileSearchResults map[string]string
|
||||
resultWindow *gtk.ScrolledWindow
|
||||
fileSearchResults []string
|
||||
searchEntry *gtk.SearchEntry
|
||||
phrase string
|
||||
@ -92,7 +91,6 @@ var (
|
||||
fileSearchResultFlowBox *gtk.FlowBox
|
||||
buttonsWrapper *gtk.Box
|
||||
buttonBox *gtk.EventBox
|
||||
confirmationBox *gtk.Box
|
||||
userDirsMap map[string]string
|
||||
appFlowBox *gtk.FlowBox
|
||||
appSearchResultWrapper *gtk.Box
|
||||
@ -334,7 +332,6 @@ func main() {
|
||||
fileSearchResultWrapper.SetSizeRequest(appFlowBox.GetAllocatedWidth(), 1)
|
||||
categoriesWrapper.SetSizeRequest(1, categoriesWrapper.GetAllocatedHeight()*2)
|
||||
|
||||
//searchEntry.GrabFocus()
|
||||
t := time.Now()
|
||||
println(fmt.Sprintf("UI created in %v ms. Thank you for your patience.", t.Sub(timeStart).Milliseconds()))
|
||||
gtk.Main()
|
||||
|
15
tools.go
15
tools.go
@ -667,18 +667,3 @@ func mapOutputs() (map[string]*gdk.Monitor, error) {
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func listMonitors() ([]gdk.Monitor, error) {
|
||||
var monitors []gdk.Monitor
|
||||
display, err := gdk.DisplayGetDefault()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
num := display.GetNMonitors()
|
||||
for i := 0; i < num; i++ {
|
||||
monitor, _ := display.GetMonitor(i)
|
||||
monitors = append(monitors, *monitor)
|
||||
}
|
||||
return monitors, nil
|
||||
}
|
||||
|
@ -48,7 +48,9 @@ func setUpPinnedFlowBox() *gtk.FlowBox {
|
||||
name = entry.Name
|
||||
}
|
||||
if len(name) > 20 {
|
||||
name = fmt.Sprintf("%s ...", name[:17])
|
||||
r := []rune(name)
|
||||
name = string(r[:20])
|
||||
name = fmt.Sprintf("%s…", name)
|
||||
}
|
||||
btn.SetLabel(name)
|
||||
|
||||
@ -223,7 +225,9 @@ func flowBoxButton(entry desktopEntry) *gtk.Button {
|
||||
button.SetImagePosition(gtk.POS_TOP)
|
||||
name := entry.NameLoc
|
||||
if len(name) > 20 {
|
||||
name = fmt.Sprintf("%s ...", name[:17])
|
||||
r := []rune(name)
|
||||
name = string(r[:20])
|
||||
name = fmt.Sprintf("%s…", name)
|
||||
}
|
||||
button.SetLabel(name)
|
||||
|
||||
@ -383,7 +387,7 @@ func setUpUserDirButton(iconName, displayName, entryName string, userDirsMap map
|
||||
button.SetImage(img)
|
||||
|
||||
if len(displayName) > *nameLimit {
|
||||
displayName = fmt.Sprintf("%s...", displayName[:*nameLimit-3])
|
||||
displayName = fmt.Sprintf("%s…", displayName[:*nameLimit-3])
|
||||
}
|
||||
button.SetLabel(displayName)
|
||||
|
||||
@ -409,7 +413,7 @@ func setUpUserFileSearchResultButton(fileName, filePath string) *gtk.Box {
|
||||
tooltipText := ""
|
||||
if len(fileName) > *nameLimit {
|
||||
tooltipText = fileName
|
||||
fileName = fmt.Sprintf("%s...", fileName[:*nameLimit-3])
|
||||
fileName = fmt.Sprintf("%s…", fileName[:*nameLimit-3])
|
||||
}
|
||||
button.SetLabel(fileName)
|
||||
if tooltipText != "" {
|
||||
|
Loading…
Reference in New Issue
Block a user