feat: add a setting to stay quiet while the camera is in use
This commit is contained in:
1 parent
5eb9ea7438
commit
658adb7da7
20 files changed
+1003
-956
No files matched your search
@@ -120,7 +120,7 @@ void BubbleController::failed(const QString &reason, qint64 lockout)
|
||||
if (reason == u"camera-busy") {
|
||||
// A video call, most likely. The daemon starts no scan then, so this
|
||||
// may come with nothing on screen yet.
|
||||
if (!enabled()) {
|
||||
if (!enabled() || m_config->quietWhenCameraBusy()) {
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ void UserConfig::load()
|
||||
m_bubble = kv.boolean(QStringLiteral("Bubble"), true);
|
||||
m_bubbleStyle = kv.value(QStringLiteral("BubbleStyle"), QStringLiteral("full")) == u"minimal" ? QStringLiteral("minimal") : QStringLiteral("full");
|
||||
m_bubbleForPrompts = kv.boolean(QStringLiteral("BubbleForPrompts"), true);
|
||||
m_quietWhenCameraBusy = kv.boolean(QStringLiteral("QuietWhenCameraBusy"), false);
|
||||
const QString speed = kv.value(QStringLiteral("AnimationSpeed"), QStringLiteral("normal"));
|
||||
// The durations in the code are brisk, like on a phone. On a big screen
|
||||
// they read better a little longer, so normal stretches them.
|
||||
|
||||
@@ -79,6 +79,12 @@ public:
|
||||
{
|
||||
return m_bubbleForPrompts;
|
||||
}
|
||||
// No bubble at all while another program has the camera (a video call).
|
||||
// Off: the bubble shows a camera with a line through it.
|
||||
bool quietWhenCameraBusy() const
|
||||
{
|
||||
return m_quietWhenCameraBusy;
|
||||
}
|
||||
// How long the bubble's animations take, as a multiple of the durations
|
||||
// in the code: the animation speed setting (fast 1, normal 1.3,
|
||||
// slow 2).
|
||||
@@ -106,6 +112,7 @@ private:
|
||||
bool m_bubble = true;
|
||||
QString m_bubbleStyle = QStringLiteral("full");
|
||||
bool m_bubbleForPrompts = true;
|
||||
bool m_quietWhenCameraBusy = false;
|
||||
qreal m_pace = 1.3;
|
||||
QString m_styleOverride;
|
||||
};
|
||||
@@ -486,8 +486,8 @@ void Server::handleVerify(Client *client, const QJsonObject &request)
|
||||
}
|
||||
|
||||
// Another program has the camera, a video call most likely. No scan
|
||||
// starts: the bubble shows a camera with a line through it, and the
|
||||
// password is asked for at once.
|
||||
// starts: the bubble shows a camera with a line through it, or nothing
|
||||
// if the user wants it quiet, and the password is asked for at once.
|
||||
if (Camera::inUse(s.camera)) {
|
||||
qInfo("scan for %s (%s): the camera is in use", qPrintable(System::nameOf(uid)), qPrintable(purpose));
|
||||
broadcast(uid, {{QStringLiteral("event"), QStringLiteral("scan")},
|
||||
|
||||
@@ -322,6 +322,7 @@ FU_SETTINGS=(
|
||||
"user|BubbleStyle|choice|full|Style|full,minimal|Bubble"
|
||||
"user|AnimationSpeed|choice|normal|Animation speed|slow,normal,fast|Bubble"
|
||||
"user|BubbleForPrompts|bool|yes|Also for sudo and admin prompts||Bubble"
|
||||
"user|QuietWhenCameraBusy|bool|no|Quiet while the camera is in use||Bubble"
|
||||
)
|
||||
|
||||
# fu_setting_help <Key> <value>
|
||||
@@ -363,6 +364,7 @@ fu_setting_help() {
|
||||
BubbleStyle:*) fu_msg "An island with a face that looks around, then rings and a tick." ;;
|
||||
AnimationSpeed:*) fu_msg "How fast the bubble moves." ;;
|
||||
BubbleForPrompts:*) fu_msg "Shows the bubble when sudo or an admin prompt scans your face, too." ;;
|
||||
QuietWhenCameraBusy:*) fu_msg "When another app uses the camera, for example in a video call, no bubble shows and you type your password as usual. Off: the bubble shows a camera with a line through it." ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user