aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com>2020-11-05 10:03:41 +0530
committerVidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com>2020-11-05 10:03:41 +0530
commitd26cef6d9ac6b4882753c9385ec08202bb3e358a (patch)
treeba5d6377e40754e760242cd1fc76e0acd3af5ddd
parent25fa5f6b66b76a50aab20ebd4899e7bdef5c5343 (diff)
moved sleep notifier module to right, made workspace buttons clickable, made the script a bit more easier to understand
-rwxr-xr-xlemonbar/button-actions14
-rwxr-xr-xlemonbar/launch8
-rwxr-xr-xlemonbar/mainbar42
3 files changed, 44 insertions, 20 deletions
diff --git a/lemonbar/button-actions b/lemonbar/button-actions
new file mode 100755
index 00000000..bebf6635
--- /dev/null
+++ b/lemonbar/button-actions
@@ -0,0 +1,14 @@
+#!/bin/python
+
+# this script is a somewhat hacky way to switch workspaces
+# by clicking the workspaces on the lemonbar
+# written by Vidhu Kant Sharma for his herbstluftwm lemonbar
+# the output from the launch script should be piped into this
+
+import os
+
+print('scripts launched')
+while True:
+ action = input()
+
+ os.system('herbstclient use_index ' + action)
diff --git a/lemonbar/launch b/lemonbar/launch
index 8390171a..1f521365 100755
--- a/lemonbar/launch
+++ b/lemonbar/launch
@@ -1,6 +1,12 @@
#!/bin/bash
-./mainbar | lemonbar -g 1366x21 -B '#171520' -p -F '#ffffff' -f "Source Han Sans JP:size=10" -o -3 -f "RobotoMono Nerd Font:style=Regular:size=15" -f -n "mainbar" -o 0
+# this script executes the mainbar script
+# then pipes it into lemonbar
+# and pipes the lemonbar's output
+# to the button-actions script
+# which handles all the button actions
+
+./mainbar | lemonbar -g 1366x21 -B '#171520' -p -F '#ffffff' -f "Source Han Sans JP:size=10" -o -3 -f "RobotoMono Nerd Font:style=Regular:size=15" -f -n "mainbar" -o 0 | ./button-actions
echo "lemonbar launched"
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