Migrate to code.rocketnine.space

This commit is contained in:
Trevor Slocum 2021-04-14 19:36:54 -07:00
parent a8332eef8e
commit 550c5e7c34
16 changed files with 70 additions and 114 deletions

View file

@ -1,42 +0,0 @@
image: golang:latest
stages:
- validate
- build
fmt:
stage: validate
script:
- gofmt -l -s -e .
- exit $(gofmt -l -s -e . | wc -l)
lint:
stage: validate
script:
- go get -u golang.org/x/lint/golint
- golint -set_exit_status
vet:
stage: validate
script:
- apt-get update && apt-get install -y libgtk-3-dev
- go vet -composites=false ./...
test:
stage: validate
script:
- apt-get update && apt-get install -y libgtk-3-dev
- go test -race -v ./...
build-gmenu:
stage: build
script:
- cd cmd/gmenu
- go build
build-gtkmenu:
stage: build
script:
- apt-get update && apt-get install -y libgtk-3-dev
- cd cmd/gtkmenu
- go build

View file

@ -1,3 +1,6 @@
0.3.0
- Migrate to code.rocketnine.space
0.2.9
- gtkmenu: Restrict to single instance

View file

@ -1,5 +1,5 @@
gmenu - Desktop application launcher
https://gitlab.com/tslocum/gmenu
https://code.rocketnine.space/tslocum/gmenu
The MIT License (MIT)

View file

