Skip to content

Commit

Permalink
Merge branch 'feature-release-test' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Ximi1970 committed Mar 22, 2020
2 parents 86ec9d6 + 9a52949 commit 211fa48
Show file tree
Hide file tree
Showing 18 changed files with 580 additions and 33 deletions.
44 changes: 37 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
QMAKE = qmake-qt5
ifeq (, $(shell which qmake-qt5 2>/dev/null))
ifeq (, $(shell which qmake 2>/dev/null))
SYSTEM =
ifeq (Cygwin,$(shell uname -o))
SYSTEM = Windows
else
ifeq (GNU/Linux,$(shell uname -o))
SYSTEM = Linux

QMAKE = qmake-qt5
ifeq (, $(shell which qmake-qt5 2>/dev/null))
ifeq (, $(shell which qmake 2>/dev/null))
$(error "No qmake in $(PATH)")
endif
QMAKE = qmake
endif
QMAKE = qmake
else
$(error "Unknown system")
endif
endif

.PHONY: clean \
Expand All @@ -27,14 +38,19 @@ clean:
rm -f *.xpi ;\
rm -f SysTray-X ;\
rm -rf app/build ;\
rm -rf app/build32 ;\
rm -rf app/build64 ;\
rm -rf app/build-* ;\
rm -rf app/dist* ;\

systray-x-xpi:
@echo "Creating systray-x.xpi" ;\
rm -f systray-x.xpi ;\
@echo "Creating systray-x@Ximi1970.xpi" ;\
rm -f systray-x@Ximi1970.xpi ;\
cd webext ;\
zip ../systray-x.xpi -qr * ;\
zip ../systray-x@Ximi1970.xpi -qr * ;\
cd ..

ifeq (Linux,$(SYSTEM))
systray-x-app:
@echo "Creating systray-x app" ;\
rm -f SysTray-X ;\
Expand All @@ -44,3 +60,17 @@ systray-x-app:
make ;\
cd ../.. ;\
cp app/build/SysTray-X .
else
systray-x-app:
@echo "Creating systray-x app" ;\
rm -f SysTray-X ;\
mkdir -p app/build32 ;\
mkdir -p app/dist/win32 ;\
cd app/build32 ;\
../build.bat x86 5.14.1 ;\
cd ../.. ;\
mkdir -p app/build64 ;\
cd app/build64 ;\
../build.bat x86_64 5.14.1 ;\
cd ../..
endif
77 changes: 75 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,73 @@ The add-on and system tray application can do:
- show / hide Thunderbird (minimize)
- minimizing hides to tray
- minimize on startup
- to be implemented: start a new mail
- to be implemented: open the last used account

## Binaries (System)

These packages will install the Thunderbird Add-on and companion app system wide.
Root credentials are required.

### openSuSE
#### Leap 15.1

```bash
sudo zypper ar -f https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/openSUSE_Leap_15.1/ SysTray-X
sudo zypper in systray-x
```

#### Leap 15.2

```bash
sudo zypper ar -f https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/openSUSE_Leap_15.2/ SysTray-X
sudo zypper in systray-x
```

#### Tumbleweed

```bash
sudo zypper ar -f https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/openSUSE_Tumbleweed/ SysTray-X
sudo zypper in systray-x
```

#### SLE 15

```bash
sudo zypper ar -f https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/openSUSE_SLE_15_SP1/ SysTray-X
sudo zypper in systray-x
```

### xUbuntu

#### 19.10

```bash
wget -q https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/xUbuntu_19.10/Release.key
sudo apt-key add Release.key
sudo bash -c "echo 'deb https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/xUbuntu_19.10 ./" > /etc/apt/source.list.d/systray-x.list'```
sudo apt update
sudo apt install systray-x
```
#### 18.04 LTS
```bash
wget -q https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/xUbuntu_18.04/Release.key
sudo apt-key add Release.key
sudo bash -c 'echo "deb https://download.opensuse.org/repositories/home:/Ximi1970:/Mozilla:/Add-ons/xUbuntu_18.04 ./" > /etc/apt/source.list.d/systray-x.list'```
sudo apt update
sudo apt install systray-x
```
## Binaries (User)
User installable package.
No root credentials required.
Download the installer here:
[Companion installer](https://github.com/Ximi1970/systray-x/releases)
And install the add-on using the Thunderbird Add-on / Extensions store.
## Building
Expand Down Expand Up @@ -53,6 +118,14 @@ Clone the repository using TortoiseGit:
...
### Remarks
Branches:
master : Should be stable and working for all systems
develop : Working but maybe not for all systems
feature-xxx : Experimental
## Contributers
Luigi Baldoni \<[email protected]\> : Initial setup of the OpenSuSE Build Service rpm package.
Expand Down
15 changes: 15 additions & 0 deletions README.references.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
#<script>


Installers

Bash:

https://www.matteomattei.com/create-self-contained-installer-in-bash-that-extracts-archives-and-perform-actitions/

Windows:

The good old Nullsoft:
https://sourceforge.net/projects/nsis/




Windows
=========================================

Expand Down
19 changes: 17 additions & 2 deletions app/SysTray-X/preferencesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ PreferencesDialog::PreferencesDialog( SysTrayXLink *link, Preferences *pref, QWi
*/
connect( m_ui->chooseCustomButton, &QPushButton::clicked, this, &PreferencesDialog::slotFileSelect );
connect( m_ui->buttonBox, &QDialogButtonBox::accepted, this, &PreferencesDialog::slotAccept );
connect( m_ui->buttonBox, &QDialogButtonBox::rejected, this, &PreferencesDialog::slotReject );
}


Expand Down Expand Up @@ -148,9 +149,23 @@ void PreferencesDialog::slotAccept()
m_pref->setAppPrefChanged( false );

/*
* Tell the base
* Close it
*/
QDialog::accept();
// QDialog::accept();
hide();
}


