Skip to content

Commit 52574a4

Browse files
committed
Merge branch 'main' of github.com:rcaelers/workrave
2 parents 5bf7d0f + aa4757e commit 52574a4

37 files changed

+3914
-2544
lines changed

changes.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
releases:
33
- version: 1.11.0-rc.2
4-
date: 2025-05-04T00:00:00+02:00
4+
date: 2025-11-23T00:00:00+02:00
55
short: |-
66
Workrave 1.11.0-rc.2 has been released.
77
changes:
@@ -18,15 +18,19 @@ releases:
1818
- Keyboard/mouse locking now works on ARM64 Windows
1919
- Handle screen lock shortcut during breaks under Xorg
2020
- Add high DPI support on Windows (#650, Charlie Lin)
21+
- Use Gnome Shell extension to display prelude windows (#621)
2122
- |-
2223
Bug fixes:
2324
- Fix crash when monitor is powered off (#606)
2425
- Fix an empty AppIndicator menu (#556, #614, wojnilowicz)
2526
- Fix issue where the tray icon did not appear on waybar, swaybar, or wf-shell trays (#555, #613, wojnilowicz)
2627
- Fix issue where the status window shows when Sway reloads despite being disabled (#612, #615, wojnilowicz)
28+
- Update AppIndicator menu when menu content changes (#556, #652,ValdikSS)
2729
- |-
2830
Updated Translations:
2931
- Update Chinese translation (#645, Sisyphe42)
32+
- Updated Indonesian translation (#653, Andika Triwidada)
33+
- Fix French translation (#656)
3034
3135
- version: 1.11.0-rc.1
3236
date: 2025-01-07T17:49:37+01:00

libs/core/include/core/IApp.hh

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ namespace workrave
2828
{
2929
public:
3030
//! The stage of a break warning (prelude)
31-
enum PreludeStage
31+
enum class PreludeStage
3232
{
33-
STAGE_INITIAL = 0,
34-
STAGE_MOVE_OUT,
35-
STAGE_WARN,
36-
STAGE_ALERT
33+
Initial = 0,
34+
MoveOut,
35+
Warn,
36+
Alert
3737
};
3838

3939
//! Text that the GUI show must in the prelude window.
40-
enum PreludeProgressText
40+
enum class PreludeProgressText
4141
{
42-
PROGRESS_TEXT_BREAK_IN,
43-
PROGRESS_TEXT_DISAPPEARS_IN,
44-
PROGRESS_TEXT_SILENT_IN
42+
BreakIn,
43+
DisappearsIn,
44+
SilentIn
4545
};
4646

4747
virtual ~IApp() = default;
@@ -70,6 +70,26 @@ namespace workrave
7070
//! Set the progress text of the prelude window.
7171
virtual void set_prelude_progress_text(PreludeProgressText text) = 0;
7272
};
73+
74+
template<>
75+
struct workrave::utils::enum_traits<IApp::PreludeStage>
76+
{
77+
static constexpr std::array<std::pair<std::string_view, IApp::PreludeStage>, 4> names{
78+
{{"initial", IApp::PreludeStage::Initial},
79+
{"move_out", IApp::PreludeStage::MoveOut},
80+
{"warn", IApp::PreludeStage::Warn},
81+
{"alert", IApp::PreludeStage::Alert}}};
82+
};
83+
84+
template<>
85+
struct workrave::utils::enum_traits<IApp::PreludeProgressText>
86+
{
87+
static constexpr std::array<std::pair<std::string_view, IApp::PreludeProgressText>, 3> names{
88+
{{"break_in", IApp::PreludeProgressText::BreakIn},
89+
{"disappears_in", IApp::PreludeProgressText::DisappearsIn},
90+
{"silent_in", IApp::PreludeProgressText::SilentIn}}};
91+
};
92+
7393
} // namespace workrave
7494

7595
#endif // WORKRAVE_BACKEND_IAPP_HH

libs/core/src/BreakControl.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,20 +157,20 @@ BreakControl::heartbeat()
157157
else if (prelude_time == 20)
158158
{
159159
// Still not idle after 20s. Red alert.
160-
application->set_prelude_stage(IApp::STAGE_ALERT);
160+
application->set_prelude_stage(IApp::PreludeStage::Alert);
161161
application->refresh_break_window();
162162
}
163163
else if (prelude_time == 10)
164164
{
165165
// Still not idle after 10s. Yellow alert.
166-
application->set_prelude_stage(IApp::STAGE_WARN);
166+
application->set_prelude_stage(IApp::PreludeStage::Warn);
167167
application->refresh_break_window();
168168
}
169169

170170
if (prelude_time == 4)
171171
{
172172
// Move prelude window to top of screen after 4s.
173-
application->set_prelude_stage(IApp::STAGE_MOVE_OUT);
173+
application->set_prelude_stage(IApp::PreludeStage::MoveOut);
174174
}
175175
}
176176
break;
@@ -648,15 +648,15 @@ BreakControl::prelude_window_start()
648648

649649
application->create_prelude_window(break_id);
650650

651-
application->set_prelude_stage(IApp::STAGE_INITIAL);
651+
application->set_prelude_stage(IApp::PreludeStage::Initial);
652652

653653
if (!reached_max_prelude)
654654
{
655-
application->set_prelude_progress_text(IApp::PROGRESS_TEXT_DISAPPEARS_IN);
655+
application->set_prelude_progress_text(IApp::PreludeProgressText::DisappearsIn);
656656
}
657657
else
658658
{
659-
application->set_prelude_progress_text(IApp::PROGRESS_TEXT_BREAK_IN);
659+
application->set_prelude_progress_text(IApp::PreludeProgressText::BreakIn);
660660
}
661661

662662
update_prelude_window();

libs/core/test/IntegrationTests.cc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ using namespace std;
6565
using namespace workrave::utils;
6666
using namespace workrave::config;
6767
using namespace workrave;
68+
6869
namespace workrave
6970
{
7071
std::ostream &operator<<(std::ostream &stream, ::workrave::OperationMode e)
@@ -84,6 +85,18 @@ namespace workrave
8485
stream << workrave::utils::enum_to_string(e);
8586
return stream;
8687
}
88+
89+
std::ostream &operator<<(std::ostream &stream, ::workrave::IApp::PreludeStage e)
90+
{
91+
stream << workrave::utils::enum_to_string(e);
92+
return stream;
93+
}
94+
95+
std::ostream &operator<<(std::ostream &stream, ::workrave::IApp::PreludeProgressText e)
96+
{
97+
stream << workrave::utils::enum_to_string(e);
98+
return stream;
99+
}
87100
} // namespace workrave
88101

89102
#if SPDLOG_VERSION >= 10600
@@ -631,11 +644,11 @@ class Backend : public workrave::IApp
631644

632645
if (prelude_count[active_prelude] < max_preludes)
633646
{
634-
BOOST_CHECK_EQUAL(text, IApp::PROGRESS_TEXT_DISAPPEARS_IN);
647+
BOOST_CHECK_EQUAL(text, IApp::PreludeProgressText::DisappearsIn);
635648
}
636649
else
637650
{
638-
BOOST_CHECK_EQUAL(text, IApp::PROGRESS_TEXT_BREAK_IN);
651+
BOOST_CHECK_EQUAL(text, IApp::PreludeProgressText::BreakIn);
639652
}
640653

641654
need_refresh = true;

libs/corenext/include/core/IApp.hh

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ namespace workrave
2828
{
2929
public:
3030
//! The stage of a break warning (prelude)
31-
enum PreludeStage
31+
enum class PreludeStage
3232
{
33-
STAGE_INITIAL = 0,
34-
STAGE_MOVE_OUT,
35-
STAGE_WARN,
36-
STAGE_ALERT
33+
Initial = 0,
34+
MoveOut,
35+
Warn,
36+
Alert
3737
};
3838

3939
//! Text that the GUI show must in the prelude window.
40-
enum PreludeProgressText
40+
enum class PreludeProgressText
4141
{
42-
PROGRESS_TEXT_BREAK_IN,
43-
PROGRESS_TEXT_DISAPPEARS_IN,
44-
PROGRESS_TEXT_SILENT_IN
42+
BreakIn,
43+
DisappearsIn,
44+
SilentIn
4545
};
4646

4747
virtual ~IApp() = default;
@@ -70,6 +70,26 @@ namespace workrave
7070
//! Set the progress text of the prelude window.
7171
virtual void set_prelude_progress_text(PreludeProgressText text) = 0;
7272
};
73+
74+
template<>
75+
struct workrave::utils::enum_traits<IApp::PreludeStage>
76+
{
77+
static constexpr std::array<std::pair<std::string_view, IApp::PreludeStage>, 4> names{
78+
{{"initial", IApp::PreludeStage::Initial},
79+
{"move_out", IApp::PreludeStage::MoveOut},
80+
{"warn", IApp::PreludeStage::Warn},
81+
{"alert", IApp::PreludeStage::Alert}}};
82+
};
83+
84+
template<>
85+
struct workrave::utils::enum_traits<IApp::PreludeProgressText>
86+
{
87+
static constexpr std::array<std::pair<std::string_view, IApp::PreludeProgressText>, 3> names{
88+
{{"break_in", IApp::PreludeProgressText::BreakIn},
89+
{"disappears_in", IApp::PreludeProgressText::DisappearsIn},
90+
{"silent_in", IApp::PreludeProgressText::SilentIn}}};
91+
};
92+
7393
} // namespace workrave
7494

7595
#endif // WORKRAVE_BACKEND_IAPP_HH

libs/corenext/src/BreakStateModel.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,20 @@ BreakStateModel::process()
125125
else if (prelude_time == 20)
126126
{
127127
// Still not idle after 20s. Red alert.
128-
application->set_prelude_stage(IApp::STAGE_ALERT);
128+
application->set_prelude_stage(IApp::PreludeStage::Alert);
129129
application->refresh_break_window();
130130
}
131131
else if (prelude_time == 10)
132132
{
133133
// Still not idle after 10s. Yellow alert.
134-
application->set_prelude_stage(IApp::STAGE_WARN);
134+
application->set_prelude_stage(IApp::PreludeStage::Warn);
135135
application->refresh_break_window();
136136
}
137137

138138
if (prelude_time == 4)
139139
{
140140
// Move prelude window to top of screen after 4s.
141-
application->set_prelude_stage(IApp::STAGE_MOVE_OUT);
141+
application->set_prelude_stage(IApp::PreludeStage::MoveOut);
142142
}
143143
}
144144
break;
@@ -454,15 +454,15 @@ BreakStateModel::prelude_window_start()
454454

455455
application->hide_break_window();
456456
application->create_prelude_window(break_id);
457-
application->set_prelude_stage(IApp::STAGE_INITIAL);
457+
application->set_prelude_stage(IApp::PreludeStage::Initial);
458458

459459
if (!has_reached_max_preludes())
460460
{
461-
application->set_prelude_progress_text(IApp::PROGRESS_TEXT_DISAPPEARS_IN);
461+
application->set_prelude_progress_text(IApp::PreludeProgressText::DisappearsIn);
462462
}
463463
else
464464
{
465-
application->set_prelude_progress_text(IApp::PROGRESS_TEXT_BREAK_IN);
465+
application->set_prelude_progress_text(IApp::PreludeProgressText::BreakIn);
466466
}
467467

468468
prelude_window_update();

libs/corenext/test/IntegrationTests.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ namespace workrave
8181
stream << workrave::utils::enum_to_string(e);
8282
return stream;
8383
}
84+
85+
std::ostream &operator<<(std::ostream &stream, ::workrave::IApp::PreludeStage e)
86+
{
87+
stream << workrave::utils::enum_to_string(e);
88+
return stream;
89+
}
90+
91+
std::ostream &operator<<(std::ostream &stream, ::workrave::IApp::PreludeProgressText e)
92+
{
93+
stream << workrave::utils::enum_to_string(e);
94+
return stream;
95+
}
8496
} // namespace workrave
8597

8698
using namespace workrave::config;
@@ -611,11 +623,11 @@ class Backend : public workrave::IApp
611623

612624
if (prelude_count[active_prelude] < max_preludes)
613625
{
614-
BOOST_CHECK_EQUAL(text, IApp::PROGRESS_TEXT_DISAPPEARS_IN);
626+
BOOST_CHECK_EQUAL(text, IApp::PreludeProgressText::DisappearsIn);
615627
}
616628
else
617629
{
618-
BOOST_CHECK_EQUAL(text, IApp::PROGRESS_TEXT_BREAK_IN);
630+
BOOST_CHECK_EQUAL(text, IApp::PreludeProgressText::BreakIn);
619631
}
620632

621633
need_refresh = true;

0 commit comments

Comments
 (0)