forked from darthlukan/pypanel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pypanelrc.py
272 lines (244 loc) · 11.7 KB
/
pypanelrc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
#------------------------------------------------------------------------------
#
# PyPanel v2.4 Configuration
#
# This configuration file is a Python script that will be executed when
# PyPanel is started. In order for PyPanel to start properly, make sure that
# this file contains proper Python formatting and no syntax errors.
#------------------------------------------------------------------------------
VERSION = 2.4 # Config file version
#------------------------------------------------------------------------------
# Colors: Format is hex triplet - 0xrrggbb
#------------------------------------------------------------------------------
BG_COLOR = "0xd6d6d6" # Panel background and tinting color
TASK_COLOR = "0x000000" # Normal task name color
FOCUSED_COLOR = "0x1826de" # Focused task name color
SHADED_COLOR = "0x808080" # Shaded task name color
MINIMIZED_COLOR = "0x808080" # Minimized task name color
DESKTOP_COLOR = "0x000000" # Desktop name color
CLOCK_COLOR = "0x000000" # Clock text color
LINE_COLOR = "0x606060" # Vertical line color
# Text Shadow Colors
TASK_SHADOW_COLOR = "0xffffff"
FOCUSED_SHADOW_COLOR = "0xffffff"
SHADED_SHADOW_COLOR = "0xffffff"
MINIMIZED_SHADOW_COLOR = "0xffffff"
DESKTOP_SHADOW_COLOR = "0xffffff"
CLOCK_SHADOW_COLOR = "0xffffff"
#------------------------------------------------------------------------------
# Panel Spacing and Location Options: Measured in pixels
#------------------------------------------------------------------------------
P_LOCATION = 1 # Panel placement: 0 = top, 1 = bottom
P_WIDTH = 0 # Panel width: 0 = Use full screen width
P_START = 0 # Starting X coordinate of the panel
P_SPACER = 6 # Spacing between panel objects
P_HEIGHT = 24 # Panel height
#------------------------------------------------------------------------------
# Panel Tasks Options
#------------------------------------------------------------------------------
T_FILL = 0 # Tasks fill panel width: 0 = No, 1 = Yes
T_WIDTH = 180 # Task width
#------------------------------------------------------------------------------
# Icon Size Options: Measured in pixels
#------------------------------------------------------------------------------
I_HEIGHT = 16 # Panel application icon height
I_WIDTH = 16 # Panel application icon Width
APPL_I_HEIGHT = 24 # Application launcher icon height
APPL_I_WIDTH = 24 # Application launcher icon width
TRAY_I_HEIGHT = 24 # System tray icon height (usually 16 or 24)
TRAY_I_WIDTH = 24 # System tray icon width (usually 16 or 24)
# If TRAY_I_WIDTH is set to 0, then the
# width specified by the tray app will be used
#------------------------------------------------------------------------------
# Panel Clock Format: 'man strftime' for detailed formatting options and help
#------------------------------------------------------------------------------
CLOCK_FORMAT = "%Y-%m-%d %H:%M" # Ex: 2004-09-25 17:45
TIME_BEATS = 0 # Set to 1 to show time in Swatch Internet Time
#------------------------------------------------------------------------------
# Clock Delay: Seconds between each clock update during periods of inactivity
#------------------------------------------------------------------------------
CLOCK_DELAY = 20
#------------------------------------------------------------------------------
# Hidden Application List: Apps listed here will not be display on the panel
# The application name is its WM_CLASS name, use 'xprop' to find WM_CLASS
# Ex: ["xmms", "xine", "gDesklets"]
#------------------------------------------------------------------------------
HIDE_LIST = []
#------------------------------------------------------------------------------
# Hidden Panel Size: Size of the panel when it's hidden/minimized
#------------------------------------------------------------------------------
HIDDEN_SIZE = 2
#------------------------------------------------------------------------------
# Panel Text Font: This option takes either a traditional or Xft font string
# Ex: "-schumacher-clean-medium-r-normal-*-12-*-*-*-*-*-*-*"
# "aquafont-8"
#------------------------------------------------------------------------------
FONT = "bitstream vera sans-8"
#------------------------------------------------------------------------------
# Show All Applications: Show apps from all desktops or just the current
# 0: Disabled - Only applications on the current desktop will be displayed
# 1: Enabled - Selected apps are moved to the current desktop
# 2: Enabled - Current desktop is changed to the selected apps desktop
#------------------------------------------------------------------------------
SHOWALL = 0 # 0, 1 or 2 - see descriptions above
#------------------------------------------------------------------------------
# Show Minimized/Iconified Applications: Show only minimized apps or all apps
# 0: Disabled - Show all applications on the panel
# 1: Enabled - Show only minimized apps on the panel
#------------------------------------------------------------------------------
SHOWMINIMIZED = 0
#------------------------------------------------------------------------------
# Application Icon List: List of custom icons for specific applications
# The application name is its WM_CLASS name, use 'xprop' to find WM_CLASS
#
# The "default" entry is used for applications with no icon. If left "",
# PyPanel will use the default icon distributed with the source.
#
# Add entries using the following format -
# "<application name>" : "<full path to icon>",
#------------------------------------------------------------------------------
ICON_LIST = {
"default" : "",
"example" : "/usr/share/imlib2/data/images/audio.png",
}
#------------------------------------------------------------------------------
# Application Launch List: Ordered list of icons and applications for the
# application launcher.
#
# Add entries using the following format -
# ("<executable>", "<full path to icon>")
#------------------------------------------------------------------------------
LAUNCH_LIST = [
("gimp-2.2", "/usr/share/imlib2/data/images/paper.png"),
]
#------------------------------------------------------------------------------
# Background Alpha/Shade Level: 0 (Fully Translucent) -> 255 (Fully Opaque)
# BG_COLOR is used for tinting
#------------------------------------------------------------------------------
SHADE = 50
#------------------------------------------------------------------------------
# Misc. Options: 1 = Enabled/Yes, 0 = Disabled/No
#------------------------------------------------------------------------------
ABOVE = 1 # Panel is always above other apps
APPICONS = 1 # Show application icons
AUTOHIDE = 0 # Autohide uses the CLOCK_DELAY timer above
SHADOWS = 0 # Show text shadows
SHOWLINES = 1 # Show object seperation lines
SHOWBORDER = 0 # Show a border around the panel
#------------------------------------------------------------------------------
# Desktop Names: Configure the names of your desktops
# If the option is [], PyPanel will attempt to use the desktop name specified
# by the XServer, if that fails it will use the desktop number as its name
# Ex. ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight"]
#------------------------------------------------------------------------------
DESKTOP_NAMES = []
#------------------------------------------------------------------------------
# Panel Layout: -----------------------------------
# [ 1 ][ 2 ][ 3 ][ 4 ][ 5 ]
# -----------------------------------
#
# The panel layout is split into 5 sections numbered 1, 2, 3, 4 or 5 as shown
# in the diagram above. Each of the following objects can be enabled by
# assigning it a section number or disabled by assigning it 0:
#------------------------------------------------------------------------------
DESKTOP = 1 # Desktop name section
TASKS = 2 # Task names section
TRAY = 3 # System tray section
CLOCK = 4 # Clock section
LAUNCHER = 0 # Application launcher section
#------------------------------------------------------------------------------
# Button Event Function Definitions
#------------------------------------------------------------------------------
# Left click - button 1
# Middle click - button 2
# Right click - button 3
# Wheel up - button 4
# Wheel down - button 5
#
# changeDesktop(x)
# - Change Desktop: Increase or decrease the current desktop by 'x' amount
#
# toggleShade(task)
# - Shade or Unshade an application
#
# toggleHidden()
# - Minimize the panel to the top or bottom depending on its start location
#
# toggleMinimize(task, traise=1)
# - Minimize or Unminimize an application and optionally raise it
#
# taskRaise(task, focus=1)
# - Raise an application to the top of the window list and optionally focus it
#
# taskLower(task, focus=0)
# - Lower an app to the bottom of the window list and optionally focus it
#
# taskFocus(task)
# - Give focus to the selected application, if it has focus then minimize it
#
# showDesktop()
# - Toggle between hiding and unhiding ALL applications
#------------------------------------------------------------------------------
#----------------------------------
def desktopButtonEvent(pp, button):
#----------------------------------
""" Button event handler for the panel's desktop object """
if button == 1:
pp.changeDesktop(-1)
elif button == 2:
pp.changeDesktop(2)
elif button == 3:
pp.changeDesktop(1)
elif button == 4:
pp.changeDesktop(1)
elif button == 5:
pp.changeDesktop(-1)
#--------------------------------
def clockButtonEvent(pp, button):
#--------------------------------
""" Button event handler for the panel's clock object """
if button == 1:
os.system("xclock &")
elif button == 2:
pass
elif button == 3:
pp.toggleHidden()
elif button == 4:
pp.showDesktop()
elif button == 5:
pp.showDesktop()
#--------------------------------
def panelButtonEvent(pp, button):
#--------------------------------
""" Button event handler for the panel with no active tasks """
if button == 1:
pass
elif button == 2:
pass
elif button == 3:
pass
elif button == 4:
pass
elif button == 5:
pass
#-------------------------------------
def taskButtonEvent(pp, button, task):
#-------------------------------------
""" Button event handler for the panel's tasks """
if button == 1:
pp.taskFocus(task)
elif button == 2:
# Destroy the application
task.obj.destroy()
elif button == 3:
# Ex. - XMMS doesn't shade, so we want to minimize it instead and
# still use button 3 to shade other applications
# task.tclass is the tasks class name (WM_CLASS)
if "xmms" in task.tclass:
pp.toggleMinimize(task)
else:
pp.toggleShade(task)
elif button == 4:
pp.taskRaise(task, focus=1)
elif button == 5:
pp.taskLower(task, focus=0)