@ -1,5 +1,5 @@
# gmenu
[![CI status](https://gitlab.com/tslocum/gmenu/badges/master/pipeline.svg)](https://gitlab.com/tslocum/gmenu/commits/master)
[![Donate](https://img.shields.io/liberapay/receives/rocketnine.space.svg?logo=liberapay)](https://liberapay.com/rocketnine.space)
Desktop application launcher
@ -26,19 +26,18 @@ Note: Linux is currently the only supported OS.
## Compile
The following commands download and build gmenu from source. The resulting
binary is located at `~/go/bin/`.
The following commands download and build gmenu from source. The resulting binary is located at `~/go/bin/`.
### Console
```
go get gitlab.com/tslocum/gmenu/cmd/gmenu
go get code.rocketnine.space/tslocum/gmenu/cmd/gmenu
```
### GUI
```
go get gitlab.com/tslocum/gmenu/cmd/gtkmenu
go get code.rocketnine.space/tslocum/gmenu/cmd/gtkmenu
```
## Usage
@ -51,7 +50,7 @@ The input buffer may be executed as a shell command by selecting the last entry
## Support
Please share issues and suggestions [here](https://gitlab.com/tslocum/gmenu/issues).
Please share issues and suggestions [here](https://code.rocketnine.space/tslocum/gmenu/issues).
## Integration Example - [sway](https://swaywm.org)/[i3](https://i3wm.org) + [alacritty](https://github.com/jwilm/alacritty)

View file

@ -3,9 +3,9 @@ package main
import (
"strings"
"code.rocketnine.space/tslocum/cview"
"code.rocketnine.space/tslocum/gmenu/pkg/gmenu"
"github.com/gdamore/tcell/v2"
"gitlab.com/tslocum/cview"
"gitlab.com/tslocum/gmenu/pkg/gmenu"
)
var (

View file

@ -5,9 +5,9 @@ import (
"fmt"
"strings"
"code.rocketnine.space/tslocum/desktop"
"code.rocketnine.space/tslocum/gmenu/pkg/gmenu"
"github.com/kballard/go-shellquote"
"gitlab.com/tslocum/desktop"
"gitlab.com/tslocum/gmenu/pkg/gmenu"
)
func updateEntries(input string) {

View file

@ -6,8 +6,8 @@ import (
"log"
"os"
"code.rocketnine.space/tslocum/gmenu/pkg/gmenu"
"github.com/mattn/go-isatty"
"gitlab.com/tslocum/gmenu/pkg/gmenu"
)
// Config stores configuration variables.

View file

@ -14,12 +14,9 @@ func initWindow(application *gtk.Application) *gtk.ApplicationWindow {
log.Fatal("failed to create window:", err)
}
_, err = w.Connect("key-press-event", handleKeybinding)
if err != nil {
log.Fatal("failed to connect key-press-event:", err)
}
w.Connect("key-press-event", handleKeybinding)
_, err = w.Connect("destroy", func() {
w.Connect("destroy", func() {
os.Exit(0)
})
if err != nil {

View file

@ -7,10 +7,10 @@ import (
"os"
"path"
"code.rocketnine.space/tslocum/desktop"
"code.rocketnine.space/tslocum/gmenu/pkg/gmenu"
"github.com/gotk3/gotk3/gdk"
"github.com/gotk3/gotk3/gtk"
"gitlab.com/tslocum/desktop"
"gitlab.com/tslocum/gmenu/pkg/gmenu"
)
const cachedIconCompressionLevel = 3

View file

@ -10,12 +10,12 @@ import (
"strings"
"sync"
"code.rocketnine.space/tslocum/desktop"
"code.rocketnine.space/tslocum/gmenu/pkg/gmenu"
"github.com/gotk3/gotk3/glib"
"github.com/gotk3/gotk3/gtk"
"github.com/gotk3/gotk3/pango"
"github.com/kballard/go-shellquote"
"gitlab.com/tslocum/desktop"
"gitlab.com/tslocum/gmenu/pkg/gmenu"
)
const (
@ -42,7 +42,7 @@ func initList(container *gtk.Box) {
log.Fatal("failed to create input buffer:", err)
}
_, err = buffer.Connect("changed", func(tb *gtk.TextBuffer) bool {
buffer.Connect("changed", func(tb *gtk.TextBuffer) bool {
gmenu.SetInput(strings.TrimSpace(textViewText(inputView)))
return false
@ -91,14 +91,14 @@ func initList(container *gtk.Box) {
glib.IdleAdd(rowInitFunc(i, label, entry, lastEntry, wg))
}
listBox.SetSortFunc(listSort, 0)
listBox.SetFilterFunc(listFilter, 0)
listBox.SetSortFunc(listSort)
listBox.SetFilterFunc(listFilter)
go func() {
wg.Wait()
glib.IdleAdd(func() {
_, err = listBox.Connect("row-activated", func(_ *gtk.ListBox, _ *gtk.ListBoxRow) {
listBox.Connect("row-activated", func(_ *gtk.ListBox, _ *gtk.ListBoxRow) {
err := listSelect(inputView, false)
if err != nil {
log.Fatal(err)
@ -304,7 +304,7 @@ func listSelect(_ *gtk.TextView, runInTerminal bool) error {
return nil
}
func listSort(row1 *gtk.ListBoxRow, row2 *gtk.ListBoxRow, _ ...interface{}) int {
func listSort(row1 *gtk.ListBoxRow, row2 *gtk.ListBoxRow) int {
r1 := rowID(row1)
r2 := rowID(row2)
@ -329,7 +329,7 @@ func listSort(row1 *gtk.ListBoxRow, row2 *gtk.ListBoxRow, _ ...interface{}) int
return 1
}
func listFilter(row *gtk.ListBoxRow, _ ...interface{}) bool {
func listFilter(row *gtk.ListBoxRow) bool {
match := gmenu.MatchEntry(rowID(row))
row.SetSelectable(match)

View file

@ -9,9 +9,9 @@ import (
"runtime/pprof"
"sync"
"code.rocketnine.space/tslocum/gmenu/pkg/gmenu"
"github.com/gotk3/gotk3/glib"
"github.com/gotk3/gotk3/gtk"
"gitlab.com/tslocum/gmenu/pkg/gmenu"
)
// Config stores configuration variables.
@ -80,7 +80,10 @@ func load() {
gmenu.FilteredEntries = append(gmenu.FilteredEntries, &gmenu.ListEntry{Label: "", Entry: nil})
go gmenu.HandleInput(func(input string) {
glib.IdleAdd(updateList, input)
f := func() {
updateList(input)
}
glib.IdleAdd(f)
})
loaded <- true

14
go.mod
View file

@ -1,15 +1,15 @@
module gitlab.com/tslocum/gmenu
module code.rocketnine.space/tslocum/gmenu
go 1.12
require (
github.com/gdamore/tcell/v2 v2.1.1-0.20201225194624-29bb185874fd
github.com/gotk3/gotk3 v0.5.3-0.20210203060005-2f8426f58c71
code.rocketnine.space/tslocum/cview v1.5.4
code.rocketnine.space/tslocum/desktop v0.1.5
github.com/gdamore/tcell/v2 v2.2.1-0.20210305060500-f4d402906fa3
github.com/gotk3/gotk3 v0.5.3-0.20210405165307-86f85cbecd0b
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/lithammer/fuzzysearch v1.1.1
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.12
gitlab.com/tslocum/cview v1.5.3
gitlab.com/tslocum/desktop v0.1.4
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect
golang.org/x/sys v0.0.0-20210414055047-fe65e336abe0 // indirect
golang.org/x/term v0.0.0-20210406210042-72f3dc4e9b72 // indirect
)

51
go.sum
View file

@ -1,46 +1,45 @@
code.rocketnine.space/tslocum/cbind v0.1.5 h1:i6NkeLLNPNMS4NWNi3302Ay3zSU6MrqOT+yJskiodxE=
code.rocketnine.space/tslocum/cbind v0.1.5/go.mod h1:LtfqJTzM7qhg88nAvNhx+VnTjZ0SXBJtxBObbfBWo/M=
code.rocketnine.space/tslocum/cview v1.5.4 h1:zBUFAanViudrAw8ZCqNxaufqrYL6a7F1AkkIClXIzYo=
code.rocketnine.space/tslocum/cview v1.5.4/go.mod h1:JjgoZi3b528SaV923oQq14PGUCTE/g/6iggnDUxsChE=
code.rocketnine.space/tslocum/desktop v0.1.5 h1:GXZpPo8KH8M24Juu0F/UTfXgOnya0MAAnCQByBpFGz4=
code.rocketnine.space/tslocum/desktop v0.1.5/go.mod h1:6IwP59rJ44vga/frr123meFdpWU0xMZlTq8gcOhVKGI=
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
github.com/gdamore/tcell/v2 v2.0.0-dev/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
github.com/gdamore/tcell/v2 v2.1.1-0.20201225194624-29bb185874fd h1:66OLuRCaOFojnLK9eB0YTo8CU9AgHtfvBWvLsz/8r+I=
github.com/gdamore/tcell/v2 v2.1.1-0.20201225194624-29bb185874fd/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
github.com/gotk3/gotk3 v0.5.3-0.20210203060005-2f8426f58c71 h1:xl5UQMOTaJ4t0gVGNkPyl1nCPm8ZO4uLpEa5QkZehaw=
github.com/gotk3/gotk3 v0.5.3-0.20210203060005-2f8426f58c71/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/gdamore/tcell/v2 v2.2.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
github.com/gdamore/tcell/v2 v2.2.1-0.20210305060500-f4d402906fa3 h1:PqyGpJlv98ynqEPq5MMiT+hcUPPvIomSS0Rnmy5Tl9A=
github.com/gdamore/tcell/v2 v2.2.1-0.20210305060500-f4d402906fa3/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
github.com/gotk3/gotk3 v0.5.3-0.20210405165307-86f85cbecd0b h1:KXbrFonfNw1xdc2CeUWYPMir0wXr8ejQlKlClQxM1Lc=
github.com/gotk3/gotk3 v0.5.3-0.20210405165307-86f85cbecd0b/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/lithammer/fuzzysearch v1.1.1 h1:8F9OAV2xPuYblToVohjanztdnPjbtA0MLgMvDKQ0Z08=
github.com/lithammer/fuzzysearch v1.1.1/go.mod h1:H2bng+w5gsR7NlfIJM8ElGZI0sX6C/9uzGqicVXGU6c=
github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg=
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.12 h1:Y41i/hVW3Pgwr8gV+J23B9YEY0zxjptBuCWEaxmAOow=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
gitlab.com/tslocum/cbind v0.1.4 h1:cbZXPPcieXspk8cShoT6efz7HAT8yMNQcofYWNizis4=
gitlab.com/tslocum/cbind v0.1.4/go.mod h1:RvwYE3auSjBNlCmWeGspzn+jdLUVQ8C2QGC+0nP9ChI=
gitlab.com/tslocum/cview v1.5.3 h1:6OTCtIUp1EkfGeLqQFRHtW8ynMJ66BhoBwuW8oZ84AQ=
gitlab.com/tslocum/cview v1.5.3/go.mod h1:k/eLWRIF3B26VLDgtRRPkjLUXmcCsy+YCSPEAtNQgIY=
gitlab.com/tslocum/desktop v0.1.4 h1:ew+nJFAaNLXQw9SlX3M2OZjHd55SJCc5k3J+rQUPA4E=
gitlab.com/tslocum/desktop v0.1.4/go.mod h1:xegVIo1fwhovdUkErI999g3qb5gK9T7+s76hMLDOXRg=
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201013132646-2da7054afaeb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210309040221-94ec62e08169/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210414055047-fe65e336abe0 h1:g9s1Ppvvun/fI+BptTMj909BBIcGrzQ32k9FNlcevOE=
golang.org/x/sys v0.0.0-20210414055047-fe65e336abe0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210406210042-72f3dc4e9b72 h1:VqE9gduFZ4dbR7XoL77lHFp0/DyDUBKSXK7CMFkVcV0=
golang.org/x/term v0.0.0-20210406210042-72f3dc4e9b72/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

View file

@ -1,14 +1,13 @@
project_name: gmenu
builds:
-
id: gmenu
- id: gmenu
binary: gmenu
main: ./cmd/gmenu
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X gitlab.com/tslocum/gmenu/pkg/gmenu.Version={{.Version}}
- -s -w -X code.rocketnine.space/tslocum/gmenu/pkg/gmenu.Version={{.Version}}
goos:
- darwin
- freebsd
@ -16,19 +15,17 @@ builds:
goarch:
- 386
- amd64
-
id: gtkmenu
- id: gtkmenu
binary: gtkmenu
main: ./cmd/gtkmenu
ldflags:
- -s -w -X gitlab.com/tslocum/gmenu/pkg/gmenu.Version={{.Version}}
- -s -w -X code.rocketnine.space/tslocum/gmenu/pkg/gmenu.Version={{.Version}}
goos:
- linux
goarch:
- amd64
archives:
-
id: gmenu
- id: gmenu
builds:
- gmenu
- gtkmenu

View file

@ -33,7 +33,7 @@ func (c *Config) BrowserCommand() string {
// VersionInfo is the text printed when the --version flag is supplied.
const VersionInfo = `%s - Desktop application launcher - v%s
https://gitlab.com/tslocum/gmenu
https://code.rocketnine.space/tslocum/gmenu
The MIT License (MIT)
Copyright (c) 2019 Trevor Slocum <trevor@rocketnine.space>
`

View file

@ -7,8 +7,8 @@ import (
"sort"
"strings"
"code.rocketnine.space/tslocum/desktop"
"github.com/lithammer/fuzzysearch/fuzzy"
"gitlab.com/tslocum/desktop"
)
var (