add ipc handlers for settings
This commit is contained in:
parent
a1fb6d330f
commit
2f6f940b76
7 changed files with 66 additions and 11 deletions
|
|
@ -3,6 +3,7 @@ import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|
||||||
import qs
|
import qs
|
||||||
|
import qs.settings
|
||||||
|
|
||||||
Variants {
|
Variants {
|
||||||
model: Quickshell.screens
|
model: Quickshell.screens
|
||||||
|
|
@ -15,7 +16,7 @@ Variants {
|
||||||
left: true
|
left: true
|
||||||
right: true
|
right: true
|
||||||
}
|
}
|
||||||
implicitHeight: 30
|
implicitHeight: Config.barHeight
|
||||||
color: Colors.base00
|
color: Colors.base00
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: leftLayout
|
id: leftLayout
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,37 @@
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Hyprland
|
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
|
import qs.settings
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
id: ipcHandler
|
id: ipcHandler
|
||||||
target: "util"
|
target: "config"
|
||||||
function refreshWs() {
|
function setFont(newFont: string) {
|
||||||
Hyprland.refreshWorkspaces();
|
Config.font = newFont;
|
||||||
}
|
}
|
||||||
function refreshMon() {
|
|
||||||
Hyprland.refreshMonitors();
|
function setFontSize(newSize: int) {
|
||||||
Quickshell.reload(false)
|
Config.fontSize = newSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setHeight(newHeight: int) {
|
||||||
|
Config.barHeight = newHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleFloating() {
|
||||||
|
Config.floating = !Config.floating;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setRounding(newRounding: int) {
|
||||||
|
Config.rounding = newRounding;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setWall(newWall: string) {
|
||||||
|
if (newWall.startsWith("/")) {
|
||||||
|
Config.wallpaper = "file://" + newWall;
|
||||||
|
return;
|
||||||
|
} else if (newWall.startsWith("~")) {
|
||||||
|
Config.wallpaper = Quickshell.env("HOME") + newWall;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import qs.settings
|
||||||
|
|
||||||
Variants {
|
Variants {
|
||||||
model: Quickshell.screens
|
model: Quickshell.screens
|
||||||
|
|
@ -19,7 +20,7 @@ Variants {
|
||||||
Image {
|
Image {
|
||||||
cache: true
|
cache: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: "/home/lucy/.walls/frierensuff.png"
|
source: Config.wallpaper
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
settings/Config.qml
Normal file
23
settings/Config.qml
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
pragma Singleton
|
||||||
|
import QtCore
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
property string font: "Adwaita Mono Nerd Font Propo"
|
||||||
|
property int fontSize: 12
|
||||||
|
property int barHeight: 30
|
||||||
|
property int rounding: 0
|
||||||
|
property url wallpaper: "file:///home/lucy/.walls/frierensuff.png"
|
||||||
|
property bool floating: false
|
||||||
|
Settings {
|
||||||
|
|
||||||
|
location: Qt.resolvedUrl("file:///home/lucy/.config/quickshell/settings/settings.ini")
|
||||||
|
property alias font: root.font
|
||||||
|
property alias fontSize: root.fontSize
|
||||||
|
property alias barHeight: root.barHeight
|
||||||
|
property alias roudning: root.rounding
|
||||||
|
property alias wallpaper: root.wallpaper
|
||||||
|
}
|
||||||
|
}
|
||||||
6
settings/settings.ini
Normal file
6
settings/settings.ini
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[General]
|
||||||
|
barHeight=32
|
||||||
|
font=0xProto Nerd Font Propo
|
||||||
|
fontSize=12
|
||||||
|
roudning=0
|
||||||
|
wallpaper=@Variant(\0\0\0\x11\0\0\0\"file:///home/lucy/.walls/mooon.png)
|
||||||
|
|
@ -3,6 +3,7 @@ import Quickshell
|
||||||
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.settings
|
||||||
|
|
||||||
ShellRoot {
|
ShellRoot {
|
||||||
Bar {}
|
Bar {}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import qs
|
import qs
|
||||||
|
import qs.settings
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
font.family: "Adwaita Mono Nerd Font Propo"
|
font.family: Config.font
|
||||||
font.pixelSize: 12
|
font.pixelSize: Config.fontSize
|
||||||
color: Colors.base07
|
color: Colors.base07
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue