Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ghosteel.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ DEFINES += SAILFISH_SECRETS
INCLUDEPATH += /usr/include/Sailfish
LIBS += -lsailfishsecrets -lsailfishcrypto

# Non-graphical feedback daemon (ngfd) client for the terminal bell
INCLUDEPATH += /usr/include/ngf-qt5
LIBS += -lngf-qt5

# Centralized app identity — change these to rename the app
APP_NAME = $$TARGET
APP_ORG = com.zackslash
Expand Down Expand Up @@ -56,6 +60,7 @@ LIBS += -lpthread -lm -ldl -lutil -lrt -lGLESv2 -lEGL
RESOURCES += shaders/shaders.qrc

HEADERS += \
src/bellfeedback.h \
src/ghosteeladapter.h \
src/ghosttyvt.h \
src/glrenderer.h \
Expand All @@ -72,6 +77,7 @@ HEADERS += \
src/textutil.h

SOURCES += \
src/bellfeedback.cpp \
src/ghosteel.cpp \
src/ghosteeladapter.cpp \
src/ghosttyvt.cpp \
Expand Down
9 changes: 1 addition & 8 deletions qml/pages/TerminalPage.qml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import Sailfish.Share 1.0
import QtMultimedia 5.0
import Nemo.Notifications 1.0
import com.zackslash.ghosteel 1.0
import "KeyCatalog.js" as KeyCatalog
Expand Down Expand Up @@ -132,12 +131,6 @@ Page {
property string pendingClipboardSessionName: ""
property bool clipboardDialogActive: false // Guards against stacking read dialogs

// Bell sound for terminal BEL character
SoundEffect {
id: bellSound
source: "/usr/share/sounds/jolla-ambient/stereo/jolla-notification.wav"
}

// Haptic feedback notification — publishing a notification triggers system vibration
Notification {
id: bellNotification
Expand Down Expand Up @@ -678,7 +671,7 @@ Page {

// Sound: mode 2 or 3
if (mode === 2 || mode === 3) {
bellSound.play()
bellFeedback.playBell()
}
}

Expand Down
2 changes: 2 additions & 0 deletions rpm/ghosteel.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Requires: nemo-qml-plugin-notifications-qt5
Requires: sailfishsecretsdaemon
Requires: sailfishsecretsdaemon-cryptoplugins-default
Requires: sailfishsecretsdaemon-secretsplugins-default
Requires: libngf-qt5
BuildRequires: pkgconfig(sailfishapp) >= 1.0.2
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5DBus)
Expand All @@ -29,6 +30,7 @@ BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(harfbuzz)
BuildRequires: pkgconfig(sailfishsecrets)
BuildRequires: pkgconfig(sailfishcrypto)
BuildRequires: pkgconfig(ngf-qt5)
BuildRequires: desktop-file-utils
BuildRequires: xz
BuildRequires: patch
Expand Down
27 changes: 27 additions & 0 deletions src/bellfeedback.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "bellfeedback.h"

#include <NgfClient>
#include <QDebug>

BellFeedback::BellFeedback(QObject *parent)
: QObject(parent)
{
}

void BellFeedback::ensureClient()
{
if (m_client)
return;
// Lazy: skip the D-Bus connection until first bell.
// Ngf::Client auto-reconnects if the daemon appears after the first failure.
m_client = new Ngf::Client(this);
if (!m_client->connect()) {
qWarning() << "BellFeedback: ngfd connection failed; bell will be silent";
}
}

void BellFeedback::playBell()
{
ensureClient();
m_client->play(QStringLiteral("default"));
}
23 changes: 23 additions & 0 deletions src/bellfeedback.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef BELLFEEDBACK_H
#define BELLFEEDBACK_H

#include <QObject>

namespace Ngf { class Client; }

// Terminal bell via ngfd (SailfishOS feedback daemon). Chosen over a bundled
// WAV because community ports lack the proprietary jolla-ambient-sound-theme.
class BellFeedback : public QObject
{
Q_OBJECT
public:
explicit BellFeedback(QObject *parent = nullptr);

Q_INVOKABLE void playBell();

private:
void ensureClient();
Ngf::Client *m_client = nullptr;
};

#endif // BELLFEEDBACK_H
5 changes: 5 additions & 0 deletions src/ghosteel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#undef emit
#endif

#include "bellfeedback.h"
#include "ghosteeladapter.h"
#include "kittyimagedecoder.h"

Expand Down Expand Up @@ -113,6 +114,10 @@ int main(int argc, char *argv[])
SessionManager *sessionManager = new SessionManager(app.data());
view->rootContext()->setContextProperty(QStringLiteral("SessionManager"), sessionManager);

// Expose the bell feedback (ngfd client) to QML
BellFeedback *bellFeedback = new BellFeedback(app.data());
view->rootContext()->setContextProperty(QStringLiteral("bellFeedback"), bellFeedback);

// Store CLI args for deferred processing after QML restoreSessions()
if (!execCommand.isEmpty() || !sessionName.isEmpty())
sessionManager->setCliArgs(execCommand, execArgs, sessionName);
Expand Down
Loading