Introduction
The System Components are a set of widgets that are usable in both the indicators and system settings to ensure a consistent semantics exist between both Unity 7 and Unity 8.
Inhaltsverzeichnis
- Introduction Base Attributes Types and Profiles Indicator Positions
- Desktop Phone
- Root Item Progress Appointment Alarm Time Zone Calendar
- Calendar's Action
Base Attributes
Name
Type
label
string
action
string
Name of the action to activate when the menuitem is clicked
target
string
Parameter to send with the action invocation
icon
bytearray
Use g_icon_deserialize()
render-as-switch
boolean
Show a switch instead of a check mark for boolean actions
Types and Profiles
Widget
Desktop
Phone
Tablet
TV
Slider
☑
☑
☐
☐
Progress
☐
☑
☐
☐
Button
☐
☑
☐
☐
User Session
☑
☐
☐
☐
Calendar
☑
☐
☐
☐
Media Player
☑
☐
☐
☐
Time Zone
☑
☐
☐
☐
Appointment
☑
☑
☐
☐
Alarm
☑
☑
☐
☐
Access Point
☒
☑
☐
☐
Message
☑
☑
☐
☐
Indicator Positions
Each indicator may have a Position field in its indicator file, which determines the order in which indicators appear in the panel. The lower the position, the further towards the edge of the panel (right in LTR-layouts, left in RTL-layouts) an indicator appears.
Desktop
These are the positions for the standard indicators [1]:
Keyboard
80
Sync
70
Location
60
Messages
50
Power
40
Bluetooth
36
Network
35
Sound
30
Datetime
20
Session
10
[1] https://wiki.ubuntu.com/MenuBar#system-status
Phone
Messages
100
Display
90
Transfer
71
Location
60
Bluetooth
36
Network
35
Sound
30
Power
25
Datetime
20
Widget Definitions
Root Item
The base item implemented by all indicators.
Property Name
Type
Description
x-canonical-type
s
com.canonical.indicator.root
action
a{sv}
Name of an action action whose state contains the props bellow
x-canonical-secondary-action
s
Name of an action that is activated when the middle mouse button is pressed on an indicator
x-canonical-scroll-action
s
Name of an action that is activated when scrolling the mouse wheel on an indicator. That action must take an int32 parameter signifying strength and direction of the scroll
The action that the root item points to is an a{sv}.
Action Prop
Type
Description
label
s
String with label
accessible-desc
s
String used to describe the state for disabled users
icon
v
Serialized GIcon
visible
b
Whether to show the icon
pre-label
s
Label to be shown before the icon (LTR on left side, RTL on right)
icons
av
If there is more than one icon shown, this should be an array of serialized GIcons in the order they should appear. This item should take precedence over 'icon'.
title
s
User visible string to show at the head of the menu for the items in it
Progress
A menu item that contains a progress bar.
Property Name
Type
Description
x-canonical-type
s
com.canonical.indicator.progress
label
s
String with label
action
s
Name of an action action whose state contains the progress (uint32 in [0, 100])
Appointment
Sample implementation (for GTK+ in Unity 7): http://bazaar.launchpad.net/~charlesk/ido/add-progress-menu-item/view/head:/src/idoappointmentmenuitem.c#L72
Property Name
Type
Description
x-canonical-type
s
com.canonical.indicator.appointment
label
s
String with label
action
s
String with an action name
x-canonical-color
s
String specifying a color that can be used as a visual hint for the appointment's type. On the desktop this is set by the user when adding the appointment.
x-canonical-time-format
s
A strftime(3) format string specifying how to display the appointment's time.
x-canonical-time
x
A time_t specifying the appointment's localtime
Alarm
Alarm's properties are nearly identical to Appointment except for the added icon. Its has its own x-canonical-type to preserve the semantic difference.
Sample implementation (for GTK+ in Unity 7): http://bazaar.launchpad.net/~charlesk/ido/add-progress-menu-item/view/head:/src/idoalarmmenuitem.c
Property Name
Type
Description
x-canonical-type
s
com.canonical.indicator.alarm
label
s
String with label
icon
s
Serialized GIcon
action
s
String with an action name
x-canonical-color
s
String specifying a color that can be used as a visual hint for the appointment's type.
x-canonical-time-format
s
A strftime(3) format string specifying how to display the alarm's time.
x-canonical-time
x
A time_t specifying the alarm's localtime
Time Zone
By having properties for the location's timezone and time format string, the renderer has all the information it needs to periodically update its display of the current time. This way the refresh logic can be on the renderer's side and the service doesn't have to continually ship out new menuitems over the bus when the current time changes.
Sample implementation (for GTK+ in Unity7): http://bazaar.launchpad.net/~charlesk/ido/add-progress-menu-item/view/head:/src/idolocationmenuitem.c#L295
Property Name
Type
Description
x-canonical-type
s
com.canonical.indicator.location
label
s
String with label
x-canonical-time-format
s
A strftime(3) format string specifying how to display the location's current time.
x-canonical-timezone
s
timezone that the location is in.
Calendar
Property Name
Type
Description
x-canonical-type
s
com.canonical.indicator.progress
action
s
name of an action containing the calendar's state as an "a{sv}". Possible keys are: calendar-day (t), show-week-numbers (b), appointment-days (ai).
Calendar's Action
Key
Value Type
Description
calendar-day
t
a time_t denoting which year & month should be visible in the calendard and which day currently has focus/selection.
show-week-numbers
b
Whether or not to show the week numbers in the calendar.
appointment-days
ai
array of int32 day-of-months showing days with appointments in the month specified by calendar-day
Slider
Property Name
Type
Description
x-canonical-type
s
com.canonical.unity.slider
action
s
name of an action with state "d", the position of the slider
min-value
d
minimum value
max-value
d
maximum value
step
d
step increment
min-icon
v
an icon representing the minimum value
max-icon
v
an icon representing the maximum value
Media Player
A menu item representing a media player. Its state includes metadata about the currently playing track.
Property Name
Type
Description
x-canonical-type
s
com.canonical.unity.media-player
label
s
name of the player
action
s
name of an action containing the state of the player as an "a{sv}". Possible keys are : running (b), title (s), artist (s), album(s), art-url (s).
icon
v
app icon of the player
Playback
A menu item with playback controls.
Property Name
Type
Description
x-canonical-type
s
com.canonical.unity.playback-item
x-canonical-play-action
s
name of a play/pause action with string state ("Playing", "Stopped", "Launching")
x-canonical-previous-action
s
name of a stateless action for going to the previous track
x-canonical-next-action
s
name of a stateless action for going to the previous track