- добавляем репозитарий разработчика пакета ironhide:
sudo add-apt-repository ppa:mj-casalogic/ironhide
- делаем апдейт инфы о пакетах
sudo apt-get update
- ставим пакеты ironhide, ironhide-ui,
sudo apt-get install mesa-utils ironhide ironhide-ui
- обязательно делаем
sudo ironhide-configuration
мой Acer 5755g был найден в
списке конфигурацийНастройку выбрал предлагаемую XV, для проверки выбирал YUV и JPEG но они у меня не пошли.
- после конфигурирования перезагружаемся.
после перезагрузки запускаем
ironhide-app-settings
если не запускается с ошибкой
Traceback (most recent call last):
File "/usr/bin/ironhide-indicator", line 169, in app_configure
Applications_settings(file_set=file_set)
File "/usr/share/ironhide-ui/app/AppSettings.py", line 121, in init
self.build_app_list()
File "/usr/share/ironhide-ui/app/AppSettings.py", line 220, in build_app_list
for app_info in self.file_set.get_apps_info():
File "/usr/share/ironhide-ui/app/DesktopFile.py", line 84, in get_apps_info
app_config = desktop_file.get_app_config()
File "/usr/share/ironhide-ui/app/DesktopFile.py", line 171, in get_app_config
self.app_exec= self.config.get('Desktop Entry','Exec')
File "/usr/lib/python2.7/ConfigParser.py", line 610, in get
raise NoOptionError(option, section)
ConfigParser.NoOptionError: No option 'Exec' in section: 'Desktop Entry'
1)удаляем examples.desktop из дирестории пользователя
2)выплняем -
sudo gedit /usr/share/ironhide-ui/app/Config.py
и заменяем
user_relative_desktop_file_directory = '/'
на
user_relative_desktop_file_directory = '/.local/share/applications/'
3) на всякий случай делаем копию ironhide-indicator
sudo cp /usr/share/ironhide-ui/ironhide-indicator /usr/share/ironhide-ui/ironhide-indicator.old
и заменяем его содержание на это
sudo gedit /usr/share/ironhide-ui/ironhide-indicator
#!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <davy.renaud@laposte.net> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return Davy Renaud (glyptostroboides)
# ----------------------------------------------------------------------------
#
# This file is part of ironhide-ui.
#
# ironhide-ui is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ironhide-ui is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ironhide-ui. If not, see <http://www.gnu.org/licenses/>.
#
### END LICENSE
#UI MODULE
import pygtk
pygtk.require('2.0')
import gtk
import gobject
import appindicator
import pynotify
#SYSTEM MODULE
import os
import subprocess
###ORIGINAL CLASS
import app.Config
from app.AppSettings import Applications_settings, IconSet
from app.DesktopFile import DesktopFile, DesktopFileSet
class IronhideIndicator():
#TODO There must be a better way to get the icon than
def notify_state(self,title,msg,icon_name): #Altered by icb410
self.notification= pynotify.Notification(title, msg, IconSet().get_uri(icon_name,48)) #fixed tab indentation to space
self.notification.set_urgency(pynotify.URGENCY_CRITICAL)
#self.notification.set_timeout(pynotify.EXPIRES_NEVER) ###### NICE TO SHOW A MESSAGE SIMPLY
#FIXME The notification is to slow and this doesn't work
#self.notification.set_timeout(1000)
self.notification.show()
###INITIALIZATION OF INDICATOR AND MENU
def __init__(self):
#TODO Choose the best category for the indicator : appindicator.CATEGORY_APPLICATION_STATUS or appindicator.CATEGORY_SYSTEM_SERVICES
self.ind = appindicator.Indicator ("ironhide-indicator", "ironhide-indicator", appindicator.CATEGORY_HARDWARE)
self.ind.set_status (appindicator.STATUS_ACTIVE)
self.ind.set_icon_theme_path(app.Config.icon_file_directory)
#TODO The icons style and accesibility must be enhanced : see icons/test directory
self.ind.set_icon(app.Config.icon_file_directory + "ironhide-indicator.svg",'Ironhide is unactive')
self.ind.set_attention_icon (app.Config.icon_file_directory + "ironhide-indicator-active.svg",'Ironhide is active')
self.card_state=False
self.build_menu()
self.menu.show()
self.ind.set_menu(self.menu)
pynotify.init("ironhide_indicator") #Added to avoid crash by icb410
def quit(self, widget, data=None):
gtk.main_quit()
def build_menu(self):
self.menu = gtk.Menu()
self.switch = gtk.CheckMenuItem()
self.initial_state_checker()
self.switch.set_sensitive(False)
self.menu.append(self.switch)
self.build_menu_separator()
self.prefered_app_submenu = gtk.MenuItem("Preferred Apps")
self.update_menu()
self.prefered_app_submenu.connect('activate', self.update_menu)
self.menu.append(self.prefered_app_submenu)
item2 = gtk.MenuItem("Configure Apps")
item2.connect("activate", self.app_configure)
self.menu.append(item2)
#TODO An UI to configure Ironhide would be nice
#item3 = gtk.MenuItem("Configure Ironhide")
#item3.show()
#self.menu.append(item3)
self.build_menu_separator()
quit = gtk.ImageMenuItem(gtk.STOCK_QUIT)
quit.connect("activate", self.quit)
self.menu.append(quit)
self.menu.show_all()
def build_menu_separator(self):
separator = gtk.SeparatorMenuItem()
separator.show()
self.menu.append(separator)
#FUNCTION TO GET THE MENU FROM THE CONFIG FILE
def update_menu(self, widget=None):
self.pref_menu=gtk.Menu()
subitem = gtk.MenuItem("Glxgears")
subitem.connect("activate", self.call_app, ['optirun', 'glxgears'])
subitem.show()
self.pref_menu.append(subitem)
file_set.get_configured_from_cfg()
for file_name in file_set.configured_set:
[Name, File_name, Categorie, Icon_name] = DesktopFile(file_name).get_app_info()
subitem = gtk.MenuItem(label=Name)
#TODO : Discuss about style : is an icon needed for this simple shortcut
#subitem = gtk.ImageMenuItem()
#subitem.set_image(gtk.image_new_from_pixbuf(IconSet().get_pixbuf(Icon_name,icon_size=gtk.ICON_SIZE_MENU)))
#subitem.set_label(Name)
subitem.connect("activate", self.call_app, DesktopFile(file_name).get_exec_list())
subitem.show()
self.pref_menu.append(subitem)
self.pref_menu.show()
self.prefered_app_submenu.set_submenu(self.pref_menu)
def initial_state_checker(self):
if self.attention_state_condition(): self.set_attention_state(notify=False)
else : self.set_active_state(notify=False)
def state_checker(self):
if self.attention_state_condition():
if self.card_state == False : self.set_attention_state()
elif self.card_state == True: self.set_active_state()
return True
def attention_state_condition(self):
stdout_handle = os.popen("cat /etc/default/ironhide |grep VGL_DISPLAY |cut -f2 -d:", "r")
vgl_display = stdout_handle.read().rstrip("\n")
vgl_display = "/tmp/.X%s-lock" % vgl_display
if os.path.exists(vgl_display): return True
else: return False
def set_attention_state(self, notify=True):
self.ind.set_status(appindicator.STATUS_ATTENTION)
self.card_state = True
if notify == True: self.notify_state("Discrete card : ON", "Discrete graphic card is powered on", "ironhide-indicator-active")
self.switch.set_label("Discrete card : ON")
self.switch.set_active(True)
def set_active_state(self, notify=True):
self.ind.set_status(appindicator.STATUS_ACTIVE)
self.card_state = False
if notify == True: self.notify_state("Discrete card : OFF", "Discrete graphic card is powered off", "ironhide-indicator")
self.switch.set_label("Discrete card : OFF")
self.switch.set_active(False)
def app_configure(self,widget):
Applications_settings(file_set=file_set)
def call_app(self, widget, app_exec):
#FIXME There is a problem when closing the launched app and when the indicator has been closed: the indicator is still running : What a daemon!!
subprocess.Popen(app_exec,shell=False)
def about_box(self, widget, data=None):
dialog = gtk.MessageDialog(None, type=gtk.MESSAGE_INFO,buttons=gtk.BUTTONS_NONE,message_format="Preferences/About")
dialog.format_secondary_text("This is Optimus by mrs_sheep. \n It is based on ironhide by MrMEEE. \n The configuration can (by now) only be set thorugh the config file!")
dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
dialog.run()
dialog.destroy()
def main(self):
self.state_checker()
#FIXME It would be nice to avoid this loop : Maybe by using a signal emitted by the system
#gtk.timeout_add(1000,self.state_checker)
gobject.timeout_add_seconds(2, self.state_checker)
gtk.main()
if __name__ == "__main__":
file_set=DesktopFileSet()
indicator = IronhideIndicator()
indicator.main()
добавляем ironhide-indicator в автозагрузку.
теперь мы можем запускать приложения используя дискретную карточку
это можно сделать через Ironhide Indicator в трее
выбрать Configure Apps, поставитьгалочку на нужную программу, при этом это приложение появится в Preffered Apps
и потом через Preffered Apps выбираем приложение.
Или же просто можно запустить чераз
optirun <приложение>
и в том и в другом случае Ironhide Indicator выдаёт сообщение о включении видеокарты и меняет цвет индикатора.
использованные статьи
https://forum.ubuntu.ru/index.php?topic=142647.msg1276160#msg1276160https://github.com/MrMEEE/ironhide/issues/77На 64 битной системе для запуска некорорых приложений может поннадобиться установить virtualgl-libs:i386
выдаёт сообщение libraries: error while loading shared libGL.so.1: cannot open shared object file: No such file or directory
sudo apt-get install virtualgl-libs:i386