pzmarzly / ancs4linux

iOS/iPadOS notification service client for Linux desktop (notifications on your desktop, over Bluetooth Low Energy)
Other
207 stars 13 forks source link

Copy 2FA codes to system clipboard #12

Open pzmarzly opened 2 years ago

pzmarzly commented 2 years ago

When an user receives an SMS message, we get a notification over ANCS (as long as user doesn't have Messages silenced).

It would be amazing if ancs4linux-desktop-integration could parse text messages, and if a string of 4-8 digits is found, add a Copy button to its desktop notification, that would trigger xclip/wl-clipboard.

gfarrell commented 2 years ago

This is exactly what I was looking at this for, but was assuming that I could script ANCS somehow.

pzmarzly commented 2 years ago

Well, an external script would also work. Just listen to ShowNotification signal in anccs4linux.observer API.

When making ancs4linux I chose D-Bus as I wanted a good interop with other languages, so you can even use bash for everything. However, it's a bit easier to just use Python and have a strongly-typed API with from ancs4linux.common.apis import ObserverAPI, ShowNotificationData. I think you can easily develop both in-tree and outside of the project (as ancs4linux gets globally installed). In the future I may want to make some plugin system to make distributing community-made components easier.

I suspect most complexity in this feature comes from:

Do you want to try working on it?