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 qs
|
||||
import qs.settings
|
||||
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
|
|
@ -15,7 +16,7 @@ Variants {
|
|||
left: true
|
||||
right: true
|
||||
}
|
||||
implicitHeight: 30
|
||||
implicitHeight: Config.barHeight
|
||||
color: Colors.base00
|
||||
RowLayout {
|
||||
id: leftLayout
|
||||
|
|
|
|||
|
|
@ -1,15 +1,37 @@
|
|||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Io
|
||||
import qs.settings
|
||||
|
||||
IpcHandler {
|
||||
id: ipcHandler
|
||||
target: "util"
|
||||
function refreshWs() {
|
||||
Hyprland.refreshWorkspaces();
|
||||
target: "config"
|
||||
function setFont(newFont: string) {
|
||||
Config.font = newFont;
|
||||
}
|
||||
function refreshMon() {
|
||||
Hyprland.refreshMonitors();
|
||||
Quickshell.reload(false)
|
||||
|
||||
function setFontSize(newSize: int) {
|
||||
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
|
||||
import QtQuick
|
||||
import qs.settings
|
||||
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
|
|
@ -19,7 +20,7 @@ Variants {
|
|||
Image {
|
||||
cache: true
|
||||
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.ipc
|
||||
import qs.modules.wallpaper
|
||||
import qs.settings
|
||||
|
||||
ShellRoot {
|
||||
Bar {}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import QtQuick
|
||||
import qs
|
||||
import qs.settings
|
||||
|
||||
Text {
|
||||
font.family: "Adwaita Mono Nerd Font Propo"
|
||||
font.pixelSize: 12
|
||||
font.family: Config.font
|
||||
font.pixelSize: Config.fontSize
|
||||
color: Colors.base07
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue