Skip to content

Commit

Permalink
chore(notification): remove libnotify dependency and notifications
Browse files Browse the repository at this point in the history
Closes #58
  • Loading branch information
jtheoof committed Feb 17, 2021
1 parent 46e5854 commit 1bb534f
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: GCC
run: |
sudo apt-get update
sudo apt --yes install libgtk-3-dev libnotify-dev meson ninja-build scdoc
sudo apt --yes install libgtk-3-dev meson ninja-build scdoc
pkg-config --list-all
CC=gcc meson build
ninja -C build
Expand All @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v1
- name: Clang
run: |
sudo apt --yes install libgtk-3-dev libnotify-dev meson ninja-build scdoc clang clang-format clang-tidy
sudo apt --yes install libgtk-3-dev meson ninja-build scdoc clang clang-format clang-tidy
CC=clang meson build
ninja -C build
echo "Making sure clang-format is correct..."
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ Install dependencies (on Arch, name can vary for other distros):
Optional dependencies:

- `wl-clipboard` (to make sure the copy is saved if you close swappy)
- `libnotify` (not get notified when swappshot is copied or saved)
- `otf-font-awesome` (to draw the paint icons properly)

Then run:
Expand Down
3 changes: 0 additions & 3 deletions include/notification.h

This file was deleted.

8 changes: 0 additions & 8 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ math = cc.find_library('m')
gtk = dependency('gtk+-3.0', version: '>=3.20.0')
gio = dependency('gio-2.0')

libnotify = dependency('libnotify', required: get_option('libnotify'))

if libnotify.found()
add_project_arguments('-DHAVE_LIBNOTIFY', language: 'c')
endif

subdir('res')
subdir('src/po')

Expand All @@ -66,15 +60,13 @@ executable(
'src/paint.c',
'src/pixbuf.c',
'src/render.c',
'src/notification.c',
'src/util.c',
]),
dependencies: [
cairo,
pango,
gio,
gtk,
libnotify,
math,
],
link_args: '-rdynamic',
Expand Down
1 change: 0 additions & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
option('libnotify', type: 'feature', value: 'auto', description: 'Send desktop notifications')
4 changes: 0 additions & 4 deletions src/clipboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <sys/wait.h>
#include <unistd.h>

#include "notification.h"
#include "pixbuf.h"
#include "util.h"

Expand Down Expand Up @@ -81,9 +80,6 @@ bool clipboard_copy_drawing_area_to_selection(struct swappy_state *state) {
send_pixbuf_to_gdk_clipboard(pixbuf);
}

char message[MAX_PATH];
g_snprintf(message, MAX_PATH, "Swappshot copied to clipboard\n");
notification_send("Swappy", message);
g_object_unref(pixbuf);

return true;
Expand Down
16 changes: 0 additions & 16 deletions src/notification.c

This file was deleted.

9 changes: 0 additions & 9 deletions src/pixbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <cairo/cairo.h>
#include <gio/gunixoutputstream.h>

#include "notification.h"

GdkPixbuf *pixbuf_get_from_state(struct swappy_state *state) {
guint width = cairo_image_surface_get_width(state->rendering_surface);
guint height = cairo_image_surface_get_height(state->rendering_surface);
Expand All @@ -22,13 +20,6 @@ static void write_file(GdkPixbuf *pixbuf, char *path) {
g_critical("unable to save drawing area to pixbuf: %s", error->message);
g_error_free(error);
}

char *msg = "Saved Swappshot to: ";
size_t len = strlen(msg) + strlen(path) + 1;
char *message = g_new(char, len);
g_snprintf(message, len, "%s%s", msg, path);
notification_send("Swappy", message);
g_free(message);
}

void pixbuf_save_state_to_folder(GdkPixbuf *pixbuf, char *folder,
Expand Down

0 comments on commit 1bb534f

Please sign in to comment.