103 lines
2.6 KiB
Lua
103 lines
2.6 KiB
Lua
-- custom-functions.lua
|
|
local C = {}
|
|
|
|
function C.remoteKM()
|
|
hl.dsp.exec_cmd("/home/venus/.config/scripts/connectPhone.sh ")
|
|
hl.dsp.exec_cmd("scrcpy --no-audio --no-video --keyboard=uhid --mouse=uhid")
|
|
end
|
|
|
|
function C.remoteScreen()
|
|
hl.dsp.exec_cmd("/home/venus/.config/scripts/connectPhone.sh ")
|
|
hl.dsp.exec_cmd("scrcpy --no-audio --keyboard=uhid --mouse=uhid")
|
|
end
|
|
|
|
local function OddesyConnectionStatus() -- returns connections status of oddesy monitor
|
|
local monitors = hl.get_monitors()
|
|
for _,m in ipairs(monitors) do
|
|
if m.description == "Samsung Electric Company Odyssey G95C HNTL300212" then
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
function C.ToggleOddessyConnection() -- Enables or disables oddessy monitor
|
|
local s = OddesyConnectionStatus()
|
|
if s then
|
|
hl.exec_cmd('notify-send "Disabled Oddesy"')
|
|
hl.monitor({ output = "DP-2", disabled = true })
|
|
else
|
|
hl.exec_cmd('notify-send "Enabled Oddesy"')
|
|
hl.monitor({ output = "DP-2", disabled = false })
|
|
end
|
|
end
|
|
|
|
|
|
local function fanState()
|
|
-- return the current fan profile in use
|
|
local handle = io.popen("fw-fanctl print")
|
|
if not handle then return "unknown" end
|
|
|
|
local result = handle:read("*a")
|
|
handle:close()
|
|
|
|
if result:find("laziest") then
|
|
return "laziest"
|
|
end
|
|
if result:find("medium") then
|
|
return "medium"
|
|
end
|
|
if result:find("deaf") then
|
|
return "deaf"
|
|
end
|
|
|
|
return "unknown"
|
|
end
|
|
|
|
function C.switchFanSate()
|
|
-- switch between lazy and performance fan profiles
|
|
if fanState() == "unknown" then
|
|
hl.exec_cmd('notify-send "fan profile unknown"')
|
|
return
|
|
elseif fanState() == "laziest" then
|
|
hl.exec_cmd("fw-fanctl set medium")
|
|
hl.exec_cmd('notify-send "fan profile set to medium"')
|
|
elseif fanState() == "medium" then
|
|
hl.exec_cmd("fw-fanctl set deaf")
|
|
hl.exec_cmd('notify-send "fan profile set to deaf"')
|
|
else
|
|
hl.exec_cmd("fw-fanctl set laziest")
|
|
hl.exec_cmd('notify-send "fan profile set to laziest"')
|
|
end
|
|
end
|
|
|
|
|
|
return C
|
|
|
|
-- local function CompilerWindowOpen()
|
|
-- local clients = hl.get_windows()
|
|
-- for _,w in ipairs(clients) do
|
|
-- if w.tags == "compiler" then
|
|
-- return w.stable_id
|
|
-- end
|
|
-- end
|
|
-- hl.exec_cmd("kitty", {
|
|
-- hl.dsp.window.tag = { action = "add", value = "compiler" },
|
|
-- })
|
|
-- return false
|
|
-- end
|
|
|
|
-- function C.RunDevelopementCode()
|
|
-- local o = CompilerWindowOpen()
|
|
-- if o then
|
|
-- hl.exec_cmd('notify-send "open"')
|
|
-- else
|
|
-- hl.exec_cmd('notify-send "none"')
|
|
-- end
|
|
-- -- if no tagged kitty window exists, create one
|
|
-- -- color the border red
|
|
-- -- if a tagged compiler window does exist
|
|
-- -- switch to that window and run the last command
|
|
-- -- expand later with dynamic analysis of commands
|
|
-- end
|