This is more of a note-to-self; cause I keep changing either the mobile or the Linux distro.
What are we solving?
I wake up late, but don't want my boss to know I start late. Opening Slack on computer is not much of a task, but my laziness knows no bounds. Wouldn't if be great if I didn't have to get up from bed, unlock my computer, then open Slack? Yes. That would indeed be life changing.
How do we solve it?
No worries, says KDE Connect.
KD What?
KDE Connect. It's an application; well a pair of applications. One is installed on your computer and the other on your phone, so that you can connect them both together. Both of them needs to be on the same network (example, home WiFi) though.
Once connected, you can do stuff from phone to your computer and vice versa. You get to decide exactly what you allow each of the pair to do.
One of the things you can decide to do is run commands on your computer from your mobile.
Ok, But how do I wake up late and still keep my job?
Since you would be doing things to your computer, we go to your computer first.
On the computer
Install and open KDE Connect desktop application.

Select your mobile name on left panel. That would display a LOT of options in the "Available plugins" section on right. We would want to search for command
in the search box, below Unpair
button. Clicking on settings icon next to "Run commands" option would bring us to the configuration (below) we are interested in.

As, you can see I have a bunch of other commands there; not all of it can run on all desktop machines. For example, Screen Off command can only run on a Linux KDE Desktop environments.
See a list of other cool commands you can add, here.
The ones I use frequently are:
Name | Command |
---|---|
Lock | loginctl lock-session |
Reboot | systemctl reboot |
Shutdown | systemctl poweroff |
Screen Off | sleep 0.1 && qdbus org.kde.kglobalaccel /component/org_kde_powerdevil invokeShortcut "Turn Off Screen" |
Unlock | loginctl unlock-session |
Volume Down | qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "decrease_volume" |
Volume Up | qdbus org.kde.kglobalaccel /component/kmix invokeShortcut "increase_volume" |
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) |
On to your phone now
On KDE Connect mobile application, all the commands we configured on computer would be shown under "Run Command" option.
Press on the one you would want to execute and it will execute on your computer.
But, there is more... A lot more
KDE Connect does quite a lot of things other than what we discuss here. Do explore it to know more.