mirror of
https://github.com/tuxdotrs/tpanel.git
synced 2026-09-19 18:19:02 +05:30
refactor(audio): truncate device names
This commit is contained in:
@@ -7,11 +7,15 @@ import Quickshell.Services.Pipewire
|
|||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property string outputName: root.displayName(Pipewire.defaultAudioSink)
|
readonly property string outputName: truncateText(root.displayName(Pipewire.defaultAudioSink), 14)
|
||||||
readonly property string inputName: root.displayName(Pipewire.defaultAudioSource)
|
readonly property string inputName: truncateText(root.displayName(Pipewire.defaultAudioSource), 14)
|
||||||
readonly property url outputIcon: `${Quickshell.shellPath("assets")}/icons/speaker.svg`
|
readonly property url outputIcon: `${Quickshell.shellPath("assets")}/icons/speaker.svg`
|
||||||
readonly property url inputIcon: `${Quickshell.shellPath("assets")}/icons/microphone.svg`
|
readonly property url inputIcon: `${Quickshell.shellPath("assets")}/icons/microphone.svg`
|
||||||
|
|
||||||
|
function truncateText(text, maxLength) {
|
||||||
|
return text.length > maxLength ? text.slice(0, maxLength - 3) + "..." : text;
|
||||||
|
}
|
||||||
|
|
||||||
function displayName(node: PwNode): string {
|
function displayName(node: PwNode): string {
|
||||||
if (!node)
|
if (!node)
|
||||||
return "none";
|
return "none";
|
||||||
|
|||||||
Reference in New Issue
Block a user