add wallpicker and matugen color gen

This commit is contained in:
lucy 2026-03-11 14:14:04 +01:00
parent 21d13b546f
commit cda910aa40
15 changed files with 139 additions and 81 deletions

22
Colors.qml Normal file
View File

@ -0,0 +1,22 @@
pragma Singleton
import QtQuick
import Quickshell
Singleton {
readonly property color base00: "#011840"
readonly property color base01: "#1e315a"
readonly property color base02: "#3c4b73"
readonly property color base03: "#5a648c"
readonly property color base04: "#777ea5"
readonly property color base05: "#9597be"
readonly property color base06: "#b3b0d7"
readonly property color base07: "#d0caf0"
readonly property color base08: "#2b5b89"
readonly property color base09: "#245382"
readonly property color base0A: "#204c78"
readonly property color base0B: "#396491"
readonly property color base0C: "#2a5780"
readonly property color base0D: "#325d87"
readonly property color base0E: "#19426b"
readonly property color base0F: "#0a315b"
}

View File

@ -1,65 +0,0 @@
pragma ComponentBehavior: Bound
pragma Singleton
import Quickshell
import Quickshell.Io
Singleton {
id: root
property alias colors: loader
function reload() {
loader.reload();
}
FileView {
id: loader
watchChanges: true
onFileChanged: this.reload()
onAdapterUpdated: this.reload()
// create color properties, initialize them to black and helper color array
property var colors: text().split('\n')
property var base00: "#000000"
property var base01: "#000000"
property var base02: "#000000"
property var base03: "#000000"
property var base04: "#000000"
property var base05: "#000000"
property var base06: "#000000"
property var base07: "#000000"
property var base08: "#000000"
property var base09: "#000000"
property var base0A: "#000000"
property var base0B: "#000000"
property var base0C: "#000000"
property var base0D: "#000000"
property var base0E: "#000000"
property var base0F: "#000000"
property bool ready: false
path: "file:///home/lucy/.config/stylix/palette.json"
onLoaded: {
// assign values to colors after the json file has been loaded to avoid errors
base00 = "#" + colors[1].split(':')[1].slice(2, 8);
base01 = "#" + colors[2].split(':')[1].slice(2, 8);
base02 = "#" + colors[3].split(':')[1].slice(2, 8);
base03 = "#" + colors[4].split(':')[1].slice(2, 8);
base04 = "#" + colors[5].split(':')[1].slice(2, 8);
base05 = "#" + colors[6].split(':')[1].slice(2, 8);
base06 = "#" + colors[7].split(':')[1].slice(2, 8);
base07 = "#" + colors[8].split(':')[1].slice(2, 8);
base08 = "#" + colors[9].split(':')[1].slice(2, 8);
base09 = "#" + colors[10].split(':')[1].slice(2, 8);
base0A = "#" + colors[11].split(':')[1].slice(2, 8);
base0B = "#" + colors[12].split(':')[1].slice(2, 8);
base0C = "#" + colors[13].split(':')[1].slice(2, 8);
base0D = "#" + colors[14].split(':')[1].slice(2, 8);
base0E = "#" + colors[15].split(':')[1].slice(2, 8);
base0F = "#" + colors[16].split(':')[1].slice(2, 8);
ready = true;
}
adapter: JsonAdapter {
id: themeAdapter
}
}
}

View File

