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