From eefc611960146fbd8ee00253ff9f8efa82917b09 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 9 Nov 2020 08:55:58 +0100 Subject: data/: Don't mimick FHS in source tree. Use more commonly used data/ tree structure. --- ayatana-settings | 325 +++++++ data/applications/ayatana-settings.desktop | 9 + data/ayatana-settings/ayatana-settings.glade | 931 +++++++++++++++++++++ .../hicolor/scalable/apps/ayatana-settings.svg | 267 ++++++ data/locale/.gitkeep | 0 data/usr/bin/ayatana-settings | 325 ------- .../share/applications/ayatana-settings.desktop | 9 - .../share/ayatana-settings/ayatana-settings.glade | 931 --------------------- .../hicolor/scalable/apps/ayatana-settings.svg | 267 ------ data/usr/share/locale/.gitkeep | 0 setup.py | 8 +- 11 files changed, 1537 insertions(+), 1535 deletions(-) create mode 100755 ayatana-settings create mode 100644 data/applications/ayatana-settings.desktop create mode 100755 data/ayatana-settings/ayatana-settings.glade create mode 100755 data/icons/hicolor/scalable/apps/ayatana-settings.svg create mode 100644 data/locale/.gitkeep delete mode 100755 data/usr/bin/ayatana-settings delete mode 100644 data/usr/share/applications/ayatana-settings.desktop delete mode 100755 data/usr/share/ayatana-settings/ayatana-settings.glade delete mode 100755 data/usr/share/icons/hicolor/scalable/apps/ayatana-settings.svg delete mode 100644 data/usr/share/locale/.gitkeep diff --git a/ayatana-settings b/ayatana-settings new file mode 100755 index 0000000..dde807e --- /dev/null +++ b/ayatana-settings @@ -0,0 +1,325 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +try: + + import devpath + from ayatanasettings.appdata import APPDEBUG + APPDEBUG.append(True) + +except: + + pass + +import gi + +gi.require_version('Gtk', '3.0') + +from gi.repository import Gtk, Gio +from ayatanasettings.appdata import APPNAME +from ayatanasettings.logger import logger +from ayatanasettings.psutil import isRunning, isSystemd +from ayatanasettings.builder import buildApp +import configparser +import gettext +import os +import pathlib +import shutil +import subprocess + +m_pTranslation = None + +try: + m_pTranslation = gettext.translation(APPNAME) +except IOError: + m_pTranslation = gettext.NullTranslations() + +m_pTranslation.install() + +class AyatanaSettings: + + def __init__(self): + + if isRunning(): + + sys.exit(1) + + buildApp(self) + + self.bSystemd = isSystemd() + self.bInit = False + self.sDesktop = os.environ['XDG_CURRENT_DESKTOP'] + + # Session + if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.session', False): + + self.pSettingsSession = Gio.Settings.new('org.ayatana.indicator.session') + self.pSettingsSession.bind('show-real-name-on-panel', self.pSwitchSessionShowName, 'active', Gio.SettingsBindFlags.DEFAULT) + self.pSettingsSession.bind('suppress-logout-menuitem', self.pSwitchSessionRemoveLogOut, 'active', Gio.SettingsBindFlags.DEFAULT) + self.pSettingsSession.bind('suppress-logout-restart-shutdown', self.pSwitchSessionSuppressConfirmation, 'active', Gio.SettingsBindFlags.DEFAULT) + self.pSettingsSession.bind('suppress-restart-menuitem', self.pSwitchSessionRemoveRestart, 'active', Gio.SettingsBindFlags.DEFAULT) + self.pSettingsSession.bind('suppress-shutdown-menuitem', self.pSwitchSessionRemoveShutDown, 'active', Gio.SettingsBindFlags.DEFAULT) + self.pSettingsSession.bind('user-show-menu', self.pSwitchSessionShowUsers, 'active', Gio.SettingsBindFlags.DEFAULT) + bEnabled = self.isEnabled('session') + self.pCheckButtonSessionEnable.set_active(bEnabled) + + else: + + self.pLabelSession.set_sensitive(False) + + # Date/Time + if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.datetime', False): + + self.pSettingsDateTime = Gio.Settings.new('org.ayatana.indicator.datetime') + self.pSettingsDateTime.bind('show-calendar', self.pSwitchDatetimeShowCalendar, 'active', Gio.SettingsBindFlags.DEFAULT) + self.pSettingsDateTime.bind('show-date', self.pSwitchDatetimeShowDate, 'active', Gio.SettingsBindFlags.DEFAULT) + self.pSettingsDateTime.bind('show-day', self.pSwitchDatetimeShowDay, 'active', Gio.SettingsBindFlags.DEFAULT) + self.pSettingsDateTime.bind('show-events', self.pSwitchDatetimeShowEvents, 'active', Gio.SettingsBindFlags.DEFAULT) + self.pSettingsDateTime.bind('show-seconds', self.pSwitchDatetimeShowSeconds, 'active', Gio.SettingsBindFlags.DEFAULT) + self.pSettingsDateTime.bind('show-week-numbers', self.pSwitchDatetimeShowWeekNumbers, 'active', Gio.SettingsBindFlags.DEFAULT) + self.pSettingsDateTime.bind('show-year', self.pSwitchDatetimeShowYear, 'active', Gio.SettingsBindFlags.DEFAULT) + bEnabled = self.isEnabled('datetime') + self.pCheckButtonDatetimeEnable.set_active(bEnabled) + + else: + + self.pLabelDatetime.set_sensitive(False) + + # Sound + if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.sound', False): + + self.pSettingsSound = Gio.Settings.new('org.ayatana.indicator.sound') + self.pSettingsSound.bind('allow-amplified-volume', self.pSwitchSoundAllowAmplified, 'active', Gio.SettingsBindFlags.DEFAULT) + bEnabled = self.isEnabled('sound') + self.pCheckButtonSoundEnable.set_active(bEnabled) + + else: + + self.pLabelSound.set_sensitive(False) + + # Power + if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.power', False): + + self.pSettingsPower = Gio.Settings.new('org.ayatana.indicator.power') + self.pSettingsPower.bind('show-percentage', self.pSwitchPowerShowPercentage, 'active', Gio.SettingsBindFlags.DEFAULT) + self.pSettingsPower.bind('show-time', self.pSwitchPowerShowTime, 'active', Gio.SettingsBindFlags.DEFAULT) + bEnabled = self.isEnabled('power') + self.pCheckButtonPowerEnable.set_active(bEnabled) + + else: + + self.pLabelPower.set_sensitive(False) + + # Messages + if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.messages', False): + + bEnabled = self.isEnabled('messages') + self.pCheckButtonMessagesEnable.set_active(bEnabled) + + else: + + self.pLabelMessages.set_sensitive(False) + + # Bluetooth + if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.bluetooth', False): + + bEnabled = self.isEnabled('bluetooth') + self.pCheckButtonBluetoothEnable.set_active(bEnabled) + + else: + + self.pLabelBluetooth.set_sensitive(False) + + # Notifications + if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.notifications', False): + + self.pSettingsNotifications = Gio.Settings.new('org.ayatana.indicator.notifications') + nMaxItems = self.pSettingsNotifications.get_int('max-items') + self.pSpinButtonNotifications.set_value(nMaxItems) + + for sFilter in self.pSettingsNotifications.get_strv('filter-list'): + + self.pListStoreNotificationsFilters.append([sFilter]); + + for sHint in self.pSettingsNotifications.get_strv('filter-list-hints'): + + self.pListStoreNotificationsHints.append([sHint]); + + self.pEntryCompletionNotifications = Gtk.EntryCompletion() + self.pEntryCompletionNotifications.set_model(self.pListStoreNotificationsHints) + self.pEntryCompletionNotifications.set_text_column(0) + self.pEntryCompletionNotifications.set_minimum_key_length(0) + self.pEntryNotifications.set_completion(self.pEntryCompletionNotifications) + bEnabled = self.isEnabled('notifications') + self.pCheckButtonNotificationsEnable.set_active(bEnabled) + + else: + + self.pLabelNotifications.set_sensitive(False) + + self.bInit = True + + Gtk.main() + + def isEnabled(self, sIndicator): + + bEnabled = True + + ''' + TODO: Fix systemd autostart first + if self.bSystemd: + + bEnabled = subprocess.Popen('systemctl --user is-enabled ayatana-indicator-{}'.format(sIndicator), stdout = subprocess.PIPE, shell = True).communicate()[0].decode().strip() == 'enabled' + + else: + ''' + + sPath = '~/.config/autostart/ayatana-indicator-{}.desktop'.format(sIndicator) + pPath = pathlib.Path(sPath).expanduser() + + if pPath.exists(): + + pFile = pPath.open('r') + pParser = configparser.ConfigParser() + pParser.read_file(pFile) + + if 'X-MATE-Autostart-enabled' in pParser['Desktop Entry']: + + bEnabled = (pParser['Desktop Entry']['X-MATE-Autostart-enabled'] != 'false') + + elif 'X-GNOME-Autostart-enabled' in pParser['Desktop Entry']: + + bEnabled = (pParser['Desktop Entry']['X-GNOME-Autostart-enabled'] != 'false') + + pFile.close() + + return bEnabled + + def onCheckButtonEnableToggled(self, pCheckButton): + + if not self.bInit: + + return + + sIndicator = pCheckButton.get_name() + + ''' + TODO: Fix systemd autostart first + if self.bSystemd: + + sAction = 'enable' if pCheckButton.get_active() else 'disable' + subprocess.Popen('systemctl --quiet --user {} ayatana-indicator-{}'.format(sAction, sIndicator), stdout = subprocess.PIPE, shell = True).communicate() + + else: + ''' + + sPath = '~/.config/autostart/ayatana-indicator-{}.desktop'.format(sIndicator) + pPath = pathlib.Path(sPath).expanduser() + + if not pPath.exists(): + + sPathIn = '/etc/xdg/autostart/ayatana-indicator-{}.desktop'.format(sIndicator) + shutil.copy(sPathIn, pPath) + + pFile = pPath.open('r+') + pParser = configparser.ConfigParser() + pParser.optionxform = str + pParser.read_file(pFile) + sEnabled = 'true' if pCheckButton.get_active() else 'false' + + if self.sDesktop == 'MATE': + + pParser['Desktop Entry']['X-MATE-Autostart-enabled'] = sEnabled + + else: + + pParser['Desktop Entry']['X-GNOME-Autostart-enabled'] = sEnabled + + pFile.seek(0) + pParser.write(pFile, False) + pFile.truncate() + pFile.close() + + def onWindowDestroy(self, pWidget, pData = None): + + Gtk.main_quit() + + def onSpinButtonNotificationsValueChanged(self, pSpinButton): + + nValue = pSpinButton.get_value_as_int() + self.pSettingsNotifications.set_int('max-items', nValue) + + def onSpinButtonNotificationsChanged(self, pSpinButton): + + sText = pSpinButton.get_text() + + if not sText: + + return + + nNum = int(sText) + nNum = max(1, nNum) + nNum = min(nNum, 10) + + if str(nNum) != sText: + + pSpinButton.set_text(str(nNum)) + + def onButtonNotificationsAddClicked(self, pButton): + + sText = self.pEntryNotifications.get_text().strip() + + if sText: + + bDuplicate = False; + + for pRow in self.pListStoreNotificationsFilters: + + if pRow[0] == sText: + + bDuplicate = True + + break + + if not bDuplicate: + + self.pListStoreNotificationsFilters.append([sText]) + self.saveFilterList() + + self.pEntryNotifications.set_text('') + + def onButtonNotificationsRemoveClicked(self, pButton): + + pSelection = self.pTreeViewNotifications.get_selection() + pIter = pSelection.get_selected()[1] + + if pIter is not None: + + self.pListStoreNotificationsFilters.remove(pIter) + self.saveFilterList() + + def onEntryNotificationsFocusInEvent(self, pEntry, pEvent): + + self.pListStoreNotificationsHints.clear() + + for sHint in self.pSettingsNotifications.get_strv('filter-list-hints'): + + self.pListStoreNotificationsHints.append([sHint]) + + pEntry.emit('changed') + + return False + + def saveFilterList(self): + + lItems = [] + + for lRow in self.pListStoreNotificationsFilters: + + lItems.append(lRow[0]) + + self.pSettingsNotifications.set_strv('filter-list', lItems) + +if __name__ == "__main__": + + AyatanaSettings() diff --git a/data/applications/ayatana-settings.desktop b/data/applications/ayatana-settings.desktop new file mode 100644 index 0000000..f416c39 --- /dev/null +++ b/data/applications/ayatana-settings.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Indicators +Comment=Ayatana Indicators Settings +Categories=Settings;DesktopSettings;X-LXDE-Settings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings; +Exec=/usr/bin/ayatana-settings +Icon=/usr/share/icons/hicolor/scalable/apps/ayatana-settings.svg +Terminal=false +Type=Application +X-Ubuntu-Gettext-Domain=ayatana-settings diff --git a/data/ayatana-settings/ayatana-settings.glade b/data/ayatana-settings/ayatana-settings.glade new file mode 100755 index 0000000..346dc8d --- /dev/null +++ b/data/ayatana-settings/ayatana-settings.glade @@ -0,0 +1,931 @@ + + + + + + + + + + + + + + + + + + 1 + 10 + 1 + 1 + + + True + False + 5 + list-add + + + True + False + 5 + list-remove + + + 640 + 480 + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + center-always + True + + + + True + False + 10 + 10 + 10 + 10 + True + True + vertical + + + True + True + True + True + left + + + True + False + 10 + 10 + 10 + 10 + True + True + 10 + 10 + + + True + True + + + 1 + 0 + + + + + True + True + + + 1 + 1 + + + + + True + True + + + 1 + 2 + + + + + True + True + + + 1 + 3 + + + + + True + True + + + 1 + 4 + + + + + True + True + + + 1 + 5 + + + + + True + False + end + True + Show full user name on the panel + + + 0 + 0 + + + + + True + False + end + True + Remove the Log Out item from the menu + + + 0 + 1 + + + + + True + False + end + True + Suppress the Log Out, Restart and Shut Down confirmation + + + 0 + 2 + + + + + True + False + end + True + Remove the Restart item from the menu + + + 0 + 3 + + + + + True + False + end + True + Remove the Shut Down item from the menu + + + 0 + 4 + + + + + True + False + end + True + Show the user list in the menu + + + 0 + 5 + + + + + True + False + end + True + + + 0 + 6 + + + + + Enable this indicator on login + session + True + True + False + end + True + True + False + + + + 0 + 6 + 2 + + + + + + + True + False + True + Session + 0 + + + False + + + + + True + False + 10 + 10 + 10 + 10 + True + True + 10 + 10 + + + True + False + end + True + Show the number of seconds on the panel + + + 0 + 3 + + + + + True + False + end + True + Show the calendar in the menu + + + 0 + 4 + + + + + True + False + end + True + Show week numbers in the calendar + + + 0 + 5 + + + + + True + False + end + True + Show events in the menu + + + 0 + 6 + + + + + True + True + + + 1 + 0 + + + + + True + True + + + 1 + 1 + + + + + True + True + + + 1 + 2 + + + + + True + True + + + 1 + 3 + + + + + True + True + + + 1 + 4 + + + + + True + True + + + 1 + 5 + + + + + True + True + + + 1 + 6 + + + + + True + False + end + True + Show the year on the panel + + + 0 + 0 + + + + + True + False + end + True + Show the day of the week on the panel + + + 0 + 2 + + + + + True + False + end + True + Show the month and date on the panel + + + 0 + 1 + + + + + Enable this indicator on login + datetime + True + True + False + end + True + True + False + + + + 0 + 7 + 2 + + + + + 1 + + + + + True + False + True + Date and Time + 0 + + + 1 + False + + + + + True + False + 10 + 10 + 10 + 10 + True + True + 10 + 10 + + + True + False + end + True + Allow setting the volume above 100% + + + 0 + 0 + + + + + True + True + + + 1 + 0 + + + + + Enable this indicator on login + sound + True + True + False + end + True + True + False + + + + 0 + 1 + 2 + + + + + 2 + + + + + True + False + True + Sound + 0 + + + 2 + False + + + + + True + False + 10 + 10 + 10 + 10 + True + True + 10 + 10 + + + Enable this indicator on login + power + True + True + False + end + True + True + False + + + + 0 + 2 + 2 + + + + + True + False + end + True + Show percentage on the panel + + + 0 + 0 + + + + + True + False + end + True + Show time on the panel + + + 0 + 1 + + + + + True + True + + + 1 + 0 + + + + + True + True + + + 1 + 1 + + + + + 3 + + + + + True + False + True + Power + 0 + + + 3 + False + + + + + True + False + 10 + 10 + 10 + 10 + True + True + 10 + 10 + + + Enable this indicator on login + messages + True + True + False + end + True + True + False + + + + 0 + 0 + 2 + + + + + 4 + + + + + True + False + True + Messages + 0 + + + 4 + False + + + + + True + False + 10 + 10 + 10 + 10 + True + True + 10 + 10 + + + Enable this indicator on login + bluetooth + True + True + False + end + True + True + False + + + + 0 + 0 + 2 + + + + + 5 + + + + + True + False + True + Bluetooth + 0 + + + 5 + False + + + + + True + False + 10 + 10 + 10 + 10 + True + True + 10 + 10 + + + True + False + end + True + Maximum number of visible items + + + 0 + 0 + + + + + True + False + end + True + Discard notifications by application name + + + 0 + 1 + + + + + True + True + 2 + 2 + 2 + False + number + adjustmentNotificationsMaxItems + True + True + + + + + 1 + 0 + + + + + True + False + 5 + + + True + True + + + + 0 + 0 + + + + + Add + True + True + True + imageAdd + + + + 1 + 0 + + + + + Remove + True + True + True + imageRemove + + + + 2 + 0 + + + + + 1 + 2 + + + + + Enable this indicator on login + notifications + True + True + False + end + True + True + False + + + + 0 + 3 + 2 + + + + + True + True + in + 200 + True + + + True + True + ListStoreNotificationsFilters + False + False + True + False + + + + + + fixed + column + + + + 0 + + + + + + + + + 1 + 1 + + + + + + + + 6 + + + + + True + False + True + Notifications + 0 + + + 6 + False + + + + + True + True + 0 + + + + + + + + + diff --git a/data/icons/hicolor/scalable/apps/ayatana-settings.svg b/data/icons/hicolor/scalable/apps/ayatana-settings.svg new file mode 100755 index 0000000..758cfa5 --- /dev/null +++ b/data/icons/hicolor/scalable/apps/ayatana-settings.svg @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/locale/.gitkeep b/data/locale/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/usr/bin/ayatana-settings b/data/usr/bin/ayatana-settings deleted file mode 100755 index dde807e..0000000 --- a/data/usr/bin/ayatana-settings +++ /dev/null @@ -1,325 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -try: - - import devpath - from ayatanasettings.appdata import APPDEBUG - APPDEBUG.append(True) - -except: - - pass - -import gi - -gi.require_version('Gtk', '3.0') - -from gi.repository import Gtk, Gio -from ayatanasettings.appdata import APPNAME -from ayatanasettings.logger import logger -from ayatanasettings.psutil import isRunning, isSystemd -from ayatanasettings.builder import buildApp -import configparser -import gettext -import os -import pathlib -import shutil -import subprocess - -m_pTranslation = None - -try: - m_pTranslation = gettext.translation(APPNAME) -except IOError: - m_pTranslation = gettext.NullTranslations() - -m_pTranslation.install() - -class AyatanaSettings: - - def __init__(self): - - if isRunning(): - - sys.exit(1) - - buildApp(self) - - self.bSystemd = isSystemd() - self.bInit = False - self.sDesktop = os.environ['XDG_CURRENT_DESKTOP'] - - # Session - if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.session', False): - - self.pSettingsSession = Gio.Settings.new('org.ayatana.indicator.session') - self.pSettingsSession.bind('show-real-name-on-panel', self.pSwitchSessionShowName, 'active', Gio.SettingsBindFlags.DEFAULT) - self.pSettingsSession.bind('suppress-logout-menuitem', self.pSwitchSessionRemoveLogOut, 'active', Gio.SettingsBindFlags.DEFAULT) - self.pSettingsSession.bind('suppress-logout-restart-shutdown', self.pSwitchSessionSuppressConfirmation, 'active', Gio.SettingsBindFlags.DEFAULT) - self.pSettingsSession.bind('suppress-restart-menuitem', self.pSwitchSessionRemoveRestart, 'active', Gio.SettingsBindFlags.DEFAULT) - self.pSettingsSession.bind('suppress-shutdown-menuitem', self.pSwitchSessionRemoveShutDown, 'active', Gio.SettingsBindFlags.DEFAULT) - self.pSettingsSession.bind('user-show-menu', self.pSwitchSessionShowUsers, 'active', Gio.SettingsBindFlags.DEFAULT) - bEnabled = self.isEnabled('session') - self.pCheckButtonSessionEnable.set_active(bEnabled) - - else: - - self.pLabelSession.set_sensitive(False) - - # Date/Time - if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.datetime', False): - - self.pSettingsDateTime = Gio.Settings.new('org.ayatana.indicator.datetime') - self.pSettingsDateTime.bind('show-calendar', self.pSwitchDatetimeShowCalendar, 'active', Gio.SettingsBindFlags.DEFAULT) - self.pSettingsDateTime.bind('show-date', self.pSwitchDatetimeShowDate, 'active', Gio.SettingsBindFlags.DEFAULT) - self.pSettingsDateTime.bind('show-day', self.pSwitchDatetimeShowDay, 'active', Gio.SettingsBindFlags.DEFAULT) - self.pSettingsDateTime.bind('show-events', self.pSwitchDatetimeShowEvents, 'active', Gio.SettingsBindFlags.DEFAULT) - self.pSettingsDateTime.bind('show-seconds', self.pSwitchDatetimeShowSeconds, 'active', Gio.SettingsBindFlags.DEFAULT) - self.pSettingsDateTime.bind('show-week-numbers', self.pSwitchDatetimeShowWeekNumbers, 'active', Gio.SettingsBindFlags.DEFAULT) - self.pSettingsDateTime.bind('show-year', self.pSwitchDatetimeShowYear, 'active', Gio.SettingsBindFlags.DEFAULT) - bEnabled = self.isEnabled('datetime') - self.pCheckButtonDatetimeEnable.set_active(bEnabled) - - else: - - self.pLabelDatetime.set_sensitive(False) - - # Sound - if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.sound', False): - - self.pSettingsSound = Gio.Settings.new('org.ayatana.indicator.sound') - self.pSettingsSound.bind('allow-amplified-volume', self.pSwitchSoundAllowAmplified, 'active', Gio.SettingsBindFlags.DEFAULT) - bEnabled = self.isEnabled('sound') - self.pCheckButtonSoundEnable.set_active(bEnabled) - - else: - - self.pLabelSound.set_sensitive(False) - - # Power - if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.power', False): - - self.pSettingsPower = Gio.Settings.new('org.ayatana.indicator.power') - self.pSettingsPower.bind('show-percentage', self.pSwitchPowerShowPercentage, 'active', Gio.SettingsBindFlags.DEFAULT) - self.pSettingsPower.bind('show-time', self.pSwitchPowerShowTime, 'active', Gio.SettingsBindFlags.DEFAULT) - bEnabled = self.isEnabled('power') - self.pCheckButtonPowerEnable.set_active(bEnabled) - - else: - - self.pLabelPower.set_sensitive(False) - - # Messages - if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.messages', False): - - bEnabled = self.isEnabled('messages') - self.pCheckButtonMessagesEnable.set_active(bEnabled) - - else: - - self.pLabelMessages.set_sensitive(False) - - # Bluetooth - if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.bluetooth', False): - - bEnabled = self.isEnabled('bluetooth') - self.pCheckButtonBluetoothEnable.set_active(bEnabled) - - else: - - self.pLabelBluetooth.set_sensitive(False) - - # Notifications - if Gio.SettingsSchemaSource.get_default().lookup('org.ayatana.indicator.notifications', False): - - self.pSettingsNotifications = Gio.Settings.new('org.ayatana.indicator.notifications') - nMaxItems = self.pSettingsNotifications.get_int('max-items') - self.pSpinButtonNotifications.set_value(nMaxItems) - - for sFilter in self.pSettingsNotifications.get_strv('filter-list'): - - self.pListStoreNotificationsFilters.append([sFilter]); - - for sHint in self.pSettingsNotifications.get_strv('filter-list-hints'): - - self.pListStoreNotificationsHints.append([sHint]); - - self.pEntryCompletionNotifications = Gtk.EntryCompletion() - self.pEntryCompletionNotifications.set_model(self.pListStoreNotificationsHints) - self.pEntryCompletionNotifications.set_text_column(0) - self.pEntryCompletionNotifications.set_minimum_key_length(0) - self.pEntryNotifications.set_completion(self.pEntryCompletionNotifications) - bEnabled = self.isEnabled('notifications') - self.pCheckButtonNotificationsEnable.set_active(bEnabled) - - else: - - self.pLabelNotifications.set_sensitive(False) - - self.bInit = True - - Gtk.main() - - def isEnabled(self, sIndicator): - - bEnabled = True - - ''' - TODO: Fix systemd autostart first - if self.bSystemd: - - bEnabled = subprocess.Popen('systemctl --user is-enabled ayatana-indicator-{}'.format(sIndicator), stdout = subprocess.PIPE, shell = True).communicate()[0].decode().strip() == 'enabled' - - else: - ''' - - sPath = '~/.config/autostart/ayatana-indicator-{}.desktop'.format(sIndicator) - pPath = pathlib.Path(sPath).expanduser() - - if pPath.exists(): - - pFile = pPath.open('r') - pParser = configparser.ConfigParser() - pParser.read_file(pFile) - - if 'X-MATE-Autostart-enabled' in pParser['Desktop Entry']: - - bEnabled = (pParser['Desktop Entry']['X-MATE-Autostart-enabled'] != 'false') - - elif 'X-GNOME-Autostart-enabled' in pParser['Desktop Entry']: - - bEnabled = (pParser['Desktop Entry']['X-GNOME-Autostart-enabled'] != 'false') - - pFile.close() - - return bEnabled - - def onCheckButtonEnableToggled(self, pCheckButton): - - if not self.bInit: - - return - - sIndicator = pCheckButton.get_name() - - ''' - TODO: Fix systemd autostart first - if self.bSystemd: - - sAction = 'enable' if pCheckButton.get_active() else 'disable' - subprocess.Popen('systemctl --quiet --user {} ayatana-indicator-{}'.format(sAction, sIndicator), stdout = subprocess.PIPE, shell = True).communicate() - - else: - ''' - - sPath = '~/.config/autostart/ayatana-indicator-{}.desktop'.format(sIndicator) - pPath = pathlib.Path(sPath).expanduser() - - if not pPath.exists(): - - sPathIn = '/etc/xdg/autostart/ayatana-indicator-{}.desktop'.format(sIndicator) - shutil.copy(sPathIn, pPath) - - pFile = pPath.open('r+') - pParser = configparser.ConfigParser() - pParser.optionxform = str - pParser.read_file(pFile) - sEnabled = 'true' if pCheckButton.get_active() else 'false' - - if self.sDesktop == 'MATE': - - pParser['Desktop Entry']['X-MATE-Autostart-enabled'] = sEnabled - - else: - - pParser['Desktop Entry']['X-GNOME-Autostart-enabled'] = sEnabled - - pFile.seek(0) - pParser.write(pFile, False) - pFile.truncate() - pFile.close() - - def onWindowDestroy(self, pWidget, pData = None): - - Gtk.main_quit() - - def onSpinButtonNotificationsValueChanged(self, pSpinButton): - - nValue = pSpinButton.get_value_as_int() - self.pSettingsNotifications.set_int('max-items', nValue) - - def onSpinButtonNotificationsChanged(self, pSpinButton): - - sText = pSpinButton.get_text() - - if not sText: - - return - - nNum = int(sText) - nNum = max(1, nNum) - nNum = min(nNum, 10) - - if str(nNum) != sText: - - pSpinButton.set_text(str(nNum)) - - def onButtonNotificationsAddClicked(self, pButton): - - sText = self.pEntryNotifications.get_text().strip() - - if sText: - - bDuplicate = False; - - for pRow in self.pListStoreNotificationsFilters: - - if pRow[0] == sText: - - bDuplicate = True - - break - - if not bDuplicate: - - self.pListStoreNotificationsFilters.append([sText]) - self.saveFilterList() - - self.pEntryNotifications.set_text('') - - def onButtonNotificationsRemoveClicked(self, pButton): - - pSelection = self.pTreeViewNotifications.get_selection() - pIter = pSelection.get_selected()[1] - - if pIter is not None: - - self.pListStoreNotificationsFilters.remove(pIter) - self.saveFilterList() - - def onEntryNotificationsFocusInEvent(self, pEntry, pEvent): - - self.pListStoreNotificationsHints.clear() - - for sHint in self.pSettingsNotifications.get_strv('filter-list-hints'): - - self.pListStoreNotificationsHints.append([sHint]) - - pEntry.emit('changed') - - return False - - def saveFilterList(self): - - lItems = [] - - for lRow in self.pListStoreNotificationsFilters: - - lItems.append(lRow[0]) - - self.pSettingsNotifications.set_strv('filter-list', lItems) - -if __name__ == "__main__": - - AyatanaSettings() diff --git a/data/usr/share/applications/ayatana-settings.desktop b/data/usr/share/applications/ayatana-settings.desktop deleted file mode 100644 index f416c39..0000000 --- a/data/usr/share/applications/ayatana-settings.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Name=Indicators -Comment=Ayatana Indicators Settings -Categories=Settings;DesktopSettings;X-LXDE-Settings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings; -Exec=/usr/bin/ayatana-settings -Icon=/usr/share/icons/hicolor/scalable/apps/ayatana-settings.svg -Terminal=false -Type=Application -X-Ubuntu-Gettext-Domain=ayatana-settings diff --git a/data/usr/share/ayatana-settings/ayatana-settings.glade b/data/usr/share/ayatana-settings/ayatana-settings.glade deleted file mode 100755 index 346dc8d..0000000 --- a/data/usr/share/ayatana-settings/ayatana-settings.glade +++ /dev/null @@ -1,931 +0,0 @@ - - - - - - - - - - - - - - - - - - 1 - 10 - 1 - 1 - - - True - False - 5 - list-add - - - True - False - 5 - list-remove - - - 640 - 480 - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - center-always - True - - - - True - False - 10 - 10 - 10 - 10 - True - True - vertical - - - True - True - True - True - left - - - True - False - 10 - 10 - 10 - 10 - True - True - 10 - 10 - - - True - True - - - 1 - 0 - - - - - True - True - - - 1 - 1 - - - - - True - True - - - 1 - 2 - - - - - True - True - - - 1 - 3 - - - - - True - True - - - 1 - 4 - - - - - True - True - - - 1 - 5 - - - - - True - False - end - True - Show full user name on the panel - - - 0 - 0 - - - - - True - False - end - True - Remove the Log Out item from the menu - - - 0 - 1 - - - - - True - False - end - True - Suppress the Log Out, Restart and Shut Down confirmation - - - 0 - 2 - - - - - True - False - end - True - Remove the Restart item from the menu - - - 0 - 3 - - - - - True - False - end - True - Remove the Shut Down item from the menu - - - 0 - 4 - - - - - True - False - end - True - Show the user list in the menu - - - 0 - 5 - - - - - True - False - end - True - - - 0 - 6 - - - - - Enable this indicator on login - session - True - True - False - end - True - True - False - - - - 0 - 6 - 2 - - - - - - - True - False - True - Session - 0 - - - False - - - - - True - False - 10 - 10 - 10 - 10 - True - True - 10 - 10 - - - True - False - end - True - Show the number of seconds on the panel - - - 0 - 3 - - - - - True - False - end - True - Show the calendar in the menu - - - 0 - 4 - - - - - True - False - end - True - Show week numbers in the calendar - - - 0 - 5 - - - - - True - False - end - True - Show events in the menu - - - 0 - 6 - - - - - True - True - - - 1 - 0 - - - - - True - True - - - 1 - 1 - - - - - True - True - - - 1 - 2 - - - - - True - True - - - 1 - 3 - - - - - True - True - - - 1 - 4 - - - - - True - True - - - 1 - 5 - - - - - True - True - - - 1 - 6 - - - - - True - False - end - True - Show the year on the panel - - - 0 - 0 - - - - - True - False - end - True - Show the day of the week on the panel - - - 0 - 2 - - - - - True - False - end - True - Show the month and date on the panel - - - 0 - 1 - - - - - Enable this indicator on login - datetime - True - True - False - end - True - True - False - - - - 0 - 7 - 2 - - - - - 1 - - - - - True - False - True - Date and Time - 0 - - - 1 - False - - - - - True - False - 10 - 10 - 10 - 10 - True - True - 10 - 10 - - - True - False - end - True - Allow setting the volume above 100% - - - 0 - 0 - - - - - True - True - - - 1 - 0 - - - - - Enable this indicator on login - sound - True - True - False - end - True - True - False - - - - 0 - 1 - 2 - - - - - 2 - - - - - True - False - True - Sound - 0 - - - 2 - False - - - - - True - False - 10 - 10 - 10 - 10 - True - True - 10 - 10 - - - Enable this indicator on login - power - True - True - False - end - True - True - False - - - - 0 - 2 - 2 - - - - - True - False - end - True - Show percentage on the panel - - - 0 - 0 - - - - - True - False - end - True - Show time on the panel - - - 0 - 1 - - - - - True - True - - - 1 - 0 - - - - - True - True - - - 1 - 1 - - - - - 3 - - - - - True - False - True - Power - 0 - - - 3 - False - - - - - True - False - 10 - 10 - 10 - 10 - True - True - 10 - 10 - - - Enable this indicator on login - messages - True - True - False - end - True - True - False - - - - 0 - 0 - 2 - - - - - 4 - - - - - True - False - True - Messages - 0 - - - 4 - False - - - - - True - False - 10 - 10 - 10 - 10 - True - True - 10 - 10 - - - Enable this indicator on login - bluetooth - True - True - False - end - True - True - False - - - - 0 - 0 - 2 - - - - - 5 - - - - - True - False - True - Bluetooth - 0 - - - 5 - False - - - - - True - False - 10 - 10 - 10 - 10 - True - True - 10 - 10 - - - True - False - end - True - Maximum number of visible items - - - 0 - 0 - - - - - True - False - end - True - Discard notifications by application name - - - 0 - 1 - - - - - True - True - 2 - 2 - 2 - False - number - adjustmentNotificationsMaxItems - True - True - - - - - 1 - 0 - - - - - True - False - 5 - - - True - True - - - - 0 - 0 - - - - - Add - True - True - True - imageAdd - - - - 1 - 0 - - - - - Remove - True - True - True - imageRemove - - - - 2 - 0 - - - - - 1 - 2 - - - - - Enable this indicator on login - notifications - True - True - False - end - True - True - False - - - - 0 - 3 - 2 - - - - - True - True - in - 200 - True - - - True - True - ListStoreNotificationsFilters - False - False - True - False - - - - - - fixed - column - - - - 0 - - - - - - - - - 1 - 1 - - - - - - - - 6 - - - - - True - False - True - Notifications - 0 - - - 6 - False - - - - - True - True - 0 - - - - - - - - - diff --git a/data/usr/share/icons/hicolor/scalable/apps/ayatana-settings.svg b/data/usr/share/icons/hicolor/scalable/apps/ayatana-settings.svg deleted file mode 100755 index 758cfa5..0000000 --- a/data/usr/share/icons/hicolor/scalable/apps/ayatana-settings.svg +++ /dev/null @@ -1,267 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/usr/share/locale/.gitkeep b/data/usr/share/locale/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/setup.py b/setup.py index 0955d06..1021212 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ import os, polib, configparser m_lstDataFiles = [] -oFile = open('data/usr/share/applications/{}.desktop'.format(APPNAME), 'r+') +oFile = open('data/applications/{}.desktop'.format(APPNAME), 'r+') oConfigParser = configparser.ConfigParser() oConfigParser.optionxform = str oConfigParser.read_file(oFile) @@ -46,7 +46,7 @@ for strRoot, lstDirnames, lstFilenames in os.walk('po'): if strLocale != APPNAME: - strLocaleDir = 'data/usr/share/locale/' + strLocale + '/LC_MESSAGES/' + strLocaleDir = 'data/locale/' + strLocale + '/LC_MESSAGES/' if not os.path.isdir(strLocaleDir): @@ -63,7 +63,9 @@ for strRoot, lstDirnames, lstFilenames in os.walk('data'): continue strPath = os.path.join(strRoot, strFilename) - m_lstDataFiles.append((os.path.dirname(strPath).lstrip('data'), [strPath])) + m_lstDataFiles.append(("share/{data}".format(data=os.path.dirname(strPath).replace('data/', '')), [strPath])) + +m_lstDataFiles.append(('bin/', ['ayatana-settings'])) setup( name = APPNAME, -- cgit v1.2.3