@ -27,7 +27,7 @@ Variants {
id: bar id: bar
radius: Settings.config.floating ? Settings.config.rounding * 2 : 0 radius: Settings.config.floating ? Settings.config.rounding * 2 : 0
anchors.fill: parent anchors.fill: parent
color: ThemeLoader.colors.base00 color: Colors.base00
RowLayout { RowLayout {
id: left id: left
anchors.leftMargin: Settings.config.floating ? Settings.config.barHeight / 2 - 10: 10 anchors.leftMargin: Settings.config.floating ? Settings.config.barHeight / 2 - 10: 10

View File

@ -6,7 +6,7 @@ import qs.widgets
Rectangle { Rectangle {
id: root id: root
color: ThemeLoader.colors.base01 color: Colors.base01
implicitWidth: clockText.implicitWidth + 14 implicitWidth: clockText.implicitWidth + 14
implicitHeight: Settings.config.barHeight / 2 + 6 implicitHeight: Settings.config.barHeight / 2 + 6
radius: Settings.config.rounding radius: Settings.config.rounding

View File

@ -8,7 +8,7 @@ import qs.widgets
Rectangle { Rectangle {
id: root id: root
color: ThemeLoader.colors.base01 color: Colors.base01
implicitWidth: songLayout.implicitWidth + 14 implicitWidth: songLayout.implicitWidth + 14
implicitHeight: Settings.config.barHeight / 2 + 6 implicitHeight: Settings.config.barHeight / 2 + 6
radius: Settings.config.rounding radius: Settings.config.rounding
@ -17,12 +17,15 @@ Rectangle {
function getSpotify() { function getSpotify() {
for (var i = 0; i < Mpris.players.values.length; i++) { for (var i = 0; i < Mpris.players.values.length; i++) {
if (Mpris.players.values[i].identity == "spotify" || "Spotify") { if (Mpris.players.values[i].identity == "Spotify" || Mpris.players.values[i] == "spotify") {
return Mpris.players.values[i]; return Mpris.players.values[i];
} else {
return null;
} }
} }
return null; return null;
} }
RowLayout { RowLayout {
id: songLayout id: songLayout
anchors.centerIn: parent anchors.centerIn: parent

View File

@ -8,7 +8,7 @@ import qs.widgets
Rectangle { Rectangle {
id: root id: root
color: ThemeLoader.colors.base01 color: Colors.base01
implicitWidth: iconLayout.implicitWidth + 14 implicitWidth: iconLayout.implicitWidth + 14
implicitHeight: Settings.config.barHeight / 2 + 6 implicitHeight: Settings.config.barHeight / 2 + 6
radius: Settings.config.rounding radius: Settings.config.rounding

View File

@ -11,7 +11,7 @@ Rectangle {
property var activeWindow: ToplevelManager.activeToplevel property var activeWindow: ToplevelManager.activeToplevel
property bool active: activeWindow ? activeWindow.activated ? true : false : false property bool active: activeWindow ? activeWindow.activated ? true : false : false
radius: Settings.config.rounding radius: Settings.config.rounding
color: active ? ThemeLoader.colors.base01 : "transparent" color: active ? Colors.base01 : "transparent"
implicitHeight: Settings.config.barHeight / 2 + 6 implicitHeight: Settings.config.barHeight / 2 + 6
implicitWidth: titleText.width + 14 implicitWidth: titleText.width + 14
RowLayout { RowLayout {

View File

@ -9,7 +9,7 @@ Rectangle {
implicitWidth: trayRow.implicitWidth + 14 implicitWidth: trayRow.implicitWidth + 14
implicitHeight: trayRow.implicitHeight + 6 implicitHeight: trayRow.implicitHeight + 6
visible: trayRep.count > 0 visible: trayRep.count > 0
color: ThemeLoader.colors.base01 color: Colors.base01
radius: Settings.config.rounding radius: Settings.config.rounding
RowLayout { RowLayout {
id: trayRow id: trayRow

View File

@ -10,7 +10,7 @@ import qs.widgets
Rectangle { Rectangle {
id: wsWrap id: wsWrap
required property ShellScreen barScreen required property ShellScreen barScreen
color: ThemeLoader.colors.base01 color: Colors.base01
radius: Settings.config.rounding radius: Settings.config.rounding
implicitWidth: wsLayout.implicitWidth + 6 implicitWidth: wsLayout.implicitWidth + 6
implicitHeight: wsLayout.implicitHeight + 6 implicitHeight: wsLayout.implicitHeight + 6
@ -33,7 +33,7 @@ Rectangle {
id: wsText id: wsText
anchors.centerIn: parent anchors.centerIn: parent
text: wsRect.modelData.id text: wsRect.modelData.id
color: ThemeLoader.colors.base07 color: Colors.base07
opacity: parent.modelData.focused ? 1 : 0.5 opacity: parent.modelData.focused ? 1 : 0.5
} }
MouseArea { MouseArea {

View File

@ -0,0 +1,81 @@
pragma ComponentBehavior: Bound
import Quickshell
import Quickshell.Hyprland
import Quickshell.Io
import QtQuick
import Qt.labs.folderlistmodel 2.10
import qs
import qs.settings
FloatingWindow {
id: root
GlobalShortcut {
id: wallswitcherToggle
name: "showWallSwitcher"
onPressed: {
Settings.config.wallswitchershown = true;
}
}
Process {
id: matugenRunner
property string matugen: "matugen image " + Settings.config.currentWall + " --source-color-index=0"
running: false
command: [ "sh", "-c", matugen ]
}
implicitWidth: 700
title: "qs-wallpicker"
implicitHeight: 600
color: Colors.base00
visible: Settings.config.wallswitchershown
onClosed: Settings.config.wallswitchershown = false
Rectangle {
id: container
radius: Settings.config.rounding
anchors {
fill: parent
margins: 8
}
color: Colors.base01
FolderListModel {
id: wpModel
folder: "file:///home/lucy/.walls/"
nameFilters: ["*.png"]
}
Component {
id: wallDelegate
Rectangle {
id: wpPreview
required property var filePath
implicitWidth: 80
implicitHeight: 60
color: "transparent"
Image {
asynchronous: true
anchors.fill: parent
source: wpPreview.filePath ? wpPreview.filePath : null
}
MouseArea {
id: updater
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: {
Settings.config.currentWall = wpPreview.filePath;
matugenRunner.running = true
}
}
}
}
GridView {
id: wallLayout
anchors.centerIn: parent
anchors.margins: 20
anchors.leftMargin: 40
anchors.fill: parent
clip: true
model: wpModel
delegate: wallDelegate
}
}
}

View File

@ -1,3 +1,4 @@
pragma ComponentBehavior: Bound
pragma Singleton pragma Singleton
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
@ -7,9 +8,12 @@ Singleton {
property alias config: settingsAdapter property alias config: settingsAdapter
FileView { FileView {
id: settingsView id: settingsView
path: "file:///home/lucy/.config/qs.json" path: "file:///home/lucy/.config/quickshell/settings/settings.json"
onFileChanged: reload() onFileChanged: reload()
onAdapterUpdated: writeAdapter()
watchChanges: true watchChanges: true
adapter: JsonAdapter { adapter: JsonAdapter {
id: settingsAdapter id: settingsAdapter
property int barHeight property int barHeight
@ -19,6 +23,7 @@ Singleton {
property int fontSize property int fontSize
property int margins property int margins
property var currentWall property var currentWall
property bool wallswitchershown
} }
} }
} }

10
settings/settings.json Normal file
View File

@ -0,0 +1,10 @@
{
"barHeight": 32,
"currentWall": "/home/lucy/.walls/mooon.png",
"floating": true,
"font": "Maple Mono NF",
"fontSize": 14,
"margins": 10,
"rounding": 15,
"wallswitchershown": false
}

View File

@ -4,10 +4,12 @@ import QtQuick
import qs.modules.Bar import qs.modules.Bar
import qs.modules.ipc import qs.modules.ipc
import qs.modules.wallpaper import qs.modules.wallpaper
import qs.modules.widgets.wallpicker
ShellRoot { ShellRoot {
id: root id: root
Bar {} Bar {}
Ipc {} Ipc {}
Wallpaper {} Wallpaper {}
WallPicker {}
} }

View File

@ -4,12 +4,12 @@ import qs.settings
Text { Text {
id: root id: root
color: ThemeLoader.colors.base05 color: Colors.base07
property real iconSize: 14 property real iconSize: 14
property real fill: 1 property real fill: 1
renderType: Text.NativeRendering renderType: Text.NativeRendering
font { font {
family: "Material Symbols Rounded" family: "Material Symbols Sharp"
pointSize: iconSize pointSize: iconSize
variableAxes: { variableAxes: {
"FILL": fill.toFixed(1), "FILL": fill.toFixed(1),

View File

@ -5,5 +5,5 @@ import qs.settings
Text { Text {
font.family: Settings.config.font font.family: Settings.config.font
font.pixelSize: Settings.config.fontSize font.pixelSize: Settings.config.fontSize
color: ThemeLoader.colors.base07 color: Colors.base07
} }