Compare commits

..

2 Commits

Author SHA1 Message Date
Sem
06477003e0 add switching random wallpaper every 60 seconds and base for matugen 2026-03-29 22:36:31 +02:00
Sem
53bdb29c8c add basic matugen config 2026-03-29 21:47:27 +02:00
4 changed files with 189 additions and 9 deletions

View File

@@ -41,12 +41,10 @@ $programs = rofi -show drun
# exec-once = nm-applet & # exec-once = nm-applet &
# exec-once = waybar & hyprpaper & firefox # exec-once = waybar & hyprpaper & firefox
# authentication exec-once = /usr/lib/hyprpolkitagent/hyprpolkitagent # authentication
exec-once = /usr/lib/hyprpolkitagent/hyprpolkitagent exec-once = /usr/bin/qs & # quickshell
# quickshell # exec-once = hyprpaper # wallpaper
exec-once = /usr/bin/qs & exec-once = awww-daemon # wallpaper
# wallpaper
exec-once = hyprpaper
############################# #############################
### ENVIRONMENT VARIABLES ### ### ENVIRONMENT VARIABLES ###
############################# #############################

124
matugen/config.toml Normal file
View File

@@ -0,0 +1,124 @@
[config]
# If set to enabled, it will check for updates when you run the matugen command, notifying you that an update is avaiable.
# WARNING: Matugen needs to be compiled with the `update-informer` feature for this to work.
version_check = false
# The color which should be used as the source_color if no good color was found from an image.
# Can be defined in any css format.
# The cli flag will override this if used.
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 = "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>
# Linux: $XDG_CACHE_HOME/matugen/<file> or $HOME/.cache/matugen/images/<file>
# MacOS: $HOME/Library/Caches/matugen/images/<file>
# The file follows this naming: <image_name>.<image_extension>.<image_hash>.json
# For example: testimage.png.0cfd2d624b3d09bf6246b7be9ca79e207e7aa1189d961d44949628b99811bb9d.json
# You can modify the cache and it will then be loaded when using the same image.
# The colors are defined using the #RRGGBBAA format.
caching = false
# Changing the syntax
# Expr is for keywords like {{ <keyword> }}
expr_prefix = "{{"
expr_postfix = "}}"
# Block is for stuff like for loops etc.
block_prefix = "<*"
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"]
# Defaults to the contrast from CLI if unspecified.
# Value from -1 to 1.
# -1 represents minimum contrast, 0 represents standard (i.e. the design as spec'd),
# and 1 represents maximum contrast.
contrast = 1.0
[config.wallpaper]
# Whether to set the wallpaper or not
set = true
# The base command to run for applying the wallpaper.
# Keywords like {{ image }} or anything that works inside of hooks works here.
# You could also set a static color if you use the color keywords and the wallpaper setter supports it.
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.
# output_path = "./a/include.txt"
[templates.name1]
# Relative paths will be resolved from the path `config.toml` is in.
input_path = "./colors.whatever-extension"
output_path = "./a/colors-generated.whatever-extension"
# Defaults to a value of 0 if unspecified, determines the order that each template is processed.
# You can use index = n to force a particular template hook to run after everything else, and index = -n for before everything else
index = 1
# Defaults to the type from CLI if unspecified.
# One of `SchemeContent`, `SchemeExpressive`, `SchemeFidelity`, `SchemeFruitSalad`, `SchemeMonochrome`, `SchemeNeutral`, `SchemeRainbow`, `SchemeTonalSpot`, `SchemeVibrant`
type = "SchemeExpressive"
# For testing of the `--continue-on-error` flag
# [templates.ishoulderror]
# Relative paths will be resolved from the path `config.toml` is in.
# input_path = "./error-testing.txt"
# output_path = "./a/error-testing.txt"
# This will use a different input path depending on what mode you use.
# input_path_modes = { dark = "./colors.whatever-extension", light = "./colors.whatever-extension" }
# This will compare all of the colors inside the array with the color you set as `compare_to`, and returns the closest color to it.
# You can then use `{{closest_color}}` inside hooks.
colors_to_compare = [
{ name = "black", color = "#000000" },
{ name = "red", color = "#ff0000" },
{ name = "maroon", color = "#800000" },
{ name = "yellow", color = "#ffff00" },
{ name = "olive", color = "#808000" },
{ name = "lime", color = "#00ff00" },
{ name = "green", color = "#008000" },
{ name = "aqua", color = "#00ffff" },
{ name = "teal", color = "#008080" },
{ name = "blue", color = "#0000ff" },
{ name = "navy", color = "#000080" },
{ name = "fuchsia", color = "#ff00ff" },
{ name = "purple", color = "#800080" },
]
compare_to = "{{colors.primary.default.hex}}"
# Runs before the template is exported. You can use keywords here.
# If you want the command to be async, add an & symbol to the end of the command on unix.
pre_hook = 'echo "source color {{colors.source_color.default.hex}}, source image {{image}}, closest color {{closest_color}}"'
# Runs after the template is exported. You can use keywords here.
# If you want the command to be async, add an & symbol to the end of the command on unix.
post_hook = 'echo "after gen"'
# For overriding the prefix for a specific template only
expr_prefix = "{{"
expr_postfix = "}}"
# Only hex values
# 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 }}`

View 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
}
}

View File

@@ -5,6 +5,8 @@ import Quickshell.Io
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import "."
// qmllint disable uncreatable-type // qmllint disable uncreatable-type
PanelWindow { PanelWindow {
id: root id: root
@@ -18,6 +20,8 @@ PanelWindow {
property var lastCpuIdle: 0 property var lastCpuIdle: 0
property var lastCpuTotal: 0 property var lastCpuTotal: 0
RandomWallpaper {}
Process { Process {
id: cpuProc id: cpuProc
// get cpu usage, first line of /proc/stat // get cpu usage, first line of /proc/stat
@@ -25,7 +29,6 @@ PanelWindow {
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {
var line = this.text.split(/\r?\n/)[1].split(" "); var line = this.text.split(/\r?\n/)[1].split(" ");
console.log("the line is " + line);
var user = parseInt(line[1]); var user = parseInt(line[1]);
var nice = parseInt(line[2]); var nice = parseInt(line[2]);
@@ -45,8 +48,6 @@ PanelWindow {
root.cpuUsage = Math.round(100 * (1 - diffIdle / diffTotal)); root.cpuUsage = Math.round(100 * (1 - diffIdle / diffTotal));
} }
console.log("diffTotal is " + diffTotal);
root.lastCpuIdle = idleAll; root.lastCpuIdle = idleAll;
root.lastCpuTotal = total; root.lastCpuTotal = total;
} }