mirror of
https://github.com/danbulant/dotfiles
synced 2026-06-20 15:11:04 +00:00
small quickshell changes
This commit is contained in:
parent
3fc1005c35
commit
92877d2341
4 changed files with 63 additions and 42 deletions
|
|
@ -11,7 +11,8 @@ Scope {
|
|||
property font customFont: Qt.font({
|
||||
bold: true,
|
||||
pointSize: 12,
|
||||
family: "FantasqueSansMNerdFont"
|
||||
// forgot which font I'm actually using, this yields some fallback that works well.
|
||||
family: "NF"
|
||||
})
|
||||
|
||||
Variants {
|
||||
|
|
@ -34,8 +35,8 @@ Scope {
|
|||
right: 10
|
||||
}
|
||||
|
||||
height: 50
|
||||
color: "#171a18"
|
||||
implicitHeight: 50
|
||||
color: "#15121b"
|
||||
|
||||
RowLayout {
|
||||
spacing: 15
|
||||
|
|
@ -54,8 +55,8 @@ Scope {
|
|||
|
||||
HyprlandWorkspacesWidget {
|
||||
font: customFont
|
||||
default_color: "#689D6A"
|
||||
active_color: "#8ec07c"
|
||||
default_color: "#cdd6f4"
|
||||
active_color: "#ebbcba"
|
||||
empty_color: "#928374"
|
||||
spacing: 15
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,39 +1,52 @@
|
|||
import QtQuick
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Widgets
|
||||
|
||||
Text {
|
||||
id: text
|
||||
WrapperRectangle {
|
||||
required property int id
|
||||
required property string icon
|
||||
required property color default_color
|
||||
required property color empty_color
|
||||
required property color active_color
|
||||
required property font font
|
||||
property bool active: false
|
||||
color: active ? "#753a88" : "transparent"
|
||||
|
||||
text: icon
|
||||
color: empty_color
|
||||
radius: 20
|
||||
topMargin: 3
|
||||
bottomMargin: 3
|
||||
leftMargin: active ? 12 : 6
|
||||
rightMargin: active ? 12 : 6
|
||||
|
||||
Component.onCompleted: {
|
||||
Hyprland.rawEvent.connect(hyprEvent)
|
||||
colorWorkspace()
|
||||
}
|
||||
Text {
|
||||
text: icon
|
||||
color: active ? parent.active_color : parent.empty_color
|
||||
font: parent.font
|
||||
|
||||
function hyprEvent(e) {
|
||||
if (e.name == "workspace") {
|
||||
if (e.data == id) {
|
||||
text.color = text.active_color
|
||||
Component.onCompleted: {
|
||||
Hyprland.rawEvent.connect(hyprEvent)
|
||||
colorWorkspace()
|
||||
}
|
||||
|
||||
function hyprEvent(e) {
|
||||
if (e.name == "workspace") {
|
||||
parent.active = e.data == id
|
||||
if (e.data == id) {
|
||||
text.color = parent.active_color
|
||||
} else {
|
||||
colorWorkspace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function colorWorkspace() {
|
||||
if (Hyprland.workspaces.values.some((w) => {
|
||||
return w.id == id && w.lastIpcObject.windows > 0
|
||||
})) {
|
||||
text.color = parent.default_color
|
||||
} else {
|
||||
colorWorkspace()
|
||||
text.color = parent.empty_color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function colorWorkspace() {
|
||||
if (Hyprland.workspaces.values.some((w) => {
|
||||
return w.id == id && w.lastIpcObject.windows > 0
|
||||
})) {
|
||||
text.color = text.default_color
|
||||
} else {
|
||||
text.color = text.empty_color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ PanelWindow {
|
|||
required property color text_color
|
||||
property list<QtObject> notification_objects
|
||||
|
||||
width: 500
|
||||
height: 600
|
||||
implicitWidth: 500
|
||||
implicitHeight: 600
|
||||
|
||||
color: "#171a18"
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import QtQuick.Layouts
|
|||
|
||||
RowLayout {
|
||||
id: container
|
||||
property var icons: {1: "一", 2: "二", 3: "三", 4: "四", 5: "五"}
|
||||
property var icons: {1: "1", 2: "2", 3: "3", 4: "4", 5: "5"}
|
||||
property int nWorkspaces: 5
|
||||
property font font
|
||||
property color default_color
|
||||
|
|
@ -12,22 +12,29 @@ RowLayout {
|
|||
property color active_color
|
||||
|
||||
Component.onCompleted: {
|
||||
var workspaceComponent = Qt.createComponent("../components/HyprlandWorkspace.qml");
|
||||
var workspaceComponent = Qt.createComponent("../components/HyprlandWorkspace.qml")
|
||||
Hyprland.rawEvent.connect(hyprEvent)
|
||||
for (var i = 1; i <= nWorkspaces; i++) {
|
||||
var workspace = workspaceComponent
|
||||
.createObject(container,
|
||||
{
|
||||
id: i,
|
||||
icon: icons[i],
|
||||
font: font,
|
||||
default_color: default_color,
|
||||
empty_color: empty_color,
|
||||
active_color: active_color
|
||||
}
|
||||
)
|
||||
.createObject(container,
|
||||
{
|
||||
id: i,
|
||||
icon: icons[i],
|
||||
font: font,
|
||||
default_color: default_color,
|
||||
empty_color: empty_color,
|
||||
active_color: active_color
|
||||
}
|
||||
)
|
||||
if (workspace == null) {
|
||||
console.log("Error creating workspace")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hyprEvent(e) {
|
||||
// console.log(e.name, e.data)
|
||||
// console.log(Hyprland.workspaces.values)
|
||||
// console.log(Hyprland)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue