nVidia overclocking by right mouse button

This commit is contained in:
Kolan Sh 2017-06-26 15:46:23 +03:00
parent d66189d5d8
commit 82f1cfd2b1
3 changed files with 22 additions and 6 deletions

19
rc.lua
View File

@ -223,6 +223,7 @@ gmail_mail:buttons(mailicon:buttons())
-- nVidia Optimus -- nVidia Optimus
local optimus_icon = wibox.widget.imagebox() local optimus_icon = wibox.widget.imagebox()
local optimus_overclocked = false
optimus_icon:set_image(beautiful.widget_optimus_off) optimus_icon:set_image(beautiful.widget_optimus_off)
optimus_icon.timer = timer{timeout=3} optimus_icon.timer = timer{timeout=3}
optimus_icon.timer:connect_signal("timeout", optimus_icon.timer:connect_signal("timeout",
@ -232,9 +233,14 @@ optimus_icon.timer:connect_signal("timeout",
if f ~= nil then if f ~= nil then
l = f:read() l = f:read()
if string.sub (l, 14) == "ON" then if string.sub (l, 14) == "ON" then
if optimus_overclocked == true then
optimus_icon:set_image(beautiful.widget_optimus_overclocked)
else
optimus_icon:set_image(beautiful.widget_optimus_on) optimus_icon:set_image(beautiful.widget_optimus_on)
end
else else
optimus_icon:set_image(beautiful.widget_optimus_off) optimus_icon:set_image(beautiful.widget_optimus_off)
optimus_overclocked = false
end end
f:close() f:close()
else else
@ -242,11 +248,20 @@ optimus_icon.timer:connect_signal("timeout",
end end
end) end)
optimus_icon.timer:start() optimus_icon.timer:start()
optimus_icon:buttons(awful.util.table.join(awful.button({ }, 1, optimus_icon:buttons(awful.util.table.join(
awful.button({ }, 1,
function () function ()
os.execute ("pgrep nvidia-settings || optirun nvidia-settings -c :8 &") os.execute ("pgrep nvidia-settings || optirun nvidia-settings -c :8 &")
end end
))) ),
awful.button({ }, 3,
function ()
os.execute ("optirun nvidia-settings -c :8 -a '[gpu:0]/GPUGraphicsClockOffset[2]=135' &")
os.execute ("optirun nvidia-settings -c :8 -a '[gpu:0]/GPUMemoryTransferRateOffset[2]=605' &")
optimus_overclocked = true
end
)
))
-- Wi-Fi / Ethernet widgets -- Wi-Fi / Ethernet widgets
local wifi_widget_down = wibox.widget.textbox() local wifi_widget_down = wibox.widget.textbox()

View File

@ -127,6 +127,7 @@ theme.widget_mail = awful.util.getdir("config") .. "/themes/default/widgets/mail
theme.widget_mailnew = awful.util.getdir("config") .. "/themes/default/widgets/mailnew.png" theme.widget_mailnew = awful.util.getdir("config") .. "/themes/default/widgets/mailnew.png"
theme.widget_optimus_off = awful.util.getdir("config") .. "/themes/default/widgets/optimus_off.png" theme.widget_optimus_off = awful.util.getdir("config") .. "/themes/default/widgets/optimus_off.png"
theme.widget_optimus_on = awful.util.getdir("config") .. "/themes/default/widgets/optimus_on.png" theme.widget_optimus_on = awful.util.getdir("config") .. "/themes/default/widgets/optimus_on.png"
theme.widget_optimus_overclocked = awful.util.getdir("config") .. "/themes/default/widgets/optimus_overclocked.png"
theme.widget_temp = awful.util.getdir("config") .. "/themes/default/widgets/temp.png" theme.widget_temp = awful.util.getdir("config") .. "/themes/default/widgets/temp.png"
theme.widget_tempwarn = awful.util.getdir("config") .. "/themes/default/widgets/tempwarm.png" theme.widget_tempwarn = awful.util.getdir("config") .. "/themes/default/widgets/tempwarm.png"
theme.widget_temphot = awful.util.getdir("config") .. "/themes/default/widgets/temphot.png" theme.widget_temphot = awful.util.getdir("config") .. "/themes/default/widgets/temphot.png"

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB