GithubHelp home page GithubHelp logo

Comments (8)

maximbaz avatar maximbaz commented on May 19, 2024 1

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.

weilbith avatar weilbith commented on May 19, 2024 1

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.

weilbith avatar weilbith commented on May 19, 2024

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.

maximbaz avatar maximbaz commented on May 19, 2024

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.

weilbith avatar weilbith commented on May 19, 2024

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.

C0DK avatar C0DK commented on May 19, 2024

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.

maximbaz avatar maximbaz commented on May 19, 2024

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.

maximbaz avatar maximbaz commented on May 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.