- version 0.1.2 + disable wayland idle tracking logic until tests
This commit is contained in:
parent
6cf8d86ffa
commit
f245f5aef0
@ -4,7 +4,7 @@
|
|||||||
// App version
|
// App version
|
||||||
#define QBREAK_VERSION_MAJOR 0
|
#define QBREAK_VERSION_MAJOR 0
|
||||||
#define QBREAK_VERSION_MINOR 1
|
#define QBREAK_VERSION_MINOR 1
|
||||||
#define QBREAK_VERSION_SUFFIX 1
|
#define QBREAK_VERSION_SUFFIX 2
|
||||||
|
|
||||||
// How often UI is updated - interval in seconds
|
// How often UI is updated - interval in seconds
|
||||||
#define INTERVAL_UPDATE_UI (60)
|
#define INTERVAL_UPDATE_UI (60)
|
||||||
|
|||||||
@ -212,10 +212,11 @@ int get_idle_time_kde_wayland()
|
|||||||
|
|
||||||
int get_idle_time_dynamically()
|
int get_idle_time_dynamically()
|
||||||
{
|
{
|
||||||
#if defined(USE_WAYLAND)
|
|
||||||
const char* wl_display = std::getenv("WAYLAND_DISPLAY");
|
const char* wl_display = std::getenv("WAYLAND_DISPLAY");
|
||||||
const char* x11_display = std::getenv("DISPLAY");
|
// const char* x11_display = std::getenv("DISPLAY");
|
||||||
if (wl_display && !x11_display)
|
|
||||||
|
#if defined(USE_WAYLAND)
|
||||||
|
if (wl_display)
|
||||||
{
|
{
|
||||||
const char* desktop_name = std::getenv("XDG_SESSION_DESKTOP");
|
const char* desktop_name = std::getenv("XDG_SESSION_DESKTOP");
|
||||||
if (!desktop_name)
|
if (!desktop_name)
|
||||||
@ -233,6 +234,9 @@ int get_idle_time_dynamically()
|
|||||||
return get_idle_time_x11();
|
return get_idle_time_x11();
|
||||||
#else
|
#else
|
||||||
// Restrict to X11
|
// Restrict to X11
|
||||||
|
if (wl_display)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return get_idle_time_x11();
|
return get_idle_time_x11();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@ -254,6 +254,12 @@ void MainWindow::createTrayIcon()
|
|||||||
mTrayIcon->show();
|
mTrayIcon->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int msec2min(int msec)
|
||||||
|
{
|
||||||
|
float min_f = float(msec) / 1000 / 60;
|
||||||
|
return (int)(min_f + 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::onUpdateUI()
|
void MainWindow::onUpdateUI()
|
||||||
{
|
{
|
||||||
if (mAppConfig.idle_timeout != 0 && mTimer->isActive())
|
if (mAppConfig.idle_timeout != 0 && mTimer->isActive())
|
||||||
@ -279,8 +285,8 @@ void MainWindow::onUpdateUI()
|
|||||||
|
|
||||||
mLastIdleMilliseconds = idle_milliseconds;
|
mLastIdleMilliseconds = idle_milliseconds;
|
||||||
|
|
||||||
// qDebug() << "Increase remaining time from " << remaining_milliseconds << " by " << delta_idle_milliseconds << ". "
|
qDebug() << "Increase remaining time from " << remaining_milliseconds << " by " << delta_idle_milliseconds << ". "
|
||||||
// << "New remaining time " << mTimer->remainingTime();
|
<< "New remaining time " << mTimer->remainingTime() << ". Idle in milliseconds " << idle_milliseconds;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mLastIdleMilliseconds = 0;
|
mLastIdleMilliseconds = 0;
|
||||||
@ -297,10 +303,10 @@ void MainWindow::onUpdateUI()
|
|||||||
if (mTimer->isActive())
|
if (mTimer->isActive())
|
||||||
{
|
{
|
||||||
auto remaining_milliseconds = mTimer->remainingTime();
|
auto remaining_milliseconds = mTimer->remainingTime();
|
||||||
if (remaining_milliseconds == 0)
|
if (remaining_milliseconds < 60000)
|
||||||
mTrayIcon->setToolTip(tr("Less than a minute left until the next break."));
|
mTrayIcon->setToolTip(tr("Less than a minute left until the next break."));
|
||||||
else
|
else
|
||||||
mTrayIcon->setToolTip(tr("There are %1 minutes left until the next break.").arg(remaining_milliseconds / 1000 / 60));
|
mTrayIcon->setToolTip(tr("There are %1 minutes left until the next break.").arg(msec2min(remaining_milliseconds)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user