2023-12-29 12:40:35 +01:00
|
|
|
"""Constants for the Easy Computer Manager integration."""
|
2023-04-04 13:44:07 +02:00
|
|
|
|
2023-12-29 12:40:35 +01:00
|
|
|
DOMAIN = "easy_computer_manager"
|
2023-04-04 13:44:07 +02:00
|
|
|
SERVICE_SEND_MAGIC_PACKET = "send_magic_packet"
|
|
|
|
SERVICE_RESTART_TO_WINDOWS_FROM_LINUX = "restart_to_windows_from_linux"
|
2023-04-06 19:15:41 +02:00
|
|
|
SERVICE_RESTART_TO_LINUX_FROM_WINDOWS = "restart_to_linux_from_windows"
|
2023-04-04 13:44:07 +02:00
|
|
|
SERVICE_PUT_COMPUTER_TO_SLEEP = "put_computer_to_sleep"
|
|
|
|
SERVICE_START_COMPUTER_TO_WINDOWS = "start_computer_to_windows"
|
2023-12-28 22:40:29 +01:00
|
|
|
SERVICE_RESTART_COMPUTER = "restart_computer"
|
|
|
|
SERVICE_CHANGE_MONITORS_CONFIG = "change_monitors_config"
|
2023-12-30 15:32:31 +01:00
|
|
|
SERVICE_STEAM_BIG_PICTURE = "steam_big_picture"
|
2023-12-30 18:45:14 +01:00
|
|
|
SERVICE_CHANGE_AUDIO_CONFIG = "change_audio_config"
|
2023-12-30 21:20:42 +01:00
|
|
|
SERVICE_DEBUG_INFO = "debug_info"
|
2024-08-25 23:20:39 +02:00
|
|
|
|
|
|
|
|
2024-08-26 17:43:15 +02:00
|
|
|
ACTIONS = {
|
2024-08-25 23:20:39 +02:00
|
|
|
"operating_system": {
|
|
|
|
"linux": ["uname"]
|
|
|
|
},
|
|
|
|
"operating_system_version": {
|
|
|
|
"windows": ['for /f "tokens=1 delims=|" %i in (\'wmic os get Name ^| findstr /B /C:"Microsoft"\') do @echo %i'],
|
|
|
|
"linux": ["awk -F'=' '/^NAME=|^VERSION=/{gsub(/\"/, \"\", $2); printf $2\" \"}\' /etc/os-release && echo", "lsb_release -a | awk '/Description/ {print $2, $3, $4}'"]
|
|
|
|
},
|
2024-08-26 20:39:22 +02:00
|
|
|
"desktop_environment": {
|
2024-08-26 20:51:33 +02:00
|
|
|
"linux": ["for session in $(ls /usr/bin/*session 2>/dev/null); do basename $session | sed 's/-session//'; done | grep -E 'gnome|kde|xfce|mate|lxde|cinnamon|budgie|unity' | head -n 1"],
|
2024-08-26 20:39:22 +02:00
|
|
|
"windows": ["echo Windows"]
|
|
|
|
},
|
2024-08-25 23:20:39 +02:00
|
|
|
"shutdown": {
|
|
|
|
"windows": ["shutdown /s /t 0", "wmic os where Primary=TRUE call Shutdown"],
|
|
|
|
"linux": ["sudo shutdown -h now", "sudo init 0", "sudo systemctl poweroff"]
|
|
|
|
},
|
|
|
|
"restart": {
|
|
|
|
"windows": ["shutdown /r /t 0", "wmic os where Primary=TRUE call Reboot"],
|
|
|
|
"linux": ["sudo shutdown -r now", "sudo init 6", "sudo systemctl reboot"]
|
|
|
|
},
|
|
|
|
"sleep": {
|
|
|
|
"windows": ["shutdown /h /t 0", "rundll32.exe powrprof.dll,SetSuspendState Sleep"],
|
|
|
|
"linux": ["sudo systemctl suspend", "sudo pm-suspend"]
|
|
|
|
},
|
|
|
|
"get_windows_entry_grub": {
|
|
|
|
"linux": ["sudo awk -F \"'\" '/windows/ {print $2}' /boot/grub/grub.cfg",
|
|
|
|
"sudo awk -F \"'\" '/windows/ {print $2}' /boot/grub2/grub.cfg"]
|
|
|
|
},
|
|
|
|
"set_grub_entry": {
|
2024-08-26 22:14:00 +02:00
|
|
|
"linux": {
|
|
|
|
"commands": ["sudo grub-reboot %grub-entry%", "sudo grub2-reboot %grub-entry%"],
|
|
|
|
"params": ["grub-entry"],
|
|
|
|
}
|
2024-08-26 17:43:15 +02:00
|
|
|
},
|
|
|
|
"get_monitors_config": {
|
|
|
|
"linux": ["gnome-monitor-config list"]
|
2024-08-26 19:01:32 +02:00
|
|
|
},
|
2024-08-26 22:14:00 +02:00
|
|
|
"set_monitors_config": {
|
|
|
|
"linux": {
|
|
|
|
"gnome": {
|
|
|
|
"command": "gnome-monitor-config set %args%",
|
|
|
|
"params": ["args"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2024-08-26 19:01:32 +02:00
|
|
|
"get_speakers": {
|
2024-08-26 19:16:44 +02:00
|
|
|
"linux": ["LANG=en_US.UTF-8 pactl list sinks"]
|
2024-08-26 19:01:32 +02:00
|
|
|
},
|
|
|
|
"get_microphones": {
|
2024-08-26 19:16:44 +02:00
|
|
|
"linux": ["LANG=en_US.UTF-8 pactl list sources"]
|
2024-08-26 19:01:32 +02:00
|
|
|
},
|
|
|
|
"get_bluetooth_devices": {
|
2024-08-26 22:14:00 +02:00
|
|
|
"linux": {
|
|
|
|
"command": "bluetoothctl info",
|
|
|
|
"raise_on_error": False,
|
|
|
|
}
|
2024-08-25 23:20:39 +02:00
|
|
|
}
|
|
|
|
}
|