From 745857e51526d42c34ac394877384d4cf6fb6715 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 17 Jun 2025 10:49:11 +0200 Subject: [PATCH] welcome: random wall --- .../scripts/colors/random_konachan_wall.sh | 10 +++++++ .../quickshell/scripts/colors/switchwall.sh | 4 +++ .config/quickshell/welcome.qml | 29 +++++++++++++++++-- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100755 .config/quickshell/scripts/colors/random_konachan_wall.sh diff --git a/.config/quickshell/scripts/colors/random_konachan_wall.sh b/.config/quickshell/scripts/colors/random_konachan_wall.sh new file mode 100755 index 000000000..52853d090 --- /dev/null +++ b/.config/quickshell/scripts/colors/random_konachan_wall.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +mkdir -p ~/Pictures/Wallpapers +page=$((1 + RANDOM % 1000)); +response=$(curl "https://konachan.com/post.json?tags=rating%3Asafe&limit=1&page=$page") +link=$(echo "$response" | jq '.[0].file_url' -r); +ext=$(echo "$link" | awk -F. '{print $NF}') +downloadPath="$HOME/Pictures/Wallpapers/konachan_random_image.$ext" +curl "$link" -o "$downloadPath" +~/.config/quickshell/scripts/colors/switchwall.sh --image "$downloadPath" diff --git a/.config/quickshell/scripts/colors/switchwall.sh b/.config/quickshell/scripts/colors/switchwall.sh index 4136772f2..0a633e242 100755 --- a/.config/quickshell/scripts/colors/switchwall.sh +++ b/.config/quickshell/scripts/colors/switchwall.sh @@ -291,6 +291,10 @@ main() { shift fi ;; + --image) + imgpath="$2" + shift 2 + ;; --noswitch) noswitch_flag="1" imgpath=$(swww query | awk -F 'image: ' '{print $2}') diff --git a/.config/quickshell/welcome.qml b/.config/quickshell/welcome.qml index 9d1dcd494..27a68f608 100644 --- a/.config/quickshell/welcome.qml +++ b/.config/quickshell/welcome.qml @@ -11,6 +11,7 @@ import QtQuick.Controls import QtQuick.Layouts import QtQuick.Window import Quickshell +import Quickshell.Io import Quickshell.Hyprland import "root:/services/" import "root:/modules/common/" @@ -40,6 +41,18 @@ ApplicationWindow { height: 600 color: Appearance.m3colors.m3background + Process { + id: konachanWallProc + property string status: "" + command: ["bash", "-c", FileUtils.trimFileProtocol(`${Directories.config}/quickshell/scripts/colors/random_konachan_wall.sh`)] + stdout: SplitParser { + onRead: data => { + console.log(`Konachan wall proc output: ${data}`); + konachanWallProc.status = data.trim(); + } + } + } + component Section: ColumnLayout { id: sectionRoot property string title @@ -235,7 +248,7 @@ ApplicationWindow { id: welcomeText anchors.centerIn: parent color: Appearance.colors.colOnLayer0 - text: "Welcome" + text: "Yooooo hi there" font.pixelSize: Appearance.font.pixelSize.hugeass font.family: Appearance.font.family.title } @@ -304,6 +317,18 @@ ApplicationWindow { dark: true } } + + ButtonWithIcon { + id: rndWallBtn + Layout.alignment: Qt.AlignHCenter + buttonRadius: Appearance.rounding.small + iconText: "ifl" + mainText: konachanWallProc.running ? "Be patient..." : "Random SFW Konachan wallpaper" + onClicked: { + console.log(konachanWallProc.command.join(" ")) + konachanWallProc.running = true; + } + } } Section { @@ -323,7 +348,7 @@ ApplicationWindow { spacing: 10 StyledText { font.pixelSize: Appearance.font.pixelSize.small - text: "Open keybind cheatsheet" + text: "Keybinds" color: Appearance.colors.colOnSecondaryContainer } RowLayout {