mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 04:19:19 -08:00
feat: updates, work on qs
This commit is contained in:
parent
5686454354
commit
4be1b9f090
30 changed files with 773 additions and 74 deletions
12
quickshell/Components/Clock.qml
Normal file
12
quickshell/Components/Clock.qml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "root:/DataSources"
|
||||
|
||||
Text {
|
||||
id: clock
|
||||
font.pointSize: 13
|
||||
color: Settings.variable
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
|
||||
text: Time.time
|
||||
}
|
||||
11
quickshell/Components/DistroIcon.qml
Normal file
11
quickshell/Components/DistroIcon.qml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import Quickshell
|
||||
import QtQuick
|
||||
import "root:/Helpers"
|
||||
|
||||
Image {
|
||||
id: root
|
||||
source: ThemeIcons.iconFromName("nix-snowflake", "")
|
||||
sourceSize.width: 24
|
||||
sourceSize.height: 24
|
||||
visible: true
|
||||
}
|
||||
49
quickshell/Components/FocusedWindow.qml
Normal file
49
quickshell/Components/FocusedWindow.qml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Niri 0.1
|
||||
import "root:/DataSources"
|
||||
import "root:/Helpers"
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
property string title: get_text()
|
||||
property string icon_path: get_icon()
|
||||
property string app_id: get_app_id()
|
||||
|
||||
function get_app_id() {
|
||||
var app_id = niri.focusedWindow?.appId;
|
||||
return app_id
|
||||
}
|
||||
|
||||
function get_text() {
|
||||
var full_title = niri.focusedWindow?.title ?? "";
|
||||
var shortened_title = full_title.substring(0, 20);
|
||||
if (full_title.length > 20) {
|
||||
shortened_title += "…"
|
||||
}
|
||||
return shortened_title
|
||||
}
|
||||
|
||||
function get_icon() {
|
||||
var icon = ThemeIcons.iconForAppId(app_id);
|
||||
if (icon && icon !== "") {
|
||||
return icon
|
||||
}
|
||||
}
|
||||
|
||||
spacing: 10
|
||||
|
||||
Image {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
source: icon_path
|
||||
visible: title != ""
|
||||
sourceSize.width: 24
|
||||
sourceSize.height: 24
|
||||
smooth: true
|
||||
}
|
||||
Text {
|
||||
text: title
|
||||
color: Settings.defaultFg
|
||||
}
|
||||
}
|
||||
126
quickshell/Components/SystemTray.qml
Normal file
126
quickshell/Components/SystemTray.qml
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import QtQuick.Controls
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Services.SystemTray
|
||||
import "root:/DataSources"
|
||||
|
||||
RowLayout {
|
||||
id: systray
|
||||
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
|
||||
Repeater {
|
||||
model: SystemTray.items
|
||||
|
||||
delegate: Item {
|
||||
id: delagate
|
||||
required property SystemTrayItem modelData
|
||||
property var openItem
|
||||
|
||||
width: 24
|
||||
height: 24
|
||||
|
||||
IconImage {
|
||||
source: modelData.icon
|
||||
width: 20
|
||||
height: 20
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onClicked: popupLoader.item.visible = !popupLoader.item.visible
|
||||
}
|
||||
|
||||
QsMenuOpener {
|
||||
id: menu
|
||||
menu: modelData.menu
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
id: popupLoader
|
||||
|
||||
loading: true
|
||||
|
||||
PopupWindow {
|
||||
id: popup
|
||||
anchor.window: delagate.QsWindow.window
|
||||
anchor.rect.x: parentWindow.width * 1.15
|
||||
anchor.rect.y: parentWindow.height / 1.25
|
||||
|
||||
color: "transparent"
|
||||
|
||||
implicitWidth: 200
|
||||
implicitHeight: 200
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Settings.colors.background
|
||||
radius: 5
|
||||
}
|
||||
|
||||
ListView {
|
||||
model: menu.children
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
topMargin: 5
|
||||
bottom: parent.bottom
|
||||
bottomMargin: 5
|
||||
}
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
spacing: 5
|
||||
|
||||
ScrollBar.horizontal: ScrollBar {}
|
||||
|
||||
delegate: Item {
|
||||
required property QsMenuHandle modelData
|
||||
|
||||
width: parent.width
|
||||
height: 40
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: 5
|
||||
rightMargin: 5
|
||||
}
|
||||
|
||||
color: Settings.colors.backgroundLighter
|
||||
radius: 5
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: modelData.text
|
||||
color: Settings.colors.foreground
|
||||
font.pointSize: 12
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onClicked: mouse => {
|
||||
modelData.triggered();
|
||||
// TODO: moar
|
||||
var idx = ObjectModel.indexOf(modelData);
|
||||
if (openItem && openItem.idx != idx) {
|
||||
|
||||
}
|
||||
popup.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
70
quickshell/Components/WorkspaceButton.qml
Normal file
70
quickshell/Components/WorkspaceButton.qml
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "root:/DataSources"
|
||||
|
||||
Item {
|
||||
property var modelData
|
||||
property var screenData
|
||||
|
||||
property int index: modelData.index
|
||||
property string name: modelData.name
|
||||
property string generated_name: gen_text()
|
||||
property bool isVisible: modelData.output == screenData.name
|
||||
|
||||
id: root
|
||||
|
||||
function gen_text() {
|
||||
if (name.length == 0) {
|
||||
return index
|
||||
} else {
|
||||
return name
|
||||
}
|
||||
}
|
||||
|
||||
function gen_width() {
|
||||
if (isVisible) {
|
||||
return 10 + (generated_name.length * 15)
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
function get_color() {
|
||||
if (modelData.isUrgent) {
|
||||
return Settings.base0F
|
||||
}
|
||||
if (modelData.isFocused) {
|
||||
return Settings.base0E
|
||||
}
|
||||
if (modelData.isActive) {
|
||||
return Settings.base0C
|
||||
}
|
||||
if (modelData.activeWindowId > 0) {
|
||||
return Settings.base0F
|
||||
}
|
||||
return Settings.lighterBg
|
||||
}
|
||||
|
||||
visible: isVisible
|
||||
implicitHeight: 25
|
||||
implicitWidth: gen_width()
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: get_color()
|
||||
radius: 5
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
color: Settings.defaultBg
|
||||
text: gen_text()
|
||||
font.pixelSize: 20
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: niri.focusWorkspaceById(modelData.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
24
quickshell/Components/Workspaces.qml
Normal file
24
quickshell/Components/Workspaces.qml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "root:/DataSources"
|
||||
import "root:/Components"
|
||||
import Niri 0.1
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
property var screen
|
||||
spacing: 10
|
||||
|
||||
Repeater {
|
||||
model: niri.workspaces
|
||||
|
||||
WorkspaceButton {
|
||||
modelData: model
|
||||
screenData: screen
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue