chore: better error reporting for parameters, highlighting --help usage. fixess #303 and should improve #275
Some checks failed
CMake / build-x11 (ubuntu-22.04) (push) Has been cancelled
CMake / build-x11 (ubuntu-24.04) (push) Has been cancelled
CMake / build-x11-wayland (ubuntu-22.04) (push) Has been cancelled
CMake / build-x11-wayland (ubuntu-24.04) (push) Has been cancelled
CMake / build-wayland (ubuntu-22.04) (push) Has been cancelled
CMake / build-wayland (ubuntu-24.04) (push) Has been cancelled

This commit is contained in:
Almamu 2025-05-17 03:23:05 +02:00
parent 3c334aac29
commit be0fc25e72
9 changed files with 270 additions and 106 deletions

View File

@ -1,31 +0,0 @@
---
name: Background doesn't load properly
about: Use this to report backgrounds that are not loading (cannot find files, black
image, effects not working, etc)
title: "[BGFIX]"
labels: bug
assignees: Almamu
---
**Wallpaper Engine Background(s)**
Link(s) to the background(s) in the steam workshop or their background ID(s).
**Console output**
When a background cannot be loaded, it's usually due to some unexpected error that is logged into the terminal. Please attach the program's output so we can properly debug it if needed.
**Screenshots**
If you have any screenshot of it working on Windows that'll help so we can compare both outputs
**Desktop (please complete the following information):**
- OS: [e.g. Arch Linux]
- Desktop Environment: [e.g. GNOME, CINNAMON, KDE...]
- Window Manager: [if in doubt, just leave it empty]
**Additional context**
Any additional information about your setup

58
.github/ISSUE_TEMPLATE/bug-report.yml vendored Normal file
View File

@ -0,0 +1,58 @@
name: "Bug Report"
description: "Report a bug or unexpected behavior."
labels: [bug]
body:
- type: markdown
attributes:
value: |
Please fill out this form to report a bug.
- type: input
id: summary
attributes:
label: Bug Summary
description: Briefly describe the bug.
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to Reproduce
description: Step-by-step instructions to reproduce the bug.
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Behavior
validations:
required: false
- type: textarea
id: actual
attributes:
label: Actual Behavior / Logs
validations:
required: false
- type: input
id: os
attributes:
label: Operating System and Version
validations:
required: true
- type: input
id: de
attributes:
label: Desktop Environment (GNOME, KDE, etc.)
validations:
required: true
- type: input
id: x11_wayland
attributes:
label: Display Server (X11/Wayland)
validations:
required: true
- type: textarea
id: extra
attributes:
label: Additional Context or Screenshots
validations:
required: false

View File

@ -0,0 +1,46 @@
name: "Wallpaper Compatibility Issue"
description: "Report a problem with a specific Wallpaper Engine wallpaper."
labels: [compatibility, wallpaper]
body:
- type: input
id: wallpaper
attributes:
label: Wallpaper Name, URL or ID
validations:
required: true
- type: textarea
id: issue
attributes:
label: Describe the Issue
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Behavior
validations:
required: false
- type: textarea
id: logs
attributes:
label: Logs or Crash Output
validations:
required: false
- type: input
id: os
attributes:
label: Operating System and Version
validations:
required: true
- type: input
id: de
attributes:
label: Desktop Environment (GNOME, KDE, etc.)
validations:
required: true
- type: input
id: x11_wayland
attributes:
label: Display Server (X11/Wayland)
validations:
required: true

View File

@ -0,0 +1,32 @@
name: "Feature Request"
description: "Propose a new feature or enhancement."
labels: [enhancement]
body:
- type: markdown
attributes:
value: |
Use this form to suggest new features or improvements.
- type: textarea
id: feature
attributes:
label: Describe the Feature
validations:
required: true
- type: textarea
id: problem
attributes:
label: Problem this Feature Addresses (if any)
validations:
required: false
- type: textarea
id: alternatives
attributes:
label: Alternatives Considered
validations:
required: false
- type: textarea
id: context
attributes:
label: Additional Context or Mockups
validations:
required: false

View File

@ -0,0 +1,38 @@
name: "Installation/Usage Help"
description: "Request help with installing or using linux-wallpaperengine."
labels: [question, support]
body:
- type: markdown
attributes:
value: |
Need help? Fill this out so we can assist you better.
- type: textarea
id: issue
attributes:
label: What are you trying to do, and what's the problem?
validations:
required: true
- type: textarea
id: attempted
attributes:
label: What have you tried so far?
validations:
required: false
- type: textarea
id: error_logs
attributes:
label: Errors or Log Output
validations:
required: false
- type: input
id: system
attributes:
label: OS, Desktop Environment, X11/Wayland
validations:
required: true
- type: input
id: install_method
attributes:
label: Installation Method (e.g., AUR, Flatpak, build from source)
validations:
required: true

View File

@ -1,10 +0,0 @@
---
name: Other issues
about: Use this to report general issues with the software
title: ''
labels: ''
assignees: Almamu
---

22
.github/ISSUE_TEMPLATE/refactor.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: "Code Cleanup / Refactor"
description: "Suggest internal improvements like refactoring or technical debt cleanup."
labels: [refactor, maintenance]
body:
- type: textarea
id: what
attributes:
label: What needs improvement?
validations:
required: true
- type: textarea
id: why
attributes:
label: Why is this necessary or beneficial?
validations:
required: false
- type: textarea
id: impact
attributes:
label: Potential Impact on Users
validations:
required: false

View File

