Skip to content

Commit 37e84d3

Browse files
authored
Merge pull request #600 from th-ch/snoretoast-custom-compile
Add snoretoast custom compile script
2 parents 7192b25 + 44300e7 commit 37e84d3

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

.github/workflows/build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,60 @@ jobs:
3535
- name: Install dependencies
3636
run: yarn --frozen-lockfile
3737

38+
######################
39+
# Patch SnoreToast to fix App ID - see https://github.com/th-ch/youtube-music/issues/479#issuecomment-965473559
40+
- name: SnoreToast - parameters
41+
id: snoretoast-params
42+
if: startsWith(matrix.os, 'windows')
43+
shell: bash
44+
run: |
45+
echo "::set-output name=version::v0.8.0"
46+
echo "::set-output name=path::./vendor/snoretoast"
47+
48+
- name: SnoreToast - cache
49+
id: snoretoast-cache
50+
uses: actions/cache@v2
51+
if: startsWith(matrix.os, 'windows')
52+
with:
53+
path: ${{ steps.snoretoast-params.outputs.path }}
54+
key: snoretoast-${{ steps.snoretoast-params.outputs.version }}
55+
56+
- name: SnoreToast - compile
57+
if: |
58+
startsWith(matrix.os, 'windows') &&
59+
steps.snoretoast-cache.outputs.cache-hit != 'true'
60+
shell: bash
61+
run: |
62+
SNORETOAST_TAG="${{ steps.snoretoast-params.outputs.version }}"
63+
echo "Compiling SnoreToast $SNORETOAST_TAG"
64+
65+
git config --global user.email "th-ch@users.noreply.github.com"
66+
git config --global user.name "YouTube Music"
67+
git clone -c advice.detachedHead=false --branch $SNORETOAST_TAG --depth 1 https://github.com/KDE/snoretoast.git ${{ steps.snoretoast-params.outputs.path }}
68+
cd ${{ steps.snoretoast-params.outputs.path }}
69+
70+
# Apply https://github.com/KDE/snoretoast/pull/15/commits/c5faeceaf36f4b9fb27e5269990b716a25ecbe43
71+
# Patch generated with `git format-patch -1 c5faeceaf36f4b9fb27e5269990b716a25ecbe43`
72+
git am < ../snoretoast-patch/0001-Fix-activation-not-writing-to-pipe.patch
73+
74+
# Compile for win32
75+
cmake -A Win32 -B build32
76+
cmake --build build32 --config Release
77+
78+
# Compile for x64
79+
cmake -A x64 -B build64
80+
cmake --build build64 --config Release
81+
82+
- name: SnoreToast - overwrite with custom build
83+
if: startsWith(matrix.os, 'windows')
84+
shell: bash
85+
run: |
86+
# Override SnoreToast with the patched versions
87+
cp ${{ steps.snoretoast-params.outputs.path }}/build32/bin/Release/snoretoast.exe ./node_modules/node-notifier/vendor/snoreToast/snoretoast-x86.exe
88+
cp ${{ steps.snoretoast-params.outputs.path }}/build64/bin/Release/snoretoast.exe ./node_modules/node-notifier/vendor/snoreToast/snoretoast-x64.exe
89+
# End of SnoreToast patch
90+
######################
91+
3892
- name: Test
3993
uses: GabrielBB/xvfb-action@v1
4094
with:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
From c5faeceaf36f4b9fb27e5269990b716a25ecbe43 Mon Sep 17 00:00:00 2001
2+
From: Jake Barnes <me@jakebarn.es>
3+
Date: Mon, 3 May 2021 11:58:27 +1000
4+
Subject: [PATCH] Fix activation not writing to pipe
5+
6+
---
7+
src/toasteventhandler.cpp | 7 +++++++
8+
1 file changed, 7 insertions(+)
9+
10+
diff --git a/src/toasteventhandler.cpp b/src/toasteventhandler.cpp
11+
index d45d92f..e239dde 100644
12+
--- a/src/toasteventhandler.cpp
13+
+++ b/src/toasteventhandler.cpp
14+
@@ -79,6 +79,13 @@ IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification * /*sender*/,
15+
std::wcout << dataMap.at(L"button") << std::endl;
16+
m_userAction = SnoreToastActions::Actions::ButtonClicked;
17+
}
18+
+ if (!m_toast.pipeName().empty()) {
19+
+ if (m_userAction == SnoreToastActions::Actions::ButtonClicked) {
20+
+ Utils::writePipe(m_toast.pipeName(), m_toast.formatAction(m_userAction, { { L"button", dataMap.at(L"button") } }));
21+
+ } else {
22+
+ Utils::writePipe(m_toast.pipeName(), m_toast.formatAction(m_userAction));
23+
+ }
24+
+ }
25+
}
26+
SetEvent(m_event);
27+
return S_OK;
28+
--
29+
2.35.1
30+

0 commit comments

Comments
 (0)