Commit Graph

7 Commits

Author SHA1 Message Date
Tracker-Friendly 94d127dc5e Update themeswitcher.c 2024-01-16 20:13:59 +00:00
Tracker-Friendly 82927ed2c0 Merge pull request 'Refactor theme switcher to use GSubprocess and streamline GSettings usage' (#1) from scriptod/dconf-theme-switcher:main into main
Reviewed-on: https://centrifuge.hectabit.org/HectaBit/dconf-theme-switcher/pulls/1
2024-01-16 13:33:58 +00:00
scriptod 94015a33cb Refactor theme switcher to use GSubprocess and streamline GSettings usage
I've replaced the system() calls with GSubprocess to improve security and control, using GSubprocess is more secure because it avoids shell interpolation risks that can occur with system() calls. This <------ means there's less chance of injection attacks where arbitrary commands could be executed. It also gives us better control over the execution environment, including file descriptor inheritance and signal handling, making it a more robust solution for managing child processes

I've added error handling for subprocess calls to ensure we get clear feedback if there are issues starting or stopping the wf-panel process, this is the (the) way, if a subprocess fails to launch or if there's a problem sending it signals, we'll know exactly what went wrong.

By combining the theme switching into a single function, I've reduced code duplication his makes the "codebase" cleaner and easier to maintain since any changes to theme switching only need to be made in one place.

I've eliminated redundant GSettings object creation by reusing the same GSettings objects where possible, which makes the code more efficient.

Darling, lastly I ensured that unused parameters in signal handler functions are explicitly cast to (void) to avoid compiler warnings about unused parameters, this clearly keeps the code tidy and warning-free beautiful.
2024-01-13 09:50:40 +00:00
Tracker-Friendly 73ddbb43e0 Update README.md 2023-12-20 11:10:02 +00:00
Tracker-Friendly 7b1d46ff44 Whopps 2023-07-25 00:54:12 +01:00
Tracker-Friendly 382e2448cd Init 2023-07-25 00:50:55 +01:00
Tracker-Friendly 22444c27c8
Initial commit 2023-07-24 23:52:00 +00:00