gBar/src/System.h

107 lines
2.1 KiB
C
Raw Normal View History

2023-01-13 15:13:56 +00:00
#pragma once
#include <functional>
2023-01-13 15:13:56 +00:00
#include <string>
#include <vector>
namespace System
{
// From 0-1, all cores
double GetCPUUsage();
// Tctl
double GetCPUTemp();
double GetBatteryPercentage();
2023-01-13 15:13:56 +00:00
struct RAMInfo
{
double totalGiB;
double freeGiB;
};
RAMInfo GetRAMInfo();
#ifdef WITH_NVIDIA
2023-01-13 15:13:56 +00:00
struct GPUInfo
{
double utilisation;
double coreTemp;
};
GPUInfo GetGPUInfo();
struct VRAMInfo
{
double totalGiB;
double usedGiB;
};
VRAMInfo GetVRAMInfo();
#endif
struct DiskInfo
{
double totalGiB;
double usedGiB;
};
DiskInfo GetDiskInfo();
#ifdef WITH_BLUEZ
2023-01-13 15:13:56 +00:00
struct BluetoothDevice
{
bool connected;
bool paired;
std::string mac;
2023-01-13 15:13:56 +00:00
std::string name;
// Known types: input-[keyboard,mouse]; audio-headset
std::string type;
};
struct BluetoothInfo
{
std::string defaultController;
std::vector<BluetoothDevice> devices;
};
BluetoothInfo GetBluetoothInfo();
void StartBTScan();
void StopBTScan();
// MT functions, callback, is from different thread
void ConnectBTDevice(BluetoothDevice& device, std::function<void(bool, BluetoothDevice&)> onFinish);
void DisconnectBTDevice(BluetoothDevice& device, std::function<void(bool, BluetoothDevice&)> onFinish);
void OpenBTWidget();
std::string BTTypeToIcon(const BluetoothDevice& dev);
2023-01-13 15:13:56 +00:00
#endif
struct AudioInfo
{
double volume;
bool muted;
};
AudioInfo GetAudioInfo();
void SetVolume(double volume);
#ifdef WITH_HYPRLAND
2023-01-13 15:13:56 +00:00
enum class WorkspaceStatus
{
Dead,
Inactive,
Visible,
Current,
Active
};
WorkspaceStatus GetWorkspaceStatus(uint32_t monitor, uint32_t workspace);
void GotoWorkspace(uint32_t workspace);
std::string GetWorkspaceSymbol(int index);
2023-01-13 15:13:56 +00:00
#endif
std::string GetTime();
void Shutdown();
void Reboot();
void ExitWM();
void Lock();
void Suspend();
void Init();
void FreeResources();
}