Skip to content

Commit

Permalink
And resolve goimports from updated versions
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Jan 18, 2024
1 parent 6ce4004 commit 9635da4
Show file tree
Hide file tree
Showing 33 changed files with 63 additions and 34 deletions.
1 change: 1 addition & 0 deletions cmd/fynedesk/main_other.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !linux && !darwin && !freebsd && !openbsd && !netbsd
// +build !linux,!darwin,!freebsd,!openbsd,!netbsd

package main
Expand Down
1 change: 1 addition & 0 deletions cmd/fynedesk/main_unix.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package main
Expand Down
1 change: 1 addition & 0 deletions cmd/fynedesk_runner/log_darwin.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build darwin
// +build darwin

package main
Expand Down
1 change: 1 addition & 0 deletions cmd/fynedesk_runner/log_unix.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !darwin && !windows
// +build !darwin,!windows

package main
Expand Down
1 change: 1 addition & 0 deletions cmd/fynedesk_runner/log_windows.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build windows
// +build windows

package main
Expand Down
34 changes: 17 additions & 17 deletions internal/icon/fdo.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (
"Office", "Science", "Settings", "System", "Utility"}
)

//fdoApplicationData is a structure that contains information about .desktop files
// fdoApplicationData is a structure that contains information about .desktop files
type fdoApplicationData struct {
name string // Application name
iconName string // Icon name
Expand All @@ -38,12 +38,12 @@ type fdoApplicationData struct {
iconCache fyne.Resource
}

//Name returns the name associated with an fdo app
// Name returns the name associated with an fdo app
func (data *fdoApplicationData) Name() string {
return data.name
}

//Categories returns a list of the categories this icon has configured
// Categories returns a list of the categories this icon has configured
func (data *fdoApplicationData) Categories() []string {
return data.categories
}
Expand All @@ -52,12 +52,12 @@ func (data *fdoApplicationData) Hidden() bool {
return data.hide
}

//IconName returns the name of the icon that an fdo app wishes to use
// IconName returns the name of the icon that an fdo app wishes to use
func (data *fdoApplicationData) IconName() string {
return data.iconName
}

//IconPath returns the path of the icon that an fdo app wishes to use
// IconPath returns the path of the icon that an fdo app wishes to use
func (data *fdoApplicationData) Icon(theme string, size int) fyne.Resource {
if data.iconCache != nil {
return data.iconCache
Expand All @@ -75,7 +75,7 @@ func (data *fdoApplicationData) Icon(theme string, size int) fyne.Resource {
return data.iconCache
}

//extractArgs sanitises argument parameters from an Exec configuration
// extractArgs sanitises argument parameters from an Exec configuration
func extractArgs(args []string) []string {
var ret []string
for _, arg := range args {
Expand All @@ -88,7 +88,7 @@ func extractArgs(args []string) []string {
return ret
}

//Run executes the command for this fdo app
// Run executes the command for this fdo app
func (data *fdoApplicationData) Run(env []string) error {
vars := os.Environ()
vars = append(vars, env...)
Expand Down Expand Up @@ -148,7 +148,7 @@ func loadIcon(path string) fyne.Resource {
return fyne.NewStaticResource(filepath.Base(path), data)
}

//fdoLookupXdgDataDirs returns a string slice of all XDG_DATA_DIRS
// fdoLookupXdgDataDirs returns a string slice of all XDG_DATA_DIRS
func fdoLookupXdgDataDirs() []string {
dataLocation := os.Getenv("XDG_DATA_DIRS")
locationLookup := strings.Split(dataLocation, ":")
Expand Down Expand Up @@ -190,7 +190,7 @@ func fdoForEachApplicationFile(f func(data fynedesk.AppData) bool) {
}
}

//lookupApplicationByMetadata looks up an application by comparing the requested name to the contents of .desktop files
// lookupApplicationByMetadata looks up an application by comparing the requested name to the contents of .desktop files
func (f *fdoIconProvider) lookupApplicationByMetadata(appName string) fynedesk.AppData {
var returnIcon fynedesk.AppData
f.cache.forEachCachedApplication(func(_ string, icon fynedesk.AppData) bool {
Expand All @@ -203,7 +203,7 @@ func (f *fdoIconProvider) lookupApplicationByMetadata(appName string) fynedesk.A
return returnIcon
}

//lookupApplication looks up an application by name and returns an fdoApplicationData struct
// lookupApplication looks up an application by name and returns an fdoApplicationData struct
func (f *fdoIconProvider) lookupApplication(appName string) fynedesk.AppData {
if appName == "" {
return nil
Expand Down Expand Up @@ -400,7 +400,7 @@ func lookupIconPathInTheme(iconSize string, dir string, parentDir string, iconNa
return ""
}

//fdoLookupIconPath will take the name of an icon and find a matching image file
// fdoLookupIconPath will take the name of an icon and find a matching image file
func fdoLookupIconPath(theme string, size int, iconName string) string {
locationLookup := fdoLookupXdgDataDirs()
iconTheme := theme
Expand Down Expand Up @@ -454,7 +454,7 @@ func fdoLookupAvailableThemes() []string {
return themes
}

//newFdoIconData creates and returns a struct that contains needed fields from a .desktop file
// newFdoIconData creates and returns a struct that contains needed fields from a .desktop file
func newFdoIconData(desktopPath string) fynedesk.AppData {
file, err := os.Open(desktopPath)
if err != nil {
Expand Down Expand Up @@ -507,7 +507,7 @@ type fdoIconProvider struct {
cache *appCache
}

//AvailableApps returns all of the available applications in a AppData slice
// AvailableApps returns all of the available applications in a AppData slice
func (f *fdoIconProvider) AvailableApps() []fynedesk.AppData {
var icons []fynedesk.AppData
fdoForEachApplicationFile(func(icon fynedesk.AppData) bool {
Expand All @@ -520,17 +520,17 @@ func (f *fdoIconProvider) AvailableApps() []fynedesk.AppData {
return icons
}

//AvailableThemes returns all available icon themes in a string slice
// AvailableThemes returns all available icon themes in a string slice
func (f *fdoIconProvider) AvailableThemes() []string {
return fdoLookupAvailableThemes()
}

//FindAppFromName matches an icon name to a location and returns an AppData interface
// FindAppFromName matches an icon name to a location and returns an AppData interface
func (f *fdoIconProvider) FindAppFromName(appName string) fynedesk.AppData {
return f.lookupApplication(appName)
}

//FindAppsMatching returns a list of icons that match a partial name of an app and returns an AppData slice
// FindAppsMatching returns a list of icons that match a partial name of an app and returns an AppData slice
func (f *fdoIconProvider) FindAppsMatching(appName string) []fynedesk.AppData {
var icons []fynedesk.AppData
f.cache.forEachCachedApplication(func(_ string, icon fynedesk.AppData) bool {
Expand All @@ -548,7 +548,7 @@ func (f *fdoIconProvider) FindAppsMatching(appName string) []fynedesk.AppData {
return icons
}

//FindAppFromWinInfo matches window information to an icon location and returns an AppData interface
// FindAppFromWinInfo matches window information to an icon location and returns an AppData interface
func (f *fdoIconProvider) FindAppFromWinInfo(win fynedesk.Window) fynedesk.AppData {
app := f.lookupApplication(win.Properties().Command())
if app != nil {
Expand Down
24 changes: 12 additions & 12 deletions internal/icon/fdo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ func setTestEnv(t *testing.T) {
}
}

//applications/app1.desktop and icons/default_theme/apps/32x32/app1.png
// applications/app1.desktop and icons/default_theme/apps/32x32/app1.png
func TestFdoLookupDefaultTheme(t *testing.T) {
setTestEnv(t)
data := NewFDOIconProvider().(*fdoIconProvider).lookupApplication("app1")
assert.Equal(t, true, exists(data))
}

//applications/com.fyne.app.desktop and icons/default_theme/apps/scalable/app2.svg
// applications/com.fyne.app.desktop and icons/default_theme/apps/scalable/app2.svg
func TestFdoFileNameMisMatchAndScalable(t *testing.T) {
setTestEnv(t)
data := NewFDOIconProvider().(*fdoIconProvider).lookupApplication("app2")
assert.Equal(t, true, exists(data))
}

//check the category from app1
// check the category from app1
func TestFdoIconCategory(t *testing.T) {
setTestEnv(t)
data := NewFDOIconProvider().(*fdoIconProvider).lookupApplication("app1")
Expand All @@ -61,7 +61,7 @@ func TestFdoIconCategory(t *testing.T) {
assert.Equal(t, "Utility", data.(*fdoApplicationData).mainCategory())
}

//applications/app3.desktop and applications/app3.png
// applications/app3.desktop and applications/app3.png
func TestFdoIconNameIsPath(t *testing.T) {
setTestEnv(t)
dataLocation := os.Getenv("XDG_DATA_DIRS")
Expand All @@ -75,56 +75,56 @@ func TestFdoIconNameIsPath(t *testing.T) {
assert.Equal(t, true, exists(data))
}

//check NoDisplay from app4
// check NoDisplay from app4
func TestFdoIconHide(t *testing.T) {
setTestEnv(t)
data := NewFDOIconProvider().(*fdoIconProvider).lookupApplication("app4")
assert.Equal(t, true, data.Hidden())
}

//applications/app4.desktop and pixmaps/app4.png
// applications/app4.desktop and pixmaps/app4.png
func TestFdoIconInPixmaps(t *testing.T) {
setTestEnv(t)
data := NewFDOIconProvider().(*fdoIconProvider).lookupApplication("app4")
assert.Equal(t, true, exists(data))
}

//applications/app5.desktop and icons/hicolor/32x32/apps/app5.png
// applications/app5.desktop and icons/hicolor/32x32/apps/app5.png
func TestFdoIconHicolorFallback(t *testing.T) {
setTestEnv(t)
data := NewFDOIconProvider().(*fdoIconProvider).lookupApplication("app5")
assert.Equal(t, true, exists(data))
}

//applications/app6.desktop and icons/hicolor/scalable/apps/app6.svg
// applications/app6.desktop and icons/hicolor/scalable/apps/app6.svg
func TestFdoIconHicolorFallbackScalable(t *testing.T) {
setTestEnv(t)
data := NewFDOIconProvider().(*fdoIconProvider).lookupApplication("app6")
assert.Equal(t, true, exists(data))
}

//applications/app7.desktop and icons/default_theme/apps/16x16/app7.png
// applications/app7.desktop and icons/default_theme/apps/16x16/app7.png
func TestFdoLookupDefaultThemeDifferentSize(t *testing.T) {
setTestEnv(t)
data := NewFDOIconProvider().(*fdoIconProvider).lookupApplication("app7")
assert.Equal(t, true, exists(data))
}

//applications/app8.desktop and icons/third_theme/apps/32/app8.png
// applications/app8.desktop and icons/third_theme/apps/32/app8.png
func TestFdoLookupAnyThemeFallback(t *testing.T) {
setTestEnv(t)
data := NewFDOIconProvider().(*fdoIconProvider).lookupApplication("app8")
assert.Equal(t, true, exists(data))
}

//applications/xterm.desktop and icons/third_theme/emblems/16x16/app9.png
// applications/xterm.desktop and icons/third_theme/emblems/16x16/app9.png
func TestFdoLookupIconNotInApps(t *testing.T) {
setTestEnv(t)
data := NewFDOIconProvider().(*fdoIconProvider).lookupApplication("xterm")
assert.Equal(t, true, exists(data))
}

//missing - not able to match
// missing - not able to match
func TestFdoLookupMissing(t *testing.T) {
setTestEnv(t)
provider := NewFDOIconProvider()
Expand Down
4 changes: 2 additions & 2 deletions internal/ui/baricon.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type barIcon struct {
windowData *appWindow // The window data associated with this icon (if it is a task window)
}

//Tapped means barIcon has been clicked
// Tapped means barIcon has been clicked
func (bi *barIcon) Tapped(*fyne.PointEvent) {
bi.onTapped()
}
Expand Down Expand Up @@ -112,7 +112,7 @@ func removeFromBar(icon fynedesk.AppData) {
settings.(*deskSettings).setLauncherIcons(icons)
}

//TappedSecondary means barIcon has been clicked by a secondary binding
// TappedSecondary means barIcon has been clicked by a secondary binding
func (bi *barIcon) TappedSecondary(*fyne.PointEvent) {
app := bi.appData
if app == nil && bi.windowData != nil {
Expand Down
6 changes: 3 additions & 3 deletions internal/ui/barlayout.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ const (
separatorWidth = 2
)

//barLayout returns a layout used for zooming linear groups of icons
// barLayout returns a layout used for zooming linear groups of icons
type barLayout struct {
bar *bar

mouseInside bool // Is the mouse inside of the layout?
mousePosition fyne.Position // Current coordinates of the mouse cursor
}

//setPointerInside tells the barLayout that the mouse is inside of the Layout.
// setPointerInside tells the barLayout that the mouse is inside of the Layout.
func (bl *barLayout) setPointerInside(inside bool) {
bl.mouseInside = inside
}

//setPointerPosition tells the barLayout that the mouse position has been updated.
// setPointerPosition tells the barLayout that the mouse position has been updated.
func (bl *barLayout) setPointerPosition(position fyne.Position) {
bl.mousePosition = position
}
Expand Down
1 change: 1 addition & 0 deletions internal/x11/border.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package x11
Expand Down
1 change: 1 addition & 0 deletions internal/x11/cursor.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package x11
Expand Down
1 change: 1 addition & 0 deletions internal/x11/property.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package x11
Expand Down
1 change: 1 addition & 0 deletions internal/x11/screenshot.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package x11
Expand Down
1 change: 1 addition & 0 deletions internal/x11/screenshot_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package x11
Expand Down
1 change: 1 addition & 0 deletions internal/x11/win/client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package win
Expand Down
1 change: 1 addition & 0 deletions internal/x11/win/client_properties.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package win
Expand Down
1 change: 1 addition & 0 deletions internal/x11/win/frame.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package win
Expand Down
1 change: 1 addition & 0 deletions internal/x11/win/property.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package win
Expand Down
1 change: 1 addition & 0 deletions internal/x11/wm/desk.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package wm // import "fyne.io/fynedesk/internal/x11/wm"
Expand Down
1 change: 1 addition & 0 deletions internal/x11/wm/desk_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package wm
Expand Down
1 change: 1 addition & 0 deletions internal/x11/wm/events.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package wm
Expand Down
1 change: 1 addition & 0 deletions internal/x11/wm/property.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package wm
Expand Down
1 change: 1 addition & 0 deletions internal/x11/wm/screens.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package wm
Expand Down
1 change: 1 addition & 0 deletions internal/x11/wm/stack.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package wm
Expand Down
1 change: 1 addition & 0 deletions internal/x11/wm/stack_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package wm
Expand Down
1 change: 1 addition & 0 deletions internal/x11/wm/switcher.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package wm
Expand Down
1 change: 1 addition & 0 deletions internal/x11/wm/transient.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux || openbsd || freebsd || netbsd
// +build linux openbsd freebsd netbsd

package wm
Expand Down
Loading

0 comments on commit 9635da4

Please sign in to comment.