aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rwxr-xr-xbuild.sh10
m---------depends/mglpp0
-rw-r--r--gpu-screen-recorder-overlay-daemon/main.c5
-rw-r--r--gpu-screen-recorder-overlay-daemon/project.conf3
-rwxr-xr-xinstall.sh13
-rw-r--r--meson.build43
-rw-r--r--project.conf4
-rw-r--r--src/main.cpp35
-rwxr-xr-xuninstall.sh10
10 files changed, 98 insertions, 33 deletions
diff --git a/README.md b/README.md
index af4c7bc..cf3328c 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,8 @@
# GPU Screen Recorder Overlay
-A fullscreen overlay UI for [GPU Screen Recorder](https://git.dec05eba.com/gpu-screen-recorder/about/), in the style of NVIDIA ShadowPlay. \ No newline at end of file
+A fullscreen overlay UI for [GPU Screen Recorder](https://git.dec05eba.com/gpu-screen-recorder/about/), in the style of NVIDIA ShadowPlay.
+
+# Dependencies
+x11, xrandr, xrender, xfixes, opengl
+
+# Installation
+Run `sudo ./install.sh`. This will install gsr-overlay to `/usr/bin/gsr-overlay`. You can run meson commands manually to install gsr-overlay to another directory. \ No newline at end of file
diff --git a/build.sh b/build.sh
deleted file mode 100755
index 73911f5..0000000
--- a/build.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-[ $# -ne 1 ] && echo "usage: build.sh debug|release" && exit 1
-
-script_dir=$(dirname "$0")
-cd "$script_dir"
-
-sibs build --"$1" gpu-screen-recorder-overlay-daemon
-sibs build --"$1"
-echo "Successfully built"
diff --git a/depends/mglpp b/depends/mglpp
-Subproject 73757cb8168be698d8d702d357490dc081d353d
+Subproject 212ca50d0fe55a658528f190b679142206ac2a0
diff --git a/gpu-screen-recorder-overlay-daemon/main.c b/gpu-screen-recorder-overlay-daemon/main.c
index ff510c0..53ca5ec 100644
--- a/gpu-screen-recorder-overlay-daemon/main.c
+++ b/gpu-screen-recorder-overlay-daemon/main.c
@@ -101,10 +101,7 @@ int main(void) {
if(overlay_pid == -1) {
fprintf(stderr, "launch overlay\n");
// TODO: window_with_input_focus
- const char *args[] = {
- "/home/dec05eba/git/gpu-screen-recorder-overlay/sibs-build/linux_x86_64/debug/gpu-screen-recorder-overlay",
- NULL
- };
+ const char *args[] = { "gsr-overlay", NULL };
exec_program(args, &overlay_pid);
}
}
diff --git a/gpu-screen-recorder-overlay-daemon/project.conf b/gpu-screen-recorder-overlay-daemon/project.conf
index 456b41b..758d50c 100644
--- a/gpu-screen-recorder-overlay-daemon/project.conf
+++ b/gpu-screen-recorder-overlay-daemon/project.conf
@@ -4,5 +4,8 @@ type = "executable"
version = "0.1.0"
platforms = ["posix"]
+[config]
+ignore_dirs = ["build"]
+
[dependencies]
x11 = ">=1"
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..a3b239a
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,13 @@
+#!/bin/sh -e
+
+script_dir=$(dirname "$0")
+cd "$script_dir"
+
+[ $(id -u) -ne 0 ] && echo "You need root privileges to run the install script" && exit 1
+
+rm -rf build
+meson setup build
+meson configure --prefix=/usr --buildtype=release -Dstrip=true build
+ninja -C build install
+
+echo "Successfully installed gsr-overlay"
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..59a02e3
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,43 @@
+project('gsr-overlay', ['cpp'], version : '1.0.0', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends')
+
+if get_option('buildtype') == 'debug'
+ add_project_arguments('-g3', language : ['cpp'])
+elif get_option('buildtype') == 'release'
+ add_project_arguments('-DNDEBUG', language : ['cpp'])
+endif
+
+src = [
+ 'src/Theme.cpp',
+ 'src/gui/ScrollablePage.cpp',
+ 'src/gui/Button.cpp',
+ 'src/gui/Entry.cpp',
+ 'src/gui/ComboBox.cpp',
+ 'src/gui/Page.cpp',
+ 'src/gui/StaticPage.cpp',
+ 'src/gui/Widget.cpp',
+ 'src/gui/List.cpp',
+ 'src/gui/Utils.cpp',
+ 'src/gui/DropdownButton.cpp',
+ 'src/gui/Label.cpp',
+ 'src/GsrInfo.cpp',
+ 'src/Process.cpp',
+ 'src/main.cpp',
+]
+
+mglpp_proj = subproject('mglpp')
+mglpp_dep = mglpp_proj.get_variable('mglpp_dep')
+
+dep = [
+ mglpp_dep,
+]
+
+executable(
+ meson.project_name(),
+ src,
+ install : true,
+ dependencies : dep,
+)
+
+prefix = get_option('prefix')
+datadir = get_option('datadir')
+install_subdir('images', install_dir : join_paths(prefix, datadir, 'gsr-overlay')) \ No newline at end of file
diff --git a/project.conf b/project.conf
index 9234dd4..d1d3a65 100644
--- a/project.conf
+++ b/project.conf
@@ -1,5 +1,5 @@
[package]
-name = "gpu-screen-recorder-overlay"
+name = "gsr-overlay"
type = "executable"
version = "0.1.0"
platforms = ["posix"]
@@ -8,4 +8,4 @@ platforms = ["posix"]
version = "c++17"
[config]
-ignore_dirs = ["gpu-screen-recorder-overlay-daemon"] \ No newline at end of file
+ignore_dirs = ["build", "gpu-screen-recorder-overlay-daemon"] \ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
index 636d3a2..2c41f9e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -383,10 +383,11 @@ int main(int argc, char **argv) {
gsr::init_theme(gsr_info);
- std::string program_root_dir = dirname(argv[0]);
- if(!program_root_dir.empty() && program_root_dir.back() != '/')
- program_root_dir += '/';
- program_root_dir += "../../../";
+ std::string project_dir;
+ if(access("images/gpu_screen_recorder_logo.png", F_OK) == 0)
+ project_dir = "./";
+ else
+ project_dir = "/usr/share/gsr-overlay/";
mgl::Init init;
Display *display = (Display*)mgl_get_context()->connection;
@@ -432,26 +433,26 @@ int main(int argc, char **argv) {
mgl::Font top_bar_font;
if(!top_bar_font.load_from_file(title_font_file, window_create_params.size.y * 0.03f))
- startup_error("failed to load font: fonts/Orbitron-Bold.ttf");
+ startup_error("failed to load font: fonts/NotoSans-Bold.ttf");
mgl::Font title_font;
if(!title_font.load_from_file(title_font_file, window_create_params.size.y * 0.019f))
- startup_error("failed to load font: fonts/Orbitron-Bold.ttf");
+ startup_error("failed to load font: fonts/NotoSans-Regular.ttf");
mgl::Font font;
if(!font.load_from_file(font_file, window_create_params.size.y * 0.015f))
- startup_error("failed to load font: fonts/Orbitron-Regular.ttf");
+ startup_error("failed to load font: fonts/NotoSans-Regular.ttf");
mgl::Texture replay_button_texture;
- if(!replay_button_texture.load_from_file((program_root_dir + "images/replay.png").c_str()))
+ if(!replay_button_texture.load_from_file((project_dir + "images/replay.png").c_str()))
startup_error("failed to load texture: images/replay.png");
mgl::Texture record_button_texture;
- if(!record_button_texture.load_from_file((program_root_dir + "images/record.png").c_str()))
+ if(!record_button_texture.load_from_file((project_dir + "images/record.png").c_str()))
startup_error("failed to load texture: images/record.png");
mgl::Texture stream_button_texture;
- if(!stream_button_texture.load_from_file((program_root_dir + "images/stream.png").c_str()))
+ if(!stream_button_texture.load_from_file((project_dir + "images/stream.png").c_str()))
startup_error("failed to load texture: images/stream.png");
// TODO: Get size from monitor, get region specific to the monitor
@@ -642,9 +643,10 @@ int main(int argc, char **argv) {
main_buttons[1].button->set_item_label(id, "Start");
// TODO: Show this with a slight delay to make sure it doesn't show up in the video
+ const std::string record_image_filepath = project_dir + "images/record.png";
const char *notification_args[] = {
- "gpu-screen-recorder-notification", "--text", "Recording has been saved", "--timeout", "3.0",
- "--icon", "./images/record.png",
+ "gsr-notify", "--text", "Recording has been saved", "--timeout", "3.0",
+ "--icon", record_image_filepath.c_str(),
"--icon-color", "ffffff", "--bg-color", tint_color_as_hex.c_str(),
nullptr
};
@@ -677,9 +679,10 @@ int main(int argc, char **argv) {
// TODO: Do not run this is a daemon. Instead get the pid and when launching another notification close the current notification
// program and start another one. This can also be used to check when the notification has finished by checking with waitpid NOWAIT
// to see when the program has exit.
+ const std::string record_image_filepath = project_dir + "images/record.png";
const char *notification_args[] = {
- "gpu-screen-recorder-notification", "--text", "Recording has started", "--timeout", "3.0",
- "--icon", "./images/record.png",
+ "gsr-notify", "--text", "Recording has started", "--timeout", "3.0",
+ "--icon", record_image_filepath.c_str(),
"--icon-color", tint_color_as_hex.c_str(), "--bg-color", tint_color_as_hex.c_str(),
nullptr
};
@@ -757,7 +760,7 @@ int main(int argc, char **argv) {
}
mgl::Texture close_texture;
- if(!close_texture.load_from_file("images/cross.png"))
+ if(!close_texture.load_from_file((project_dir + "images/cross.png").c_str()))
startup_error("failed to load texture: images/cross.png");
mgl::Sprite close_sprite(&close_texture);
@@ -765,7 +768,7 @@ int main(int argc, char **argv) {
close_sprite.set_position(mgl::vec2f(window.get_size().x - close_sprite.get_size().x - 50.0f, top_bar_background.get_size().y * 0.5f - close_sprite.get_size().y * 0.5f).floor());
mgl::Texture logo_texture;
- if(!logo_texture.load_from_file("images/gpu_screen_recorder_logo.png"))
+ if(!logo_texture.load_from_file((project_dir + "images/gpu_screen_recorder_logo.png").c_str()))
startup_error("failed to load texture: images/gpu_screen_recorder_logo.png");
mgl::Sprite logo_sprite(&logo_texture);
diff --git a/uninstall.sh b/uninstall.sh
new file mode 100755
index 0000000..208c2b3
--- /dev/null
+++ b/uninstall.sh
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+
+script_dir=$(dirname "$0")
+cd "$script_dir"
+
+[ $(id -u) -ne 0 ] && echo "You need root privileges to run the uninstall script" && exit 1
+
+ninja -C build uninstall
+
+echo "Successfully uninstalled gsr-overlay"