KDE Connect/Tutorials/Useful commands: Difference between revisions

From KDE Wiki Sandbox
(Add output-to-phone command)
(Marked this version for translation)
Line 63: Line 63:
* Send to phone: {{Output|1=<nowiki>file=/tmp/$(hostname)_$(date "+%Y%m%d_%H%M%S").png; spectacle -bo "${file}" && kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --share ${file}</nowiki>}}
* Send to phone: {{Output|1=<nowiki>file=/tmp/$(hostname)_$(date "+%Y%m%d_%H%M%S").png; spectacle -bo "${file}" && kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --share ${file}</nowiki>}}


===Send output of any command to your phone===
===Send output of any command to your phone=== <!--T:19-->


<!--T:20-->
* Check the status of baloo indexing: {{Output|1=<nowiki>kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --ping-msg "$(balooctl status)"</nowiki>}}
* Check the status of baloo indexing: {{Output|1=<nowiki>kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --ping-msg "$(balooctl status)"</nowiki>}}
* Check lines 5, 7 and 9 of speedtest-cli: {{Output|1=<nowiki>kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --ping-msg "$(speedtest-cli|awk 'NR==5;NR==7;NR==9 {print;exit}')"</nowiki>}}
* Check lines 5, 7 and 9 of speedtest-cli: {{Output|1=<nowiki>kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --ping-msg "$(speedtest-cli|awk 'NR==5;NR==7;NR==9 {print;exit}')"</nowiki>}}

Revision as of 05:04, 22 June 2020

List of example commands for KDE Connect

In KDE Connect, you can add your own commands and execute them from your phone. Here are some useful commands. Feel free to add your own!

Control your computer state

  • Shutdown:
    systemctl poweroff
  • Reboot:
    systemctl reboot
  • Suspend:
    systemctl suspend
  • Hibernate:
    systemctl hibernate
  • Lock screen:
    loginctl lock-session
  • Unlock screen:
    loginctl unlock-session
  • Turn off screen:
    xset dpms force off
  • Turn on screen:
    xset dpms force on
  • Lock keyboard and mouse (not the screen):
    pyxtrlock
  • Unlock keyboard and mouse:
    pkill pyxtrlock

Volume control

Plasma

  • Volume down:
    qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "decrease_volume"
  • Volume up:
    qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "increase_volume"
  • Mute:
    qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "mute"
  • Mute microphone:
    qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "mic_mute"

Other DE/WM (with pactl)

  • Volume down:
    pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f1) -10%
  • Volume up:
    pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f1) +10%
  • Mute/Unmute:
    pactl set-sink-mute $(pactl list short sinks | grep RUNNING | cut -f1) toggle

Other DE/WM (with amixer)

  • Volume down:
    amixer -q sset Master 10%-
  • Volume up:
    amixer -q sset Master 10%+

Other commands can be built using amixer

Change look and feel

  • Breeze (Light) theme:
    lookandfeeltool -a 'org.kde.breeze.desktop'
  • Breeze (Dark) theme:
    lookandfeeltool -a 'org.kde.breezedark.desktop'

Brightness settings

  • Brightness Up:
    qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement/Actions/BrightnessControl org.kde.Solid.PowerManagement.Actions.BrightnessControl.setBrightness $(expr $(qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement/Actions/BrightnessControl org.kde.Solid.PowerManagement.Actions.BrightnessControl.brightness) + 375)
  • Brightness Down:
    qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement/Actions/BrightnessControl org.kde.Solid.PowerManagement.Actions.BrightnessControl.setBrightness $(expr $(qdbus org.kde.Solid.PowerManagement /org/kde/Solid/PowerManagement/Actions/BrightnessControl org.kde.Solid.PowerManagement.Actions.BrightnessControl.brightness) - 375)

Screenshot

  • Save locally:
    spectacle -b
  • Send to phone:
    file=/tmp/$(hostname)_$(date "+%Y%m%d_%H%M%S").png; spectacle -bo "${file}" && kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --share ${file}

Send output of any command to your phone

  • Check the status of baloo indexing:
    kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --ping-msg "$(balooctl status)"
  • Check lines 5, 7 and 9 of speedtest-cli:
    kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --ping-msg "$(speedtest-cli|awk 'NR==5;NR==7;NR==9 {print;exit}')"
  • Check whether service sshd is running:
    kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --ping-msg "$(systemctl status sshd|grep Active)"