From d26cef6d9ac6b4882753c9385ec08202bb3e358a Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Thu, 5 Nov 2020 10:03:41 +0530 Subject: moved sleep notifier module to right, made workspace buttons clickable, made the script a bit more easier to understand --- lemonbar/mainbar | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'lemonbar/mainbar') diff --git a/lemonbar/mainbar b/lemonbar/mainbar index 7bf7ecf4..6e9873b6 100755 --- a/lemonbar/mainbar +++ b/lemonbar/mainbar @@ -2,7 +2,10 @@ # kinda minimal lemonbar script by Vidhu Kant Sharma # for herbstluftwm -# needs roboto, foboto nerd and adobe hans sans jp fonts +# needs japanese fonts and powerline fonts to be installed +# edit the fonts in the launch script + +# changing the color schemes is going to be hell import datetime import time @@ -10,20 +13,21 @@ import os day_name = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday','Sunday'] # to make day names more readable + +# japanese tag names tag_names = { - '1':'一', - '2':'二', - '3':'三', - '4':'四', - '5':'五', - '6':'六', - '7':'七', - '8':'八', - '9':'九', - '0':'十' + '1':'%{A:0:}一%{A}', + '2':'%{A:1:}二%{A}', + '3':'%{A:2:}三%{A}', + '4':'%{A:3:}四%{A}', + '5':'%{A:4:}五%{A}', + '6':'%{A:5:}六%{A}', + '7':'%{A:6:}七%{A}', + '8':'%{A:7:}八%{A}', + '9':'%{A:8:}九%{A}', + '0':'%{A:9:}十%{A}' } -# decoration variables def getTags(): tags = os.popen("herbstclient tag_status").read().split() # get tags in a list @@ -38,7 +42,7 @@ def getTags(): else: tags[i] = '%{F#443837} ' + tag_names[tag[1]] + '%{F-} ' # format other tags - return '%{A4:NEXT:}%{A5:PREV:}%{B#6c71c4} ' + ' '.join((str(x) for x in tags)) + '%{B-}' + '%{F#268bd2}%{F-}%{A}%{A}' # return formatted list in a cleaner form + return '%{B#6c71c4} ' + ' '.join((str(x) for x in tags)) + '%{B-}' + '%{F#268bd2}%{F-}' # return formatted list in a cleaner form def getTime(): @@ -47,15 +51,15 @@ def getTime(): day = "(" + day_name[day_raw] + ")" # day but in a more readable form time = datetime.datetime.now().strftime("%H:%M") # time in H:M format - return '%{F#CB4B16}%{F-}%{B#CB4B16} ' + date + day + ' ' + time + ' %{B-}' + return '%{B#171520}%{F#CB4B16}%{F-}%{B#CB4B16} ' + date + day + ' ' + time + ' %{B-}' def sleepNotifier(): - if int(datetime.datetime.now().strftime("%M")) < 6: - return "%{c}%{F#171520}%{B#dc322f} Go to sleep! %{B-}%{F-}" + if int(datetime.datetime.now().strftime("%H")) < 6: # executes between 12 and 6 a.m. + return "%{F#dc322f}%{F-}%{B#dc322f} Go to sleep! %{F#171520}%{B-}%{F-}" # prompt me to go to sleep when it's late else: return "" while True: - time.sleep(0.3) - output = getTags() + '%{r}' + getTime() + sleepNotifier() - os.system("echo '" + output + "'") + time.sleep(0.3) # be nice to the CPU + output = getTags() + '%{r}' + sleepNotifier() + getTime() + os.system("echo '" + output + "'") # for some reason print() messes up everything -- cgit v1.2.3