<table><tr><td style="">nicolasfella added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D12896">View Revision</a></tr></table><br /><div><div><p>I played around a bit and it turns out more difficult than expected.</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">telegram-desktop-bin from AUR has telegramdesktop.desktop whereas the Flatpak version has org.telegram.desktop.desktop, so we would need to look for at least those desktop files</li>
<li class="remarkup-list-item">the flatpak command needs @@ around the url, the AUR version not</li>
<li class="remarkup-list-item">the flatpak command contains "--" which hinders the appending of the -sendpath parameter</li>
</ul>

<p>This makes parsing the desktop file and building the correct command utterly complex and when we know whether its flatpak or not we know the overall command</p>

<p>My much simpler suggestion would be hardcoding the two commands and try them all until we succeed.<br />
Those would be<br />
telegram-desktop $URL (regular package)<br />
/usr/bin/flatpak run --file-forwarding org.telegram.desktop -sendpath @@ $URL @@ (flatpak)</p>

<p>More commands (e.g. for Snap) could be added, making it more maintainable than complex and error-prone parsing (which would also rely on case-handling and assumptions)</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R495 Purpose Library</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D12896">https://phabricator.kde.org/D12896</a></div></div><br /><div><strong>To: </strong>nicolasfella, apol<br /><strong>Cc: </strong>ngraham, kde-frameworks-devel, apol, michaelh, bruns<br /></div>