4
4
import time
5
5
import sys
6
6
7
- seperator = " %{FYellow}»%{F-} "
8
7
seperator = " "
9
8
10
9
def get_date ():
@@ -39,12 +38,10 @@ def get_workspaces(monitor):
39
38
print (type (workspaces ))
40
39
for workspace in workspaces :
41
40
workspace = int (workspace )
42
- if monitor == 0 :
43
- if workspace >= 0 and workspace <= 5 :
44
- line += str (workspace ) + " "
45
- if monitor == 1 :
46
- if workspace > 0 and workspace >= 6 :
47
- line += str (workspace ) + " "
41
+ if monitor == 0 and workspace in range (1 ,6 ):
42
+ line += str (workspace ) + " "
43
+ if monitor == 1 and workspace in range (6 , 11 ):
44
+ line += str (workspace ) + " "
48
45
return line
49
46
50
47
def get_active_workspace (monitor ):
@@ -53,36 +50,31 @@ def get_active_workspace(monitor):
53
50
for line in tree :
54
51
if "DVI-" + str (monitor ) in line :
55
52
flag = True
56
- if flag :
57
- if line .startswith ("\t " ) and not line .startswith ("\t \t " ):
58
- workspace = int (line .split (" " )[0 ].strip ())
59
- if monitor == 0 :
60
- if workspace > 0 and workspace <= 5 :
61
- if "*" in line :
62
- return workspace
63
- if monitor == 1 :
64
- if workspace > 1 and workspace >= 6 :
65
- if "*" in line :
66
- return workspace
53
+ if flag and line .startswith ("\t " ) and not line .startswith ("\t \t " ):
54
+ workspace = int (line .split (" " )[0 ].strip ())
55
+ if monitor == 0 and workspace in range (0 , 6 ) and "*" in line :
56
+ return workspace
57
+ if monitor == 1 and workspace in range (6 ,11 ) and "*" in line :
58
+ return workspace
67
59
68
60
def get_workspace_text (monitor ):
69
61
focused_color = "%{F#0066FF}"
70
62
unfocused_color = "%{F#66CCFF}"
71
63
window_icon = "\ue056 "
72
- command = "bspc desktop -f "
73
- active_workspace = get_active_workspace (monitor )
74
64
lines = ""
65
+
66
+ active_workspace = get_active_workspace (monitor )
75
67
if monitor == 0 :
76
- lower_bound = 1
77
- upper_bound = 6
68
+ workspace_range = range (1 ,6 )
78
69
if monitor == 1 :
79
- lower_bound = 6
80
- upper_bound = 11
81
- for num in range ( lower_bound , upper_bound ) :
70
+ workspace_range = range ( 6 , 11 )
71
+
72
+ for num in workspace_range :
82
73
if num == active_workspace :
83
74
lines += focused_color + "%{A:bspc desktop -f " + str (num ) + ":}" + window_icon + "%{A}%{F-} "
84
75
else :
85
76
lines += unfocused_color + "%{A:bspc desktop -f " + str (num ) + ":}" + window_icon + "%{A}%{F-} "
77
+
86
78
return lines .strip ()
87
79
88
80
def get_text ():
0 commit comments