SwiftBar icon indicating copy to clipboard operation
SwiftBar copied to clipboard

.swiftbarignore not works

Open kazusa3e opened this issue 10 months ago • 4 comments

Describe the bug Files listed in .swiftbarignore are loaded as plugin.

To Reproduce Sometimes we write Python scripts that use 3party packages, and use virtual environments, make the file tree like this:


$ tree -a
.
└── tasks
    ├── .swiftbarignore
    ├── Pipfile
    ├── tasks.5m.sh
    └── tasks.py

2 directories, 4 files

tasks.py is the entry script, but tasks.5m.sh is a necessary loader to active Python virtual environment, then call the entry script, etc.

And my .swiftbarignore like this:

Pipfile
tasks.py

There are three plugins actived, include Pipfile and tasks.py.

Expected behavior Only one plugin, tasks.5m.sh are actived.

BTW, what about to set a stragety that mark file as plugin only when it's filename match the regex [a-zA-Z0-9]\.[0-9]+[smhdwm]\.(sh|py|lua)?

Screenshots

Image

Environment:

  • macOS version: 15.3.1 (24D70)
  • SwiftBar version: 2.0.1

Plugin Example: Sample plugin to reproduce the issue, link or code.

Additional Context:

  • [x] I don't run Bartender/Dozer/etc. or tested the issue without it running

kazusa3e avatar Mar 10 '25 04:03 kazusa3e

I think that the problem is in the full file path. I guess there are spaces or something like that that break pattern matching in SwiftBar. I couldn't reproduce it, but I have a test build that should be a bit more resilient, give it a try. SwiftBar 537.zip

BTW, what about to set a stragety that mark file as plugin only when it's filename match the regex [a-zA-Z0-9].[0-9]+[smhdwm].(sh|py|lua)?

Reasonable, but not going to fly. Too many edge cases - binary plugins with no file extension, plugins with no schedule, etc. In the majority of cases, people just have a single file per plugin; in the rest, .swiftignore should do it.

Additionally I'm making progress on #387

melonamin avatar Mar 10 '25 22:03 melonamin

I think that the problem is in the full file path. I guess there are spaces or something like that that break pattern matching in SwiftBar. I couldn't reproduce it, but I have a test build that should be a bit more resilient, give it a try. SwiftBar 537.zip

BTW, what about to set a stragety that mark file as plugin only when it's filename match the regex [a-zA-Z0-9].[0-9]+[smhdwm].(sh|py|lua)?

Reasonable, but not going to fly. Too many edge cases - binary plugins with no file extension, plugins with no schedule, etc. In the majority of cases, people just have a single file per plugin; in the rest, .swiftignore should do it.

Additionally I'm making progress on #387

I have tried this test build and problem existed yet.

kazusa3e avatar Mar 11 '25 14:03 kazusa3e

I have tried this test build and problem existed yet.

You mean the problem persists? I need more input from you to hunt this down since I can't reproduce it on my own.

melonamin avatar Mar 11 '25 16:03 melonamin

Hi melonamin,

I've created a minimal plugin to reproduce this bug.

Thank you sincerely for your assistance.

tasks.tar.gz

kazusa3e avatar Mar 13 '25 03:03 kazusa3e