Browse Source

fixed clock widget

master
Robin Thoni 9 years ago
parent
commit
f6a4f2f04b
1 changed files with 8 additions and 17 deletions
  1. 8
    17
      i3/status/i3status/change_i3pystatus.py

+ 8
- 17
i3/status/i3status/change_i3pystatus.py View File

14
 ###############################################################################
14
 ###############################################################################
15
 # Tools
15
 # Tools
16
 ###############################################################################
16
 ###############################################################################
17
-g_i3bar_size = 18
17
+g_i3bar_size = 20
18
 
18
 
19
 
19
 
20
 def exec(s):
20
 def exec(s):
34
 
34
 
35
 def get_current_screen_size(x, y):
35
 def get_current_screen_size(x, y):
36
     screen = Gtk.Window().get_screen()
36
     screen = Gtk.Window().get_screen()
37
-    mn_number = screen.get_monitor_at_point(x, y) + 1
38
-    width, height = 0, 0
39
-    for mn_curr in range(mn_number):
40
-        mn = screen.get_monitor_geometry(mn_curr)
41
-        width += mn.width
42
-        height += mn.height
43
-    return width, height
44
-
37
+    mn_number = screen.get_monitor_at_point(x, y)
38
+    return screen.get_monitor_geometry(mn_number)
45
 
39
 
46
 ###############################################################################
40
 ###############################################################################
47
 # Command end point
41
 # Command end point
72
 
66
 
73
         x, y = s._pos_x, s._pos_y
67
         x, y = s._pos_x, s._pos_y
74
         width_calendar, height_calendar = 300, 210  # fixed values...
68
         width_calendar, height_calendar = 300, 210  # fixed values...
75
-        width, height = get_current_screen_size(x, y)
69
+        rect = get_current_screen_size(x, y)
76
 
70
 
77
-        if (x > width - width_calendar):
78
-            x = width - width_calendar
71
+        x = rect.width + rect.x - width_calendar
79
         if (y < g_i3bar_size):
72
         if (y < g_i3bar_size):
80
-            y = g_i3bar_size
81
-        if (y > height - height_calendar):
82
-            y = height - height_calendar - g_i3bar_size
73
+            y = rect.y + g_i3bar_size
74
+        else:
75
+            y = rect.height + rect.y - height_calendar - g_i3bar_size
83
 
76
 
84
         s._pid = exec("calendar-window --size=%d-%d --position=%d-%d "
77
         s._pid = exec("calendar-window --size=%d-%d --position=%d-%d "
85
                 "--onLostFocus=%s" % (width_calendar, height_calendar,
78
                 "--onLostFocus=%s" % (width_calendar, height_calendar,
86
                     x, y, "quit" if quit else "ignore"))
79
                     x, y, "quit" if quit else "ignore"))
87
-        #s._pid = exec("yad --no-buttons --geometry=+%d+%d --class "
88
-        #              "\"i3bar-gui\" --calendar" % (x, y))
89
     def display_calendar_quit(s):
80
     def display_calendar_quit(s):
90
         display_calendar(True, s)
81
         display_calendar(True, s)
91
     def display_calendar_ignore(s):
82
     def display_calendar_ignore(s):

Loading…
Cancel
Save