add switching random wallpaper every 60 seconds and base for matugen
This commit is contained in:
@@ -41,12 +41,10 @@ $programs = rofi -show drun
|
||||
# exec-once = nm-applet &
|
||||
# exec-once = waybar & hyprpaper & firefox
|
||||
|
||||
# authentication
|
||||
exec-once = /usr/lib/hyprpolkitagent/hyprpolkitagent
|
||||
# quickshell
|
||||
exec-once = /usr/bin/qs &
|
||||
# wallpaper
|
||||
exec-once = hyprpaper
|
||||
exec-once = /usr/lib/hyprpolkitagent/hyprpolkitagent # authentication
|
||||
exec-once = /usr/bin/qs & # quickshell
|
||||
# exec-once = hyprpaper # wallpaper
|
||||
exec-once = awww-daemon # wallpaper
|
||||
#############################
|
||||
### ENVIRONMENT VARIABLES ###
|
||||
#############################
|
||||
|
||||
@@ -11,7 +11,7 @@ fallback_color = "#ffbf9b"
|
||||
# Which color to choose if multiple good colors were found from an image.
|
||||
# choices: [darkness, lightness, saturation, less-saturation, value, closest-to-fallback]
|
||||
# The cli flag will override this if used.
|
||||
prefer = "closest-to-fallback"
|
||||
prefer = "value"
|
||||
|
||||
# Enables caching which will cache the colorscheme, custom colors, etc. into a cache folder located in
|
||||
# Windows: C:\Users\user\AppData\Roaming\InioX\matugen\cache\images\<file>
|
||||
@@ -34,7 +34,7 @@ block_postfix = "*>"
|
||||
|
||||
# Imports json files just like `--import-json` does.
|
||||
# Relative paths will be resolved from the path `config.toml` is in.
|
||||
import_json_files = ["./custom3.json"]
|
||||
# import_json_files = ["./custom3.json"]
|
||||
|
||||
# Defaults to the contrast from CLI if unspecified.
|
||||
# Value from -1 to 1.
|
||||
@@ -54,6 +54,13 @@ command = "swww img --transition-type center {{ image }}"
|
||||
# For example, killing the wallpaper daemon. Usage is like a normal hook.
|
||||
# pre_hook = ""
|
||||
|
||||
# If you don't want to use the other colors that are automatically generated (on_color, on_color_container) you can just import a custom json with the colors instead.
|
||||
# For an example of importing json see: https://iniox.github.io/#matugen/usage/importing-json
|
||||
[config.custom_colors]
|
||||
red = "#ff0000"
|
||||
blue = "#0000ff"
|
||||
green = "#00ff00"
|
||||
|
||||
[templates.includeme]
|
||||
input_path = "./include.txt"
|
||||
# The output path is optional if you just want to import the template anyways.
|
||||
@@ -115,10 +122,3 @@ expr_postfix = "}}"
|
||||
# https://m3.material.io/styles/color/advanced/adjust-existing-colors#1cc12e43-237b-45b9-8fe0-9a3549c1f61e
|
||||
# If you want to use the original color without any harmonization, add `_source` after the name like: `{{ color_source }}`
|
||||
# Example: To use the original red color you would use `{{ red_source }}` instead of `{{ red }}`
|
||||
|
||||
# If you don't want to use the other colors that are automatically generated (on_color, on_color_container) you can just import a custom json with the colors instead.
|
||||
# For an example of importing json see: https://iniox.github.io/#matugen/usage/importing-json
|
||||
[config.custom_colors]
|
||||
red = "#ff0000"
|
||||
blue = "#0000ff"
|
||||
green = "#00ff00"
|
||||
57
quickshell/RandomWallpaper.qml
Normal file
57
quickshell/RandomWallpaper.qml
Normal file
@@ -0,0 +1,57 @@
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
id: wallpaperHolder
|
||||
|
||||
// Store all wallpapers
|
||||
property var wallpapers: []
|
||||
property string wallpaperDir: Qt.resolvedUrl("file:///home/sem/Pictures/wallpapers")
|
||||
|
||||
// process to run the command to change the wallpaper
|
||||
Process {
|
||||
id: wallpaperProcess
|
||||
}
|
||||
|
||||
// Load wallpaper list once at startup
|
||||
Process {
|
||||
id: loadWallpapers
|
||||
command: ["bash", "-c", "find ~/Pictures/wallpapers -type f"]
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
console.log("wallpapers loaded!");
|
||||
wallpaperHolder.wallpapers = this.text.trim().split("\n");
|
||||
wallpaperHolder.setRandomWallpaper();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setRandomWallpaper() {
|
||||
if (wallpapers.length === 0) {
|
||||
console.log("No wallpapers found");
|
||||
return;
|
||||
}
|
||||
|
||||
var index = Math.floor(Math.random() * wallpapers.length);
|
||||
var path = wallpapers[index];
|
||||
|
||||
console.log("wallpaper set to " + path);
|
||||
|
||||
wallpaperProcess.command = ["awww", "img", path, "--transition-type", "grow", "--transition-fps", "60", "--transition-duration", "0.6"];
|
||||
|
||||
wallpaperProcess.running = true;
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 60000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: wallpaperHolder.setRandomWallpaper()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
loadWallpapers.running = true; // start loading wallpapers
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import Quickshell.Io
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
import "."
|
||||
|
||||
// qmllint disable uncreatable-type
|
||||
PanelWindow {
|
||||
id: root
|
||||
@@ -18,6 +20,8 @@ PanelWindow {
|
||||
property var lastCpuIdle: 0
|
||||
property var lastCpuTotal: 0
|
||||
|
||||
RandomWallpaper {}
|
||||
|
||||
Process {
|
||||
id: cpuProc
|
||||
// get cpu usage, first line of /proc/stat
|
||||
@@ -25,7 +29,6 @@ PanelWindow {
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
var line = this.text.split(/\r?\n/)[1].split(" ");
|
||||
console.log("the line is " + line);
|
||||
|
||||
var user = parseInt(line[1]);
|
||||
var nice = parseInt(line[2]);
|
||||
@@ -45,8 +48,6 @@ PanelWindow {
|
||||
root.cpuUsage = Math.round(100 * (1 - diffIdle / diffTotal));
|
||||
}
|
||||
|
||||
console.log("diffTotal is " + diffTotal);
|
||||
|
||||
root.lastCpuIdle = idleAll;
|
||||
root.lastCpuTotal = total;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user