Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tray
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
tray
Commits
57335315
Commit
57335315
authored
Jul 03, 2024
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimization
parent
f33b8c68
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
17 deletions
+6
-17
example_pp.cpp
example/example_pp.cpp
+5
-2
tray.h
include/tray/tray.h
+0
-1
tray.cpp
src/tray.cpp
+1
-14
No files found.
example/example_pp.cpp
View file @
57335315
...
...
@@ -19,17 +19,20 @@ int main() {
w
.
text_
=
_
(
"TASKMGR"
);
trays
::
Menu
e
;
e
.
text_
=
_
(
"CHANGELOG"
);
trays
::
Menu
r
;
r
.
text_
=
_
(
"FORCE EXIT"
);
// linux: png, svg
std
::
string
icon_name
=
"portproton_tray.svg"
;
// absolute path for linux.
auto
icon_path
=
std
::
filesystem
::
current_path
()
/
icon_name
;
auto
icon_path
=
std
::
filesystem
::
current_path
()
/
icon_name
;
q
.
on_click_
=
[](
auto
)
{
system
(
"bash -c pw_tray_winefile &"
);
};
w
.
on_click_
=
[](
auto
)
{
system
(
"bash -c pw_tray_taskmgr &"
);
};
e
.
on_click_
=
[](
auto
)
{
system
(
"bash -c open_changelog &"
);
};
r
.
on_click_
=
[](
auto
)
{
system
(
"bash -c tray_icon_click_exit"
);
tray_exit
();
};
trays
::
Tray
t
{
icon_path
.
string
(),
{
q
,
w
,
e
}};
trays
::
Tray
t
{
icon_path
.
string
(),
{
q
,
w
,
e
,
r
}};
t
.
run
();
}
include/tray/tray.h
View file @
57335315
...
...
@@ -16,7 +16,6 @@ class Tray {
public
:
Tray
(
std
::
string
icon_path
,
std
::
vector
<
Menu
>
menus
=
{});
void
run
();
void
add
(
Menu
menu
);
private
:
...
...
src/tray.cpp
View file @
57335315
...
...
@@ -3,23 +3,12 @@
#include <libintl.h>
#include <locale.h>
#define _(STRING) gettext(STRING)
trays
::
Tray
::
Tray
(
std
::
string
icon_path
,
std
::
vector
<
Menu
>
menus
)
:
icon_
(
icon_path
)
{
for
(
auto
m
:
menus
)
{
add
(
m
);
}
setlocale
(
LC_ALL
,
""
);
bindtextdomain
(
"tray"
,
getenv
(
"PWD"
));
textdomain
(
"tray"
);
Menu
exit
;
exit
.
on_click_
=
[](
Menu
*
)
{
system
(
"bash -c tray_icon_click_exit"
);
tray_exit
();
};
exit
.
text_
=
_
(
"FORCE EXIT"
);
add
(
exit
);
tray_
.
icon
=
&
icon_path
[
0
];
tray_init
(
&
tray_
);
...
...
@@ -36,9 +25,7 @@ trays::Tray::Tray(std::string icon_path, std::vector<Menu> menus)
// you can throw away anythings others.
}
void
trays
::
Tray
::
run
()
{
while
(
!
tray_loop
(
1
))
{
;
}
while
(
!
tray_loop
(
1
))
{}
}
void
trays
::
Tray
::
add
(
Menu
menu
)
{
if
(
!
raw_menus_
.
empty
())
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment