diff --git a/README.md b/README.md index b6b7dee..5fafe9f 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,11 @@ It might not be that worthy to write a QtWidget application for such a small fea 2. Clone the repository: ```bash - git clone https://github.com/Uyanide/Wallpaper_Carousel.git --depth 1 + git clone https://github.com/Uyanide/Wallpaper_Carousel.git --depth 1 && \ cd Wallpaper_Carousel ``` -3. Run build script: +3. Run [build script](app/install.sh): ```bash app/install.sh @@ -33,7 +33,7 @@ It might not be that worthy to write a QtWidget application for such a small fea PREFIX=$HOME/.local ./app/install.sh ``` -> [!NOTE] +> [Warning] > > This script will ask for `sudo` permission if the prefix is set to a system directory like `/usr/local`. Please make sure you have read and trust the script before proceeding. @@ -50,3 +50,18 @@ A minimum config should at least contain the path(s) to wallpapers, e.g. } } ``` + +By default, the path of the selected wallpaper will be output to stdout. If you want to apply the selected wallpaper automatically after selection, the `action.confirm` entry should be set, e.g. + +```json +{ + "wallpaper": { + "dirs": ["/path/to/your/wallpapers"] + }, + "action": { + "confirm": "awww img \"%1\"" + } +} +``` + +`action.confirm` should be a executable followed by a couple of arguments, where `%1` will be replaced by the path of the selected wallpaper. diff --git a/src/main.cpp b/src/main.cpp index 619e2f5..642bd8a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,7 @@ /* * @Author: Uyanide pywang0608@foxmail.com * @Date: 2025-08-05 00:37:58 - * @LastEditTime: 2026-01-15 01:00:12 + * @LastEditTime: 2026-01-15 01:43:14 * @Description: Entry point. */ #include @@ -30,26 +30,25 @@ static void setLogLevel(int argc, char* argv[]) { QString arg(argv[i]); if (arg == "--debug" || arg == "-vvv" || arg == "--verbose") { Logger::setLogLevel(QtDebugMsg); - break; + return; } else if (arg == "--info" || arg == "-vv") { Logger::setLogLevel(QtInfoMsg); - break; + return; } else if (arg == "--warn" || arg == "-v") { Logger::setLogLevel(QtWarningMsg); - break; + return; } else if (arg == "--critical") { Logger::setLogLevel(QtCriticalMsg); - break; + return; } else if (arg == "--fatal") { Logger::setLogLevel(QtFatalMsg); - break; + return; } else if (arg == "--quiet") { Logger::quiet(); - break; - } else { - Logger::setLogLevel(QtInfoMsg); + return; } } + Logger::setLogLevel(QtInfoMsg); } int main(int argc, char* argv[]) { diff --git a/src/main_window.cpp b/src/main_window.cpp index ab20ae6..3e8ee52 100644 --- a/src/main_window.cpp +++ b/src/main_window.cpp @@ -1,7 +1,7 @@ /* * @Author: Uyanide pywang0608@foxmail.com * @Date: 2025-08-05 00:37:58 - * @LastEditTime: 2026-01-15 00:47:54 + * @LastEditTime: 2026-01-15 01:40:30 * @Description: MainWindow implementation. */ #include "main_window.h" @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "./ui_main_window.h" @@ -241,6 +242,7 @@ void MainWindow::onConfirm() { return; } info(QString("Selected image: %1").arg(path)); + puts(path.toStdString().c_str()); const auto cmdOrig = m_config.getActionConfig().confirm; if (cmdOrig.isEmpty()) { warn("No action defined for confirmation");