GPG status module for Waybar

This commit is contained in:
kat witch 2021-03-26 00:42:52 +00:00
parent 323322f339
commit 6ead6fbfea
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
5 changed files with 30 additions and 1 deletions

View file

@ -35,6 +35,8 @@ let
kat-weather = super.callPackage ./kat-weather { };
kat-gpg-status =super.callPackage ./kat-gpg-status { };
linuxPackagesFor = kernel:
(super.linuxPackagesFor kernel).extend (_: ksuper: {
vendor-reset =

View file

@ -0,0 +1,8 @@
{
wrapShellScriptBin,
pkgs
}:
wrapShellScriptBin "kat-gpg-status" ./kat-gpg-status.sh {
depsRuntimePath = with pkgs; [coreutils gnupg];
}

View file

@ -0,0 +1,12 @@
#!/bin/bash
set -eu
set -o pipefail
gpg --card-status &> /dev/null;
if [ $? -eq 0 ]; then
user="$(gpg --card-status | grep "Login data" | awk '{print $NF}')";
else
user=" Disconnected"
fi
echo $user