Difference between revisions of "KDE Connect/Tutorials/Useful commands"

m (Fix delay)
 
(27 intermediate revisions by 9 users not shown)
Line 1: Line 1:
 
<languages />
 
<languages />
 
<translate>
 
<translate>
{{Construction}}
+
==List of example commands for KDE Connect== <!--T:1-->
  
=List of example commands for KDE Connect=
+
<!--T:2-->
 +
In [[Special:myLanguage/KDEConnect|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!
  
In KDE Connect, you can add your own commands and execute them from your phone. Here are some useful command. Feel free to add your own!
+
===Control your computer state=== <!--T:3-->
 
 
==Control your computer state==
 
  
 +
<!--T:4-->
 
* Shutdown: {{Output|1=<nowiki>systemctl poweroff</nowiki>}}
 
* Shutdown: {{Output|1=<nowiki>systemctl poweroff</nowiki>}}
 +
* Reboot: {{Output|1=<nowiki>systemctl reboot</nowiki>}}
 
* Suspend: {{Output|1=<nowiki>systemctl suspend</nowiki>}}
 
* Suspend: {{Output|1=<nowiki>systemctl suspend</nowiki>}}
 +
* Hibernate: {{Output|1=<nowiki>systemctl hibernate</nowiki>}}
 
* Lock screen: {{Output|1=<nowiki>loginctl lock-session</nowiki>}}
 
* Lock screen: {{Output|1=<nowiki>loginctl lock-session</nowiki>}}
 
* Unlock screen: {{Output|1=<nowiki>loginctl unlock-session</nowiki>}}
 
* Unlock screen: {{Output|1=<nowiki>loginctl unlock-session</nowiki>}}
Line 18: Line 20:
 
* Unlock keyboard and mouse: {{Output|1=<nowiki>pkill pyxtrlock</nowiki>}}
 
* Unlock keyboard and mouse: {{Output|1=<nowiki>pkill pyxtrlock</nowiki>}}
  
==Volume control==
+
===Volume control=== <!--T:5-->
 +
 
 +
 
 +
====Plasma==== <!--T:10-->
 +
 
 +
<!--T:11-->
 
* Volume down: {{Output|1=<nowiki>qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "decrease_volume"</nowiki>}}
 
* Volume down: {{Output|1=<nowiki>qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "decrease_volume"</nowiki>}}
 
* Volume up: {{Output|1=<nowiki>qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "increase_volume"</nowiki>}}
 
* Volume up: {{Output|1=<nowiki>qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "increase_volume"</nowiki>}}
 +
* Mute: {{Output|1=<nowiki>qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "mute"</nowiki>}}
 +
* Mute microphone: {{Output|1=<nowiki>qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "mic_mute"</nowiki>}}
  
==Change look and feel==
+
====Other DE/WM (with pactl)==== <!--T:6-->
 +
 
 +
<!--T:12-->
 +
* Volume down: {{Output|1=<nowiki>pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f1) -10%</nowiki>}}
 +
* Volume up: {{Output|1=<nowiki>pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f1) +10%</nowiki>}}
 +
* Mute/Unmute: {{Output|1=<nowiki>pactl set-sink-mute $(pactl list short sinks | grep RUNNING | cut -f1) toggle</nowiki>}}
 +
 
 +
====Other DE/WM (with amixer)==== <!--T:17-->
 +
 
 +
<!--T:18-->
 +
* Volume down: {{Output|1=<nowiki>amixer -q sset Master 10%-</nowiki>}}
 +
* Volume up: {{Output|1=<nowiki>amixer -q sset Master 10%+</nowiki>}}
 +
Other commands can be built using [https://linux.die.net/man/1/amixer amixer]
 +
 
 +
===Change look and feel=== <!--T:7-->
 +
 
 +
<!--T:13-->
 
* Breeze (Light) theme: {{Output|1=<nowiki>lookandfeeltool -a 'org.kde.breeze.desktop'</nowiki>}}
 
* Breeze (Light) theme: {{Output|1=<nowiki>lookandfeeltool -a 'org.kde.breeze.desktop'</nowiki>}}
 
* Breeze (Dark) theme: {{Output|1=<nowiki>lookandfeeltool -a 'org.kde.breezedark.desktop'</nowiki>}}
 
* Breeze (Dark) theme: {{Output|1=<nowiki>lookandfeeltool -a 'org.kde.breezedark.desktop'</nowiki>}}
  
==Brightness settings==
+
===Brightness settings=== <!--T:8-->
 +
 
 +
<!--T:14-->
 
* Brightness Up: {{Output|1=<nowiki>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)</nowiki>}}
 
* Brightness Up: {{Output|1=<nowiki>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)</nowiki>}}
* Brightness Down: {{Output|1=<nowiki>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.brightness) + 375)</nowiki>}}
+
* Brightness Down: {{Output|1=<nowiki>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)</nowiki>}}
 +
 
 +
===Screen capture=== <!--T:9-->
  
==Screenshot==
+
<!--T:15-->
 
* Save locally: {{Output|1=<nowiki>spectacle -b</nowiki>}}
 
* Save locally: {{Output|1=<nowiki>spectacle -b</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 to phone: {{Output|1=<nowiki>file=/tmp/$(hostname)_$(date "+%Y%m%d_%H%M%S").png; spectacle -bo "${file}" && while ! [ -f "${file}" ]; do sleep 0.5; done && kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --share "${file}"</nowiki>}}
 +
* Save webcam photo in the Images folder and send to phone: {{Output|1=<nowiki>file="$HOME/Images/WebcamImage_$(date "+%Y%m%d_%H%M%S").jpg"; ffmpeg -f video4linux2 -s 1280x720 -i /dev/video0 -ss 0:0:2 -frames 1 "${file}" && kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --share "${file}"</nowiki>}}
  
 +
===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 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 whether service sshd is running: {{Output|1=<nowiki>kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --ping-msg "$(systemctl status sshd|grep Active)"</nowiki>}}
 +
* Check the top 5 applications using most RAM: {{Output|1=<nowiki>kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --ping-msg "$(ps -eo pid,%mem,cmd --sort=-%mem | head -n 6)"</nowiki>}}
  
 +
<!--T:16-->
 +
[[Category:Tutorials]]
 
</translate>
 
</translate>

Latest revision as of 16:19, 26 October 2020

Other languages:
English • ‎català • ‎dansk • ‎français • ‎português do Brasil • ‎українська

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)

Screen capture

  • Save locally:
    spectacle -b
  • Send to phone:
    file=/tmp/$(hostname)_$(date "+%Y%m%d_%H%M%S").png; spectacle -bo "${file}" && while ! [ -f "${file}" ]; do sleep 0.5; done && kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --share "${file}"
  • Save webcam photo in the Images folder and send to phone:
    file="$HOME/Images/WebcamImage_$(date "+%Y%m%d_%H%M%S").jpg"; ffmpeg -f video4linux2 -s 1280x720 -i /dev/video0 -ss 0:0:2 -frames 1 "${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)"
  • Check the top 5 applications using most RAM:
    kdeconnect-cli -d $(kdeconnect-cli -a --id-only) --ping-msg "$(ps -eo pid,%mem,cmd --sort=-%mem | head -n 6)"

This page was last edited on 26 October 2020, at 16:19. Content is available under Creative Commons License SA 4.0 unless otherwise noted.