Comments (8)
Hey! Happy to hear that you like the tool, and that you are building an extension for polybar - once you succeed, let's link to it in this project's README!
As to your question, what if you would read each message individually, parse it and then decide on the action - basically like I do in waybar module? So it's not reading by lines, but reading by 5 characters at a time, which is the guaranteed length of every message.
from yubikey-touch-detector.
Update
Polybar module without a service:
[module/yubikey]
type = custom/script
exec = ncat --unixsock $XDG_RUNTIME_DIR/yubikey-touch-detector.socket | while read -n5 message; do [[ $message = *1 ]] && echo " <key-icon> " || echo ""; done
tail = true
format-foreground = #ffffff
format-background = #ff0000
This should be promising to allow to apply blinking animation. The key here is the tail = true
option. But I guess that should not be a one-liner than.
from yubikey-touch-detector.
Perfect that was the hint I needed. Sorry that I missed that. I looked into the Python bar implementation, but not waybar.
Alright, so I have a solution up and running. It is kinda hard to link it. But I could at least share it here as comment. Eventually I could make it a Gist that you can link. 🤷 So here a simplified version (no special references to fonts, colors etc in polybar).
!!! Outdated !!! (version without extra service down below)
Somewhere within the polybar configuration:
[module/yubikey]
type = custom/ipc
hook-0 =
hook-1 = echo " <key-icon> " # GitHub does not show NerdFont icons...
format-foreground = #ffffff
format-background = #ff0000
A new SystemD service unit dependent on the one provided by this project here:
[Unit]
Description=Push YubiKey touch notifications to Polybar module for visualization
After=yubikey-touch-detector.service
[Service]
# Note the awkward offset of +1 for the correct polybar hook.
ExecStart=/bin/sh -c "ncat --unixsock $XDG_RUNTIME_DIR/yubikey-touch-detector.socket | while read -n5 message; do polybar-msg hook yubikey $((${message:4} +1)); done"
[Install]
WantedBy=yubikey-touch-detector.service
PS:
I tried to make it blinking, but Polybar does not support such effects within IPC modules (at least I can't think of a solution, since it waits until the hook function completed).
from yubikey-touch-detector.
I'm very glad that you made it working, I linked this comment in the README, thank you for sharing it 😉
from yubikey-touch-detector.
Cool. I'm still on the blinking/animation part. Someone at Reddit told be it should actually work. I'll update the comment if I got it working. I think such effect would make it way better to recognize.
from yubikey-touch-detector.
For noobs like me; if you are on arch you might have to install nmap
to get the correct version of ncat
:)
from yubikey-touch-detector.
I'm using nc -U
from openbsd-netcat
, works well too 😉
A hint for Arch on how to find the correct package:
$ pacman -Fy
...
$ pacman -F usr/bin/ncat
usr/bin/ncat is owned by extra/nmap 7.80-3
$ pacman -F usr/bin/nc
usr/bin/nc is owned by extra/gnu-netcat 0.7.1-8
usr/bin/nc is owned by community/openbsd-netcat 1.217_2-1
from yubikey-touch-detector.
Guys I thought to create Wiki for all sorts of integrations like you shared above, you should be able to edit it without any approvals, and I'm happy for the community to take charge and order Wiki however you see fit 👍
I made an initial page, just as an example: https://github.com/maximbaz/yubikey-touch-detector/wiki/Polybar
from yubikey-touch-detector.
Related Issues (20)
- Optional notification icon HOT 5
- UI integration for AwesomeWM users HOT 4
- Stdout notifier HOT 2
- Notification can't be closed on qtile. HOT 5
- [feature request] add an option for custom notification message. HOT 8
- [feature request] react to OATH requests HOT 7
- Feature Request: Configurable notification text HOT 2
- Install on Debian HOT 6
- Missing GPG pubring causes error HOT 4
- Please add binaries to the releases HOT 2
- MacOS Support HOT 1
- Add option to disable GPG detection HOT 2
- Gracefully handle missing `gpg` in PATH HOT 1
- `git` operations using SSH keys shadow notification HOT 1
- Panic in user service on logout from desktop environment HOT 3
- No U2F events captured after boot HOT 3
- systemd service doesn't/can't get correct SSH_AUTH_SOCK when using GPG as SSH agent with custom $GNUPGHOME HOT 1
- Feature Request: Distinct Notification Data and Yubikey Serial Number Inclusion HOT 2
- go install not working HOT 3
- [Feature]: Support new `keyboxd` gpg pubring format HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yubikey-touch-detector.