mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 12:29: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
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
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue