Bug 467380 - Global Shortcut Command/URL opens in a browser if it has '@'
Summary: Global Shortcut Command/URL opens in a browser if it has '@'
Status: RESOLVED UNMAINTAINED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_khotkeys (show other bugs)
Version: 5.27.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Michael Jansen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-15 06:40 UTC by Deniil
Modified: 2024-03-04 19:42 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Deniil 2023-03-15 06:40:50 UTC
SUMMARY
  KDE Plasma's Custom Shortcut system mistakenly opens a command in a web-browser if it contains '@' character

STEPS TO REPRODUCE
  1. Launch System Settings
  2. Go to Shortcuts -> Custom Shortcuts
  3. Right-click on a shortcut list and click New -> Global Shortcut -> Command/URL
  4. Go to Action tab
  5. Enter any command that has "@" in it, for example "pactl set-source-mute @DEFAULT_SOURCE@ toggle" (without 
  quotes)
  6. Go to Trigger tab and assign a shortcut
  7. Hit Apply
  8. Press the shortcut you assigned

OBSERVED RESULT
  Command gets sent into a default browser as a search query

EXPECTED RESULT
  Command is executed via $SHELL

PROPOSED SOLUTION
  Having Commands and URL combined into a single thing and relying on some wonky algorithm that tells apart 
  Commands from URLs will never work right.
  Instead of having Commands and URLs combined into a single thing, it would be better if we separated them like this:
    Command
      Executes contents in $SHELL only.
    URL
       Executes xdg-open on the provided URL only.

SOFTWARE/OS VERSIONS
  Operating System: Arch Linux 
  KDE Plasma Version: 5.27.3
  KDE Frameworks Version: 5.104.0
  Qt Version: 5.15.8
  Kernel Version: 6.2.6-arch1-1 (64-bit)
  Graphics Platform: X11
  Processors: 4 × Intel® Core™ i3-4160 CPU @ 3.60GHz
  Memory: 15,5 GiB of RAM
  Graphics Processor: Mesa DRI Intel® HD Graphics 4400
  Manufacturer: ASUSTeK COMPUTER INC.
  Product Name: A_F_K31ADE

Thanks!
Comment 1 Nicolas Fella 2023-03-15 10:57:17 UTC
You can use Shortcuts > Shortcuts > Add Command instead, it doesn't have this problem
Comment 2 Deniil 2023-03-15 11:05:38 UTC
(In reply to Nicolas Fella from comment #1)
> You can use Shortcuts > Shortcuts > Add Command instead, it doesn't have
> this problem

Hi, thank you for such quick response.
I see, "Add Command" works perfectly.
I think, to avoid new user confusion, we can deprecate the entire "Custom Shortcuts" section and leave only "Shortcuts" in the future.
Thank you for your work!
Comment 3 Nicolas Fella 2023-03-16 13:49:10 UTC
Removing the "Custom Shortcuts" module is generally planned, but it provides some (somewhat niche) features that the other one doesn't, so it would be a somewhat controversial thing to do at the moment
Comment 4 Nate Graham 2024-03-04 19:42:11 UTC
As announced in https://pointieststick.com/2023/07/26/what-we-plan-to-remove-in-plasma-6/ and https://community.kde.org/Plasma/Plasma_6#Removals, I'm afraid KHotKeys has reached end-of-life in Plasma 6. Accordingly, all bug reports and feature requests for it must be closed now.

Most of what KHotKeys could do can already be done with the newer KGlobalAccel system in Plasma 6. A few features such as mouse gestures and triggering conditions based on changes to window states are not yet implemented in the new system. These will be added in the future if and when resources materialize for them, and/or when a kind soul submits patches to implement them! :) Meanwhile, the 3rd-party "Mouse Actions" app (https://github.com/jersou/mouse-actions) may be usable for implementing your own mouse gestures again.

Thanks for your understanding, everyone.