Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --gpuselect автор Таоши
- --корректно работает при наличии одной клавиатуры в системе
- --перекидывает лучшую видеокарту на лучший монитор.
- --Подразумевается, что лучший монитор - с клавиатурой
- local component=require('component')
- local gpus={}
- for addr in component.list('gpu') do gpus[#gpus+1]=addr end
- local scr={}
- for addr in component.list('scree') do scr[#scr+1]=addr end
- local memory=component.proxy(gpus[1]).totalMemory()
- local best=1
- for n=1,#gpus do
- if memory<component.proxy(gpus[n]).totalMemory() then
- memory=component.proxy(gpus[n]).totalMemory()
- best=n
- end
- print(memory,n,component.proxy(gpus[n]).totalMemory())
- end
- bestscr=1
- local max_res=0
- for n=1,#scr do
- component.proxy(gpus[best]).bind(scr[n],true)
- if max_res<component.proxy(gpus[best]).maxResolution() then
- max_res=component.proxy(gpus[best]).maxResolution()
- bestscr=n
- end
- print('scr='..n..'bestscr='..bestscr)
- end
- component.proxy(gpus[best]).bind(scr[bestscr],true)
Add Comment
Please, Sign In to add comment