KDE Connect/Tutorials/Useful commands: Difference between revisions
m (Fix minor typo) |
(Marked this version for translation) |
||
(28 intermediate revisions by 10 users not shown) | |||
Line 1: | Line 1: | ||
<languages /> | <languages /> | ||
<translate> | <translate> | ||
=List of example commands for KDE Connect= <!--T:1--> | ==List of example commands for KDE Connect== <!--T:1--> | ||
<!--T:2--> | <!--T:2--> | ||
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! | 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! | ||
==Control your computer state== <!--T:3--> | ===Control your computer state=== <!--T:3--> | ||
<!--T:4--> | <!--T:4--> | ||
Line 15: | Line 15: | ||
* 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>}} | ||
* Turn off screen: {{Output|1=<nowiki> | * Turn off screen: {{Output|1=<nowiki>sleep 0.1 && qdbus org.kde.kglobalaccel /component/org_kde_powerdevil invokeShortcut "Turn Off Screen"</nowiki>}} | ||
* Lock keyboard and mouse (not the screen): {{Output|1=<nowiki>pyxtrlock</nowiki>}} | * Lock keyboard and mouse (not the screen): {{Output|1=<nowiki>pyxtrlock</nowiki>}} | ||
* Unlock keyboard and mouse: {{Output|1=<nowiki>pkill pyxtrlock</nowiki>}} | * Unlock keyboard and mouse: {{Output|1=<nowiki>pkill pyxtrlock</nowiki>}} | ||
==Volume control== <!--T:5--> | ===Volume control=== <!--T:5--> | ||
===Plasma=== | |||
====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>}} | ||
Line 27: | Line 30: | ||
* Mute microphone: {{Output|1=<nowiki>qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "mic_mute"</nowiki>}} | * Mute microphone: {{Output|1=<nowiki>qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "mic_mute"</nowiki>}} | ||
===Other DE/WM (with pactl)=== <!--T:6--> | ====Other DE/WM (with pactl)==== <!--T:6--> | ||
* 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>}} | <!--T:12--> | ||
* Mute/Unmute: {{Output|1=<nowiki>pactl set-sink-mute $(pactl list short sinks | grep RUNNING | cut -f1) toggle</nowiki>}} | * Volume down: {{Output|1=<nowiki> | ||
pactl set-sink-volume @DEFAULT_SINK@ -10% | |||
## OR | |||
pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f1) -10% | |||
</nowiki>}} | |||
<!--T:21--> | |||
* Volume up: {{Output|1=<nowiki> | |||
pactl set-sink-volume @DEFAULT_SINK@ +10% | |||
## OR | |||
pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f1) +10% | |||
</nowiki>}} | |||
<!--T:22--> | |||
* Mute/Unmute: {{Output|1=<nowiki> | |||
pactl set-sink-mute @DEFAULT_SINK@ toggle | |||
## OR | |||
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== <!--T:8--> | ===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) | * 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--> | |||
<!--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>}} | |||
===Windows Specific Commands === <!--T:23--> | |||
<!--T:24--> | |||
The location for runcommands created in the application, if you decide to copy them can be found in: | |||
<!--T:25--> | |||
First go to: {{Path|C:\Users\%USERNAME%\AppData\Local\Packages\}} | |||
<!--T:26--> | |||
then find KDE folder and navigate down to kdenconnect folder {{Path|..\KDEe.V.KDEConnect_[HASH]\LocalCache\Local\kdeconnect}} | |||
<!--T:27--> | |||
Within the folder you'll find folders that are specific to paired devices with the format: | |||
<!--T:28--> | |||
{{Path|deviceid/kdeconnect_runcommand/config}} | |||
<!--T:29--> | |||
if yours has a config file, '''this config file is what you copy between other device ids to use the same commmands elsewhere'''. | |||
Then that paired device has the commands you created within the KDE windows app from a remote device. | |||
<!--T:30--> | |||
If it doesn't have a config file, you didn't set up custom commands in the kde windows application. | |||
<!--T:31--> | |||
---- | |||
<!--T:32--> | |||
The commands will generally in one of three ways: | |||
<!--T:33--> | |||
1.) Anything specific to rundll32 commands or user32 dll commands e.g. "Rundll32.exe user32.dll,LockWorkStation" | |||
<!--T:34--> | |||
2.) Commands that you would run via the shell/powershell/or command prompt "start powershell -NoExit -command <command>" (start and powershell are optional -NoExit flag to keep window from closing) and so are similar to launching it from the start menu. | |||
<!--T:35--> | |||
3.)Finally, the third option here is using software called [https://www.nirsoft.net/utils/nircmd.html Nircmd] | |||
<!--T:36--> | |||
---- | |||
("Start Powershell" is optional, as nircmd can run without having to show a shell prompt) So more than one format is provided. | |||
<!--T:37--> | |||
Example Windows commands include: | |||
<!--T:38--> | |||
*Lock Station | |||
{{Output|1=<nowiki>Rundll32.exe user32.dll,LockWorkStation</nowiki>}} | |||
<!--T:39--> | |||
*Unlock Workstation | |||
<!--T:40--> | |||
*Toggle Mute | |||
{{Output|1=<nowiki>start powershell -command nircmd mutesysvolume 2</nowiki>}} | |||
<!--T:41--> | |||
*Mute System Volume | |||
{{Output|1=<nowiki>start powershell -command nircmd mutesysvolume 1</nowiki>}} | |||
<!--T:42--> | |||
*UnMute System Volume | |||
{{Output|1=<nowiki>start powershell -command nircmd mutesysvolume 0</nowiki>}} | |||
<!--T:43--> | |||
*System Volume 25% | |||
{{Output|1=<nowiki>start powershell -command nircmd nircmd.exe setsysvolume 16383.75</nowiki>}} | |||
<!--T:44--> | |||
*System Volume 50% | |||
{{Output|1=<nowiki>start powershell -command nircmd nircmd.exe setsysvolume 32767.5</nowiki>}} | |||
<!--T:45--> | |||
*System Volume 75% | |||
{{Output|1=<nowiki>start powershell -command nircmd nircmd.exe setsysvolume 49151.25</nowiki>}} | |||
<!--T:46--> | |||
*System Volume 100% | |||
{{Output|1=<nowiki>start powershell -command nircmd nircmd.exe setsysvolume 65535</nowiki>}} | |||
<!--T:47--> | |||
*System Volume Up 2000 units (out of 65535) - Number Value Can be to whatever way you prefer, but the volume shifts by that % | |||
{{Output|1=<nowiki>nircmd changesysvolume 2000</nowiki>}} | |||
<!--T:48--> | |||
*System Volume Down 5000 units (out of 65535) | |||
{{Output|1=<nowiki>nircmd.exe changesysvolume -5000</nowiki>}} | |||
<!--T:49--> | |||
*Shutdown Computer | |||
{{Output|1=<nowiki>start powershell -command exitwin poweroff</nowiki>}} | |||
<!--T:50--> | |||
*Mute Mic | |||
WIP | |||
<!--T:51--> | |||
*Immediate Shutdown | |||
{{Output|1=<nowiki>shutdown /s /t 0</nowiki>}} | |||
<!--T:52--> | |||
*Restart Computer | |||
{{Output|1=<nowiki>shutdown /r</nowiki>}} | |||
<!--T:53--> | |||
*Cancel Shutdown | |||
{{Output|1=<nowiki>shutdown /a</nowiki>}} | |||
<!--T:54--> | |||
Youtube control and media control can also be done via simulated keypresses through nircmd. You can either set them to your preference. | |||
<!--T:55--> | |||
**To extend further, commands run via and android phone open a URL, opening that URL launches the command -> and so use of that command via tasker, or KWGT is possible. | |||
<!--T:56--> | |||
For example : | |||
<!--T:57--> | |||
Remapping to KDE connect the bottom become: | |||
If nircmd installed to windows directory | |||
<!--T:58--> | |||
* Like Song | |||
nircmd sendkeypress plus | |||
<!--T:59--> | |||
* Next Song | |||
nircmd sendkeypress j | |||
<!--T:60--> | |||
* Previous Song | |||
nircmd sendkeypress k | |||
<!--T:61--> | |||
* Shuffle Queue | |||
nircmd sendkeypress s | |||
<!--T:62--> | |||
* Toggle Repeat | |||
nircmd sendkeypress r | |||
<!--T:63--> | |||
* Volume up | |||
nircmd sendkeypress shift+plus | |||
<!--T:64--> | |||
* Volume down | |||
nircmd sendkeypress minus | |||
<!--T:65--> | |||
* Mute | |||
nircmd sendkeypress m | |||
<!--T:66--> | |||
More commands can be found at, use at your own risk: | |||
<!--T:67--> | |||
For Rundll32 | |||
[https://www.tenforums.com/tutorials/77458-rundll32-commands-list-windows-10-a.html here] | |||
and | |||
[https://www.elevenforum.com/t/complete-list-of-rundll32-commands-in-windows-11.17062/ here] | |||
<!--T:68--> | |||
For Powershell | |||
[https://ss64.com/ps/ here] and | |||
[https://devblogs.microsoft.com/scripting/table-of-basic-powershell-commands/ here] | |||
<!--T:69--> | |||
For nircmd: | |||
[https://www.nirsoft.net/utils/nircmd.html here] | |||
<!--T:16--> | |||
[[Category:Tutorials]] | |||
</translate> | </translate> |
Latest revision as of 10:37, 23 November 2024
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:
sleep 0.1 && qdbus org.kde.kglobalaccel /component/org_kde_powerdevil invokeShortcut "Turn Off Screen"
- 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 @DEFAULT_SINK@ -10% ## OR pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f1) -10%
- Volume up:
pactl set-sink-volume @DEFAULT_SINK@ +10% ## OR pactl set-sink-volume $(pactl list short sinks | grep RUNNING | cut -f1) +10%
- Mute/Unmute:
pactl set-sink-mute @DEFAULT_SINK@ toggle ## OR 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)"
Windows Specific Commands
The location for runcommands created in the application, if you decide to copy them can be found in:
First go to: C:\Users\%USERNAME%\AppData\Local\Packages\
then find KDE folder and navigate down to kdenconnect folder ..\KDEe.V.KDEConnect_[HASH]\LocalCache\Local\kdeconnect
Within the folder you'll find folders that are specific to paired devices with the format:
deviceid/kdeconnect_runcommand/config
if yours has a config file, this config file is what you copy between other device ids to use the same commmands elsewhere. Then that paired device has the commands you created within the KDE windows app from a remote device.
If it doesn't have a config file, you didn't set up custom commands in the kde windows application.
The commands will generally in one of three ways:
1.) Anything specific to rundll32 commands or user32 dll commands e.g. "Rundll32.exe user32.dll,LockWorkStation"
2.) Commands that you would run via the shell/powershell/or command prompt "start powershell -NoExit -command <command>" (start and powershell are optional -NoExit flag to keep window from closing) and so are similar to launching it from the start menu.
3.)Finally, the third option here is using software called Nircmd
("Start Powershell" is optional, as nircmd can run without having to show a shell prompt) So more than one format is provided.
Example Windows commands include:
- Lock Station
Rundll32.exe user32.dll,LockWorkStation
- Unlock Workstation
- Toggle Mute
start powershell -command nircmd mutesysvolume 2
- Mute System Volume
start powershell -command nircmd mutesysvolume 1
- UnMute System Volume
start powershell -command nircmd mutesysvolume 0
- System Volume 25%
start powershell -command nircmd nircmd.exe setsysvolume 16383.75
- System Volume 50%
start powershell -command nircmd nircmd.exe setsysvolume 32767.5
- System Volume 75%
start powershell -command nircmd nircmd.exe setsysvolume 49151.25
- System Volume 100%
start powershell -command nircmd nircmd.exe setsysvolume 65535
- System Volume Up 2000 units (out of 65535) - Number Value Can be to whatever way you prefer, but the volume shifts by that %
nircmd changesysvolume 2000
- System Volume Down 5000 units (out of 65535)
nircmd.exe changesysvolume -5000
- Shutdown Computer
start powershell -command exitwin poweroff
- Mute Mic
WIP
- Immediate Shutdown
shutdown /s /t 0
- Restart Computer
shutdown /r
- Cancel Shutdown
shutdown /a
Youtube control and media control can also be done via simulated keypresses through nircmd. You can either set them to your preference.
- To extend further, commands run via and android phone open a URL, opening that URL launches the command -> and so use of that command via tasker, or KWGT is possible.
For example :
Remapping to KDE connect the bottom become: If nircmd installed to windows directory
- Like Song
nircmd sendkeypress plus
- Next Song
nircmd sendkeypress j
- Previous Song
nircmd sendkeypress k
- Shuffle Queue
nircmd sendkeypress s
- Toggle Repeat
nircmd sendkeypress r
- Volume up
nircmd sendkeypress shift+plus
- Volume down
nircmd sendkeypress minus
- Mute
nircmd sendkeypress m
More commands can be found at, use at your own risk:
For nircmd: here