add theme switcher
This commit is contained in:
parent
143889683b
commit
d69ec48728
9 changed files with 126 additions and 68 deletions
32
Colors.js
32
Colors.js
|
|
@ -1,18 +1,18 @@
|
||||||
const colors = {
|
const colors = {
|
||||||
base00: "#1f2430",
|
base00: "#000000",
|
||||||
base01: "#242936",
|
base01: "#121212",
|
||||||
base02: "#323844",
|
base02: "#222222",
|
||||||
base03: "#4a5059",
|
base03: "#333333",
|
||||||
base04: "#707a8c",
|
base04: "#999999",
|
||||||
base05: "#cccac2",
|
base05: "#c1c1c1",
|
||||||
base06: "#d9d7ce",
|
base06: "#999999",
|
||||||
base07: "#f3f4f5",
|
base07: "#c1c1c1",
|
||||||
base08: "#f28779",
|
base08: "#5f8787",
|
||||||
base09: "#ffad66",
|
base09: "#aaaaaa",
|
||||||
base0A: "#ffd173",
|
base0A: "#5f81a5",
|
||||||
base0B: "#d5ff80",
|
base0B: "#d0dfee",
|
||||||
base0C: "#95e6cb",
|
base0C: "#aaaaaa",
|
||||||
base0D: "#73d0ff",
|
base0D: "#888888",
|
||||||
base0E: "#d4bfff",
|
base0E: "#999999",
|
||||||
base0F: "#f27983",
|
base0F: "#444444",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
29
modules/Services/State.qml
Normal file
29
modules/Services/State.qml
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
pragma Singleton
|
||||||
|
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
property alias s: stateAdapter
|
||||||
|
property alias v: state
|
||||||
|
FileView {
|
||||||
|
id: state
|
||||||
|
path: Qt.resolvedUrl(Quickshell.shellDir + "/settings/state.json")
|
||||||
|
watchChanges: true
|
||||||
|
onLoadFailed: {
|
||||||
|
writeAdapter()
|
||||||
|
}
|
||||||
|
onAdapterUpdated: writeAdapter()
|
||||||
|
onFileChanged: reload()
|
||||||
|
adapter: JsonAdapter {
|
||||||
|
id: stateAdapter
|
||||||
|
property bool themeSwitcherVisible: false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Component.onCompleted: console.log("say gex")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -9,14 +9,14 @@ import qs
|
||||||
import qs.settings
|
import qs.settings
|
||||||
import qs.widgets
|
import qs.widgets
|
||||||
|
|
||||||
Rectangle {
|
FloatingWindow {
|
||||||
id: root
|
id: child
|
||||||
MouseArea {
|
implicitWidth: 800
|
||||||
anchors.fill: parent
|
implicitHeight: 600
|
||||||
acceptedButtons: Qt.AllButtons
|
visible: Config.cfg.themeSwitcherVisible
|
||||||
}
|
|
||||||
clip: true
|
|
||||||
color: Colors.base00
|
color: Colors.base00
|
||||||
|
title: "qs-themepicker"
|
||||||
|
onClosed: Config.cfg.themeSwitcherVisible = false
|
||||||
Process {
|
Process {
|
||||||
id: getSchemes
|
id: getSchemes
|
||||||
property list<string> schemes
|
property list<string> schemes
|
||||||
|
|
@ -28,20 +28,62 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ListView {
|
Rectangle {
|
||||||
id: schemeList
|
anchors.fill: child.contentItem
|
||||||
orientation: ListView.Horizontal
|
anchors.centerIn: child.contentItem
|
||||||
anchors.fill: root
|
anchors.margins: 10
|
||||||
model: getSchemes.schemes
|
radius: Config.cfg.appearance.rounding / 1.5
|
||||||
delegate: Rectangle {
|
color: Colors.base01
|
||||||
id: container
|
clip: true
|
||||||
required property string modelData
|
RowLayout {
|
||||||
color: Colors.base01
|
id: contentLayout
|
||||||
height: 30
|
anchors.fill: parent
|
||||||
implicitWidth: schemeName.width + 16
|
ListView {
|
||||||
|
id: schemeList
|
||||||
|
spacing: 5
|
||||||
|
Layout.fillHeight: true
|
||||||
|
model: getSchemes.schemes
|
||||||
|
implicitWidth: 300
|
||||||
|
delegate: Rectangle {
|
||||||
|
id: container
|
||||||
|
required property string modelData
|
||||||
|
color: Colors.base02
|
||||||
|
height: 30
|
||||||
|
radius: Config.cfg.appearance.rounding
|
||||||
|
implicitWidth: 300
|
||||||
|
StyledText {
|
||||||
|
id: schemeName
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: container.modelData
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
id: schemeSetter
|
||||||
|
anchors.fill: container
|
||||||
|
acceptedButtons: Qt.LeftButton
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
setTheme.themeName = modelData;
|
||||||
|
setTheme.running = true;
|
||||||
|
}
|
||||||
|
Process {
|
||||||
|
id: setTheme
|
||||||
|
property string themeName
|
||||||
|
command: ["tinty", "apply", themeName]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
StyledText {
|
StyledText {
|
||||||
id: schemeName
|
id: currentScheme
|
||||||
text: container.modelData
|
text: ""
|
||||||
|
Process {
|
||||||
|
id: getCurrentScheme
|
||||||
|
command: ["tinty", "current"]
|
||||||
|
running: true
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: currentScheme.text = text
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,19 +3,25 @@ import qs.widgets
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import qs.modules.Services
|
import qs.modules.Services
|
||||||
|
import qs.modules.applets
|
||||||
|
import qs.settings
|
||||||
|
|
||||||
BarComponent {
|
BarComponent {
|
||||||
implicitWidth: text.width
|
implicitWidth: text.width
|
||||||
required property ShellScreen barScreen
|
required property ShellScreen barScreen
|
||||||
StyledText {
|
StyledText {
|
||||||
id: text
|
id: text
|
||||||
|
anchors.centerIn: parent
|
||||||
text: "temp!!!"
|
text: "temp!!!"
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: clickHandler
|
id: clickHandler
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: { WidgetTracker.toggle("colorschemes", parent.barScreen) }
|
onClicked: {
|
||||||
|
Config.cfg.themeSwitcherVisible = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ThemeSwitcher {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,19 +114,6 @@ Variants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ThemeSwitcher {
|
|
||||||
z: 1
|
|
||||||
id: colorschemes
|
|
||||||
property bool shown: WidgetTracker.current === "colorschemes" && root.shown
|
|
||||||
visible: shown
|
|
||||||
focus: shown
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.topMargin: Config.cfg.bar.floating ? Config.cfg.bar.height + 20 : Config.cfg.bar.height + 10
|
|
||||||
anchors.margins: 20
|
|
||||||
implicitHeight: 60
|
|
||||||
}
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: dismisser
|
id: dismisser
|
||||||
z: 0
|
z: 0
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,17 @@ Singleton {
|
||||||
onFileChanged: {
|
onFileChanged: {
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
|
onAdapterUpdated: {
|
||||||
|
writeAdapter();
|
||||||
|
reload();
|
||||||
|
}
|
||||||
onLoadFailed: error => {
|
onLoadFailed: error => {
|
||||||
if (error === FileViewError.FileNotFound)
|
if (error === FileViewError.FileNotFound)
|
||||||
writeAdapter();
|
writeAdapter();
|
||||||
}
|
}
|
||||||
adapter: JsonAdapter {
|
adapter: JsonAdapter {
|
||||||
id: cfg
|
id: cfg
|
||||||
|
property bool themeSwitcherVisible: false
|
||||||
property JsonObject appearance: JsonObject {
|
property JsonObject appearance: JsonObject {
|
||||||
property string font: "Iosevka"
|
property string font: "Iosevka"
|
||||||
property int fontSize: 14
|
property int fontSize: 14
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
[General]
|
|
||||||
barHeight=30
|
|
||||||
floating=false
|
|
||||||
font=Iosevka
|
|
||||||
fontSize=14
|
|
||||||
iconSize=16
|
|
||||||
opacity=1
|
|
||||||
primaryMon=eDP-1
|
|
||||||
rounding=16
|
|
||||||
showCorners=true
|
|
||||||
wallDir=/home/lucy/.walls/
|
|
||||||
wallpaper=/home/lucy/.walls/walkingcastle.png
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
"height": 34,
|
"height": 34,
|
||||||
"opacity": 1
|
"opacity": 1
|
||||||
},
|
},
|
||||||
|
"themeSwitcherVisible": false,
|
||||||
"wallpaper": {
|
"wallpaper": {
|
||||||
"wallDir": "/home/lucy/.walls/",
|
"wallDir": "/home/lucy/.walls/",
|
||||||
"wallpaper": "/home/lucy/.walls/Kita.png"
|
"wallpaper": "/home/lucy/.walls/Kita.png"
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ import qs.settings
|
||||||
import qs.modules.ipc
|
import qs.modules.ipc
|
||||||
|
|
||||||
ShellRoot {
|
ShellRoot {
|
||||||
Bottom {}
|
|
||||||
Top {}
|
|
||||||
Bar {}
|
|
||||||
Ipc {}
|
Ipc {}
|
||||||
|
Bottom {}
|
||||||
|
Bar {}
|
||||||
|
Top {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue