hide and delete invalid pinned items #74

This commit is contained in:
piotr 2022-11-12 03:41:24 +01:00
parent 3fe6d71234
commit ebdbe71ac6
4 changed files with 16 additions and 3 deletions

10
go.mod
View File

@ -1,6 +1,6 @@
module github.com/nwg-piotr/nwg-drawer
go 1.16
go 1.18
require (
github.com/allan-simon/go-singleinstance v0.0.0-20210120080615-d0997106ab37
@ -10,3 +10,11 @@ require (
github.com/joshuarubin/go-sway v0.0.4
github.com/sirupsen/logrus v1.8.1
)
require (
github.com/joshuarubin/lifecycle v1.0.0 // indirect
go.uber.org/atomic v1.3.2 // indirect
go.uber.org/multierr v1.1.0 // indirect
golang.org/x/sync v0.0.0-20190412183630-56d357773e84 // indirect
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
)

View File

@ -21,7 +21,7 @@ import (
"github.com/gotk3/gotk3/gtk"
)
const version = "0.3.3"
const version = "0.3.4"
var (
appDirs []string

View File

@ -534,7 +534,8 @@ func savePinned() {
}(f)
for _, line := range pinned {
if line != "" {
//skip invalid lines
if line != "" && id2entry[line].DesktopID != "" {
_, err := f.WriteString(line + "\n")
if err != nil {

View File

@ -32,6 +32,10 @@ func setUpPinnedFlowBox() *gtk.FlowBox {
if len(pinned) > 0 {
for _, desktopID := range pinned {
entry := id2entry[desktopID]
if entry.DesktopID == "" {
log.Debugf("Pinned item doesn't seem to exist: %s", desktopID)
continue
}
btn, _ := gtk.ButtonNew()