From a88e255d6df5e35b8ca89905909ec091a090a6f8 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sun, 25 Sep 2016 17:46:35 +0300 Subject: [PATCH] nVidia Optimus activity icon added. Several Wine applications leave *.exe processes which hold the optirun/primusrun process and the nVidia card stays ON. --- rc.lua | 24 ++++++++++++++++++++++++ themes/default/theme.lua | 2 ++ themes/default/widgets/optimus_off.png | Bin 0 -> 3933 bytes themes/default/widgets/optimus_on.png | Bin 0 -> 2767 bytes 4 files changed, 26 insertions(+) create mode 100644 themes/default/widgets/optimus_off.png create mode 100644 themes/default/widgets/optimus_on.png diff --git a/rc.lua b/rc.lua index ebf6a0d..997d408 100644 --- a/rc.lua +++ b/rc.lua @@ -216,6 +216,28 @@ gmail_mail.timer:connect_signal("timeout", gmail_mail.timer:start() gmail_mail:buttons(mailicon:buttons()) +-- nVidia Optimus +local optimus_icon = wibox.widget.imagebox() +optimus_icon:set_image(beautiful.widget_optimus_off) +optimus_icon.timer = timer{timeout=3} +optimus_icon.timer:connect_signal("timeout", + function () + local f = io.open("/proc/acpi/bbswitch", "r") + local l = nil + if f ~= nil then + l = f:read() + if string.sub (l, 14) == "ON" then + optimus_icon:set_image(beautiful.widget_optimus_on) + else + optimus_icon:set_image(beautiful.widget_optimus_off) + end + f:close() + else + optimus_icon:set_image(beautiful.widget_optimus_off) + end + end) +optimus_icon.timer:start() + -- Wi-Fi / Ethernet widgets local wifi_widget_down = wibox.widget.textbox() local wifi_widget_up = wibox.widget.textbox() @@ -281,6 +303,8 @@ for s = 1, screen.count() do right_layout:add(mem) right_layout:add(diskicon) right_layout:add(disk) + right_layout:add(optimus_icon) + right_layout:add(spacer) right_layout:add(baticon) right_layout:add(batpct) right_layout:add(icon_wifi) diff --git a/themes/default/theme.lua b/themes/default/theme.lua index cd7c4ae..64fc1cd 100644 --- a/themes/default/theme.lua +++ b/themes/default/theme.lua @@ -125,6 +125,8 @@ theme.widget_pac = awful.util.getdir("config") .. "/themes/default/widgets/pac.p theme.widget_pacnew = awful.util.getdir("config") .. "/themes/default/widgets/pacnew.png" theme.widget_mail = awful.util.getdir("config") .. "/themes/default/widgets/mail.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_on = awful.util.getdir("config") .. "/themes/default/widgets/optimus_on.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_temphot = awful.util.getdir("config") .. "/themes/default/widgets/temphot.png" diff --git a/themes/default/widgets/optimus_off.png b/themes/default/widgets/optimus_off.png new file mode 100644 index 0000000000000000000000000000000000000000..b5142db63dcf17c29e30e284b29446f0acd2db7f GIT binary patch literal 3933 zcmXX}3p~@``~PHaCE2<#-;^w>Nm#^0$&4`xi)2D_`C^f~mTO2KwdlKsFjF!mjW3#O zZefa=kdZJE%l(VoZ@=~W|6k|zoadb9bzaZwoagd>o|9;O2`9bluU!BDNSm8s2|{l0 zha|;?^VyAWfkGyJ!vco|w*QQ0H7}nCB|H7i9D)EqYTqB)0c6nOLZL*kxuuE3&`$Y1 z(vbdFAFG9;L*BMmgN<+b`g-^U3%3AZ9O&U1?BRYS%sbfY2+rKn+Fjj40s!_jm}8A> zy#}X=q{nvMDbA##&9lkjw+t_sV!>FfXg0Q?$IH~+v}1497c;Zq3;)PNcENW(*F2oL zcS`j@?6ddKk7$)A^2a<(EcRI(61z`HHF}ZSAfdT$O5~$xZf32Zf1xit>b6G6^pB2t zvyBdy?#+(!cIWWu@S2`Vpyro}#+{Cb&cAcy{%;8xnuGo&+TemmIQ-S?cm2?*XIq==;eda_?7H01;YtwQ8$frZFMI}9Hod#@YOa)r0VNPIWk|BzsVh&XE}sRWwsQbG$9pv4XF#%d>m2oU{L z)AjvKK~e46w6mK2? zIesSrf1M(aSd#?GAoa6d+5=^`__f-*8 z6vg7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