@ -255,44 +255,48 @@ CApplicationContext::CApplicationContext (int argc, char* argv []) :
" Runs the background 2317494988 on two screens, one on HDMI-1 and the other on HDMI-2\n\n" " Runs the background 2317494988 on two screens, one on HDMI-1 and the other on HDMI-2\n\n"
); );
program.parse_known_args (argc, argv); try {
program.parse_known_args (argc, argv);
if (this->settings.general.defaultBackground.empty ()) { if (this->settings.general.defaultBackground.empty ()) {
throw std::runtime_error ("No default background specified. Either --bg/-b or <background id> must be specified"); throw std::runtime_error ("At least one background ID must be specified");
} }
this->settings.audio.volume = std::max(0, std::min (this->settings.audio.volume, 128)); this->settings.audio.volume = std::max(0, std::min (this->settings.audio.volume, 128));
this->settings.screenshot.delay = std::max (0, std::min (this->settings.screenshot.delay, 5)); this->settings.screenshot.delay = std::max (0, std::min (this->settings.screenshot.delay, 5));
// use std::cout on this in case logging is disabled, this way it's easy to look at what is running // use std::cout on this in case logging is disabled, this way it's easy to look at what is running
std::stringbuf buffer; std::stringbuf buffer;
std::ostream bufferStream (&buffer); std::ostream bufferStream (&buffer);
bufferStream << "Running with: "; bufferStream << "Running with: ";
for (int i = 0; i < argc; i ++) { for (int i = 0; i < argc; i ++) {
bufferStream << argv [i]; bufferStream << argv [i];
bufferStream << " "; bufferStream << " ";
} }
std::cout << buffer.str() << std::endl; std::cout << buffer.str() << std::endl;
// perform some extra validation on the inputs // perform some extra validation on the inputs
this->validateAssets (); this->validateAssets ();
this->validateScreenshot (); this->validateScreenshot ();
// setup application state // setup application state
this->state.general.keepRunning = true; this->state.general.keepRunning = true;
this->state.audio.enabled = this->settings.audio.enabled; this->state.audio.enabled = this->settings.audio.enabled;
this->state.audio.volume = this->settings.audio.volume; this->state.audio.volume = this->settings.audio.volume;
this->state.mouse.enabled = this->settings.mouse.enabled; this->state.mouse.enabled = this->settings.mouse.enabled;
#if DEMOMODE #if DEMOMODE
sLog.error ("WARNING: RUNNING IN DEMO MODE WILL STOP WALLPAPERS AFTER 5 SECONDS SO VIDEO CAN BE RECORDED"); sLog.error ("WARNING: RUNNING IN DEMO MODE WILL STOP WALLPAPERS AFTER 5 SECONDS SO VIDEO CAN BE RECORDED");
// special settings for demomode // special settings for demomode
this->settings.render.maximumFPS = 30; this->settings.render.maximumFPS = 30;
this->settings.screenshot.take = false; this->settings.screenshot.take = false;
this->settings.render.pauseOnFullscreen = false; this->settings.render.pauseOnFullscreen = false;
#endif /* DEMOMODE */ #endif /* DEMOMODE */
} catch (const std::runtime_error& e) {
throw std::runtime_error (std::string (e.what()) + ". Use " + std::string (argv[0]) + " --help for more information");
}
} }
int CApplicationContext::getArgc () const { int CApplicationContext::getArgc () const {

View File

@ -20,47 +20,52 @@ void initLogging () {
} }
int main (int argc, char* argv[]) { int main (int argc, char* argv[]) {
// if type parameter is specified, this is a subprocess, so no logging should be enabled from our side try {
bool enableLogging = true; // if type parameter is specified, this is a subprocess, so no logging should be enabled from our side
std::string typeZygote = "--type=zygote"; bool enableLogging = true;
std::string typeUtility = "--type=utility"; std::string typeZygote = "--type=zygote";
std::string typeUtility = "--type=utility";
for (int i = 1; i < argc; i ++) { for (int i = 1; i < argc; i ++) {
if (strncmp (typeZygote.c_str(), argv[i], typeZygote.size()) == 0) { if (strncmp (typeZygote.c_str(), argv[i], typeZygote.size()) == 0) {
enableLogging = false; enableLogging = false;
break; break;
} else if (strncmp (typeUtility.c_str(), argv[i], typeUtility.size()) == 0) { } else if (strncmp (typeUtility.c_str(), argv[i], typeUtility.size()) == 0) {
enableLogging = false; enableLogging = false;
break; break;
}
} }
}
if (enableLogging) { if (enableLogging) {
initLogging (); initLogging ();
} }
WallpaperEngine::Application::CApplicationContext appContext (argc, argv); WallpaperEngine::Application::CApplicationContext appContext (argc, argv);
// halt if the list-properties option was specified
if (appContext.settings.general.onlyListProperties)
return 0;
app = new WallpaperEngine::Application::CWallpaperApplication (appContext);
// attach signals to gracefully stop
std::signal (SIGINT, signalhandler);
std::signal (SIGTERM, signalhandler);
std::signal (SIGKILL, signalhandler);
// show the wallpaper application
app->show ();
// remove signal handlers before destroying app
std::signal (SIGINT, SIG_DFL);
std::signal (SIGTERM, SIG_DFL);
std::signal (SIGKILL, SIG_DFL);
delete app;
// halt if the list-properties option was specified
if (appContext.settings.general.onlyListProperties)
return 0; return 0;
} catch (const std::exception& e) {
app = new WallpaperEngine::Application::CWallpaperApplication (appContext); std::cerr << e.what () << std::endl;
return 1;
// attach signals to gracefully stop }
std::signal (SIGINT, signalhandler);
std::signal (SIGTERM, signalhandler);
std::signal (SIGKILL, signalhandler);
// show the wallpaper application
app->show ();
// remove signal handlers before destroying app
std::signal (SIGINT, SIG_DFL);
std::signal (SIGTERM, SIG_DFL);
std::signal (SIGKILL, SIG_DFL);
delete app;
return 0;
} }