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

View file

@ -21,6 +21,7 @@
"idle_inhibitor"
#"mpd"
"network"
"custom/gpg-status"
"custom/weather"
"clock"
"tray"
@ -42,6 +43,11 @@
on-click = "xdg-open 'https://google.com/search?q=weather'";
exec =
"${pkgs.kat-weather}/bin/kat-weather ${witch.secrets.profiles.sway.city} ${witch.secrets.profiles.sway.api_key}";
};
"custom/gpg-status" = {
format = "{}";
interval= 300;
exec = "${pkgs.kat-gpg-status}/bin/kat-gpg-status";
};
cpu = { format = " {usage}%"; };
#mpd = {

View file

@ -9,7 +9,7 @@
min-height: 14px
}
#clock, #memory, #cpu, #temperature, #pulseaudio, #network, #mpd, #backlight, #battery, #custom-weather, #idle_inhibitor {
#clock, #memory, #cpu, #temperature, #pulseaudio, #network, #mpd, #backlight, #battery, #custom-weather, #custom-gpg-status, #idle_inhibitor {
margin-left: 8px;
margin-right: 8px;
padding-left: 8px;
@ -58,6 +58,7 @@
#mpd.disconnected, #mpd.stopped { border-color: #282a36 }
#network { border-color: ${style.base16.color3} }
#custom-weather { border-color: ${style.base16.color14} }
#custom-gpg-status { border-color: ${style.base16.color2} }
#pulseaudio { border-color: ${style.base16.color2} }
#temperature { border-color: ${style.base16.color4} }
#battery { border-color: ${style.base16.color6} }