diff --git a/README.md b/README.md index 56e69e211d9ad76087c32fdf900a3dfc997db5d9..185c242dc07788fdba09a559674f3d0fafe33eda 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,12 @@ Then, add the following command to gnome-autostart. You should know how to auto- You're all set! Re-login and have a try! +## FAQ + +- Keyring not exist? The name is correct. + +run `tools/list_keyrings.sh` to check name of your keyrings. The `login` keyring may be shown as `登录` based on your locale. + ## TODO This program is using deprecated `libgnome-keyring-1` rather than `libsecret`, only because the author can not understand how to use `libsecret`. There's almost no document! (If you think auto-generated document is document, then all source code are well documented. ) diff --git a/src/unlock_keyrings.cc b/src/unlock_keyrings.cc index 8e829aedf905a58b6e548ef95bd9649918344129..d17b663c9ce46705a35a2e240cbb829c4308567d 100644 --- a/src/unlock_keyrings.cc +++ b/src/unlock_keyrings.cc @@ -43,9 +43,9 @@ int main(int argc, char **argv) { auto res = do_unlock(keyring_and_pswd.at(0), keyring_and_pswd.at(1)); auto msg = keyringResultToString(res); if(res == GNOME_KEYRING_RESULT_OK) - rlog.info("line {}: {}.", line_num, msg); + rlog.info("line {}: Working on keyring `{}`: {}.", line_num, keyring_and_pswd.at(0), msg); else { - rlog.error("line {}: {}.", line_num, msg); + rlog.error("line {}: Working on keyring `{}`: {}.", line_num, keyring_and_pswd.at(0), msg); no_error = false; } diff --git a/tools/list_keyrings.cc b/tools/list_keyrings.cc new file mode 100644 index 0000000000000000000000000000000000000000..7696695f6528236b45cb752184750b3d9e01e63f --- /dev/null +++ b/tools/list_keyrings.cc @@ -0,0 +1,14 @@ +// You can use this naive program to know keyring names. +// eval g++ (pkg-config --cflags --libs gnome-keyring-1) list.cc -o s +#include <gnome-keyring-1/gnome-keyring.h> +#include <iostream> + +int main() { + GList *pRes = nullptr; + GnomeKeyringResult res = gnome_keyring_list_keyring_names_sync(&pRes); + for(int i = 0; i < g_list_length(pRes); ++i) { + gpointer dat = g_list_nth_data(pRes, i); + gchar *gs = (gchar *)dat; + std::cout << gs << std::endl; + } +} diff --git a/tools/list_keyrings.sh b/tools/list_keyrings.sh new file mode 100755 index 0000000000000000000000000000000000000000..bb206f4960ea761fd97069dc512091be50ed448e --- /dev/null +++ b/tools/list_keyrings.sh @@ -0,0 +1,4 @@ +#!/bin/bash +eval g++ $(pkg-config --cflags --libs gnome-keyring-1) list_keyrings.cc -o list.out && +./list.out +