/*
* Handle the accept signal
*/
void PreferencesDialog::slotReject()
{
/*
* Close it
*/
// QDialog::reject();
hide();
}


Expand Down
21 changes: 13 additions & 8 deletions app/SysTray-X/preferencesdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,46 +87,51 @@ class PreferencesDialog : public QDialog
/**
* @brief signalUpdateSysTray. Signal to update the system tray icon.
*/
void signalUpdateSysTrayIcon();
void signalUpdateSysTrayIcon();

public slots:

/**
* @brief slotDebugChange. Slot for handling debug change signals.
*/
void slotDebugChange();
void slotDebugChange();

/**
* @brief slotHideOnMinimizeChange. Slot for handling hide on minimize change signals.
*/
void slotHideOnMinimizeChange();
void slotHideOnMinimizeChange();

/**
* @brief slotStartMinimizedChange. Slot for handling start minimized change signals.
*/
void slotStartMinimizedChange();
void slotStartMinimizedChange();

/**
* @brief slotIconTypeChange. Slot for handling icon type change signals.
*/
void slotIconTypeChange();
void slotIconTypeChange();

/**
* @brief slotIconDataChange. Slot for handling icon data change signals.
*/
void slotIconDataChange();
void slotIconDataChange();

private slots:

/**
* @brief slotAccept. Store the preferences on the accept signal.
*/
void slotAccept();
void slotAccept();

/**
* @brief slotReject. Store the preferences on the accept signal.
*/
void slotReject();

/**
* @brief slotFileSelect. Handle the choose custom button click.
*/
void slotFileSelect();
void slotFileSelect();

private:

Expand Down
41 changes: 41 additions & 0 deletions app/SysTray-X/windowctrl-unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,27 @@ qint64 WindowCtrlUnix::getPpid()
}


/*
* Is the pid from thunderbird
*/
bool WindowCtrlUnix::isThunderbird( qint64 pid )
{
return getProcessName( pid ).contains( "thunderbird", Qt::CaseInsensitive );
}


/*
* Get the process name
*/
QString WindowCtrlUnix::getProcessName( qint64 pid )
{
QString process_name = QString( "/proc/%1/exe" ).arg( pid );
QFileInfo process( process_name );

return process.canonicalFilePath();
}


/*
* Find window(s) by title
*/
Expand Down Expand Up @@ -237,6 +258,11 @@ QList< quint64 > WindowCtrlUnix::getWinIds()
*/
void WindowCtrlUnix::minimizeWindow( quint64 window, bool hide )
{
if( !isThunderbird( getPpid() ) )
{
return;
}

Window win = static_cast<Window>( window );

if( hide )
Expand All @@ -254,6 +280,11 @@ void WindowCtrlUnix::minimizeWindow( quint64 window, bool hide )
*/
void WindowCtrlUnix::normalizeWindow( quint64 window )
{
if( !isThunderbird( getPpid() ) )
{
return;
}

Window win = static_cast<Window>( window );

hideWindow( win, false );
Expand All @@ -278,6 +309,11 @@ void WindowCtrlUnix::normalizeWindow( quint64 window )
*/
void WindowCtrlUnix::hideWindow( quint64 window, bool set )
{
if( !isThunderbird( getPpid() ) )
{
return;
}

Window win = static_cast<Window>( window );

char prop_name[] = "_NET_WM_STATE";
Expand Down Expand Up @@ -360,6 +396,11 @@ void WindowCtrlUnix::hideWindow( quint64 window, bool set )
*/
void WindowCtrlUnix::deleteWindow( quint64 window )
{
if( !isThunderbird( getPpid() ) )
{
return;
}

Window win = static_cast<Window>( window );

Atom prop = XInternAtom( m_display, "WM_PROTOCOLS", True );
Expand Down
19 changes: 19 additions & 0 deletions app/SysTray-X/windowctrl-unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Qt includes
*/
#include <QObject>
#include <QFileInfo>

/*
* Predefines
Expand Down Expand Up @@ -121,6 +122,24 @@ class WindowCtrlUnix : public QObject
*/
qint64 getPpid();

/**
* @brief isThunderbird. Is this a thunderbird pid.
*
* @param pid The process Id to check.
*
* @return True if this is thunderbird.
*/
bool isThunderbird( qint64 pid );

/**
* @brief getProcessName. Get the name of the proces by pid.
*
* @param pid The process Id.
*
* @return The process name.
*/
QString getProcessName( qint64 pid );

/**
* @brief findWindow. Find window by (sub)title.
*
Expand Down
Loading

0 comments on commit 211fa48

Please sign in to comment.