Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xfce4-panel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xfce
xfce4-panel
Commits
1b6e2452
Commit
1b6e2452
authored
4 years ago
by
Simon Steinbeiss
Committed by
Simon Steinbeiß
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add Python statusnotifier for testing
parent
1e0262fc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!4
Merge xfce4-statusnotifier-plugin to the panel
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/statusnotifier/statusnotifier.py
+88
-0
88 additions, 0 deletions
plugins/statusnotifier/statusnotifier.py
with
88 additions
and
0 deletions
plugins/statusnotifier/statusnotifier.py
0 → 100644
+
88
−
0
View file @
1b6e2452
#
# Copyright (C) 2020 Simon Steinbeiß <simon@xfce.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
"""
Minimalistic StatusIcon test for the Xfce Panel
"""
import
sys
import
gi
gi
.
require_version
(
'
Gtk
'
,
'
3.0
'
)
from
gi.repository
import
Gtk
,
GLib
gi
.
require_version
(
'
AppIndicator3
'
,
'
0.1
'
)
from
gi.repository
import
AppIndicator3
as
appindicator
class
XfceStatusIcon
():
def
__init__
(
self
):
icon_theme
=
Gtk
.
IconTheme
.
get_default
()
icon_name
=
"
xfce4-logo
"
# Create StatusNotifierItem
self
.
indicator
=
appindicator
.
Indicator
.
new
(
"
xfce-sample-statusicon
"
,
icon_name
,
appindicator
.
IndicatorCategory
.
APPLICATION_STATUS
)
self
.
indicator
.
set_status
(
appindicator
.
IndicatorStatus
.
ACTIVE
)
# Create menu
status_menu
=
Gtk
.
Menu
()
# Add dummy icon check
check_menu_item
=
Gtk
.
CheckMenuItem
.
new_with_label
(
"
Update icon
"
)
check_menu_item
.
connect
(
"
activate
"
,
self
.
check_menu_item_cb
)
status_menu
.
append
(
check_menu_item
)
# Add quit menu item
quit_menu_item
=
Gtk
.
MenuItem
.
new_with_label
(
"
Quit
"
)
quit_menu_item
.
connect
(
"
activate
"
,
self
.
quit_menu_item_cb
)
status_menu
.
append
(
quit_menu_item
)
# Set the menu
status_menu
.
show_all
()
self
.
indicator
.
set_menu
(
status_menu
)
# Handle icon theme changes
icon_theme
.
connect
(
'
changed
'
,
self
.
icon_theme_changed_cb
)
def
update_icon
(
self
,
icon_name
):
self
.
indicator
.
set_icon
(
icon_name
)
def
check_menu_item_cb
(
self
,
widget
,
data
=
None
):
if
widget
.
get_active
():
icon_name
=
"
xfwm4
"
else
:
icon_name
=
"
xfce4-logo
"
self
.
update_icon
(
icon_name
)
def
icon_theme_changed_cb
(
self
,
theme
):
self
.
update_icon
(
"
xfce4-logo
"
)
def
quit_menu_item_cb
(
self
,
widget
,
data
=
None
):
Gtk
.
main_quit
()
if
__name__
==
'
__main__
'
:
try
:
XfceStatusIcon
()
Gtk
.
main
()
except
:
sys
.
exit
(
-
1
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment