From c0333b8bd91b164d452e515fb4176089823aa65a Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Tue, 1 Dec 2020 12:10:20 +0530 Subject: fixed the temperature being blank if weather stat wasn't haze; currently only supports haze and smoke --- awesome/rc.lua | 1 + fish/config.fish | 4 +-- fish/fish_variables | 1 + lemonbar/button-actions | 14 ---------- lemonbar/mainbar | 65 ---------------------------------------------- lemonbar/sys_bar | 14 ++++++++++ lemonbar/ws_bar | 65 ++++++++++++++++++++++++++++++++++++++++++++++ lemonbar/ws_button_actions | 14 ++++++++++ picom.conf | 5 ++++ scripts/weather | 17 +++++++++--- 10 files changed, 114 insertions(+), 86 deletions(-) delete mode 100755 lemonbar/button-actions delete mode 100755 lemonbar/mainbar create mode 100755 lemonbar/sys_bar create mode 100755 lemonbar/ws_bar create mode 100755 lemonbar/ws_button_actions diff --git a/awesome/rc.lua b/awesome/rc.lua index c3eacdaa..6d389fe6 100755 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -639,3 +639,4 @@ awful.spawn.with_shell("nitrogen --restore") awful.spawn.with_shell("picom") awful.spawn.with_shell("firefox") awful.spawn.with_shell("sxhkd") +awful.spawn.with_shell("deadd-notification-center") diff --git a/fish/config.fish b/fish/config.fish index 4b981b42..1b61180c 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -17,6 +17,4 @@ alias ls='exa -l' alias la='exa -a' alias lsa='exa -al' alias nf='neofetch' - -alias vysor='Vysor.AppImage' - +alias vim='nvim' diff --git a/fish/fish_variables b/fish/fish_variables index 44da7342..bff725f5 100644 --- a/fish/fish_variables +++ b/fish/fish_variables @@ -30,3 +30,4 @@ SETUVAR fish_pager_color_completion:\x1d SETUVAR fish_pager_color_description:B3A06D\x1eyellow SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan +SETUVAR fish_user_paths:/home/zt/\x2elocal/bin\x1e/zt/Programs\x1e/home/zt/\x2econfig/scripts diff --git a/lemonbar/button-actions b/lemonbar/button-actions deleted file mode 100755 index bebf6635..00000000 --- a/lemonbar/button-actions +++ /dev/null @@ -1,14 +0,0 @@ -#!/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/mainbar b/lemonbar/mainbar deleted file mode 100755 index d8d1674e..00000000 --- a/lemonbar/mainbar +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/python - -# kinda minimal lemonbar script by Vidhu Kant Sharma -# for herbstluftwm -# 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 -import os - - -day_name = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday','Sunday'] # to make day names more readable - -# japanese tag names -tag_names = { - '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}' -} - - -def getTags(): - tags = os.popen("herbstclient tag_status").read().split() # get tags in a list - - for i in range(len(tags)): - tag = tags[i] - - if tag[0] == ':': - tags[i] = ' ' + tag_names[tag[1]] + ' ' # format occupied tags - elif tag[0] == '#': - tags[i] = '%{F#6c71c4}%{B#d33682}%{F-} ' + tag_names[tag[1]] + '%{F#d33682} %{B#268bd2}%{F-}' # format active tag - else: - tags[i] = '%{F#443837} ' + tag_names[tag[1]] + '%{F-} ' # format other tags - - return '%{B#6c71c4} ' + ' '.join((str(x) for x in tags)) + '%{B-}' + '%{F#268bd2}%{F-}' # return formatted list in a cleaner form - - -def getTime(): - date = datetime.datetime.today().strftime("%d/%m") # date in DD/MM format - day_raw = datetime.datetime.today().weekday() # get number of day - 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 '%{B#171520}%{F#CB4B16}%{F-}%{B#CB4B16} ' + date + day + ' ' + time + ' %{B-}' - -def sleepNotifier(): - 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) # be nice to the CPU - output = getTags() + '%{r}' + sleepNotifier() + getTime() - os.system("echo '" + output + "'") # for some reason print() messes up everything diff --git a/lemonbar/sys_bar b/lemonbar/sys_bar new file mode 100755 index 00000000..f55e26d0 --- /dev/null +++ b/lemonbar/sys_bar @@ -0,0 +1,14 @@ +#!/bin/python + +import time +import os + +def getMem(): + mem = os.popen('free -m | grep Mem').read().split() + return 'Mem: ' + str(int(int(mem[2]) / int(mem[1]) * 100)) + +print(getMem()) + +def getCPU(): + + diff --git a/lemonbar/ws_bar b/lemonbar/ws_bar new file mode 100755 index 00000000..d8d1674e --- /dev/null +++ b/lemonbar/ws_bar @@ -0,0 +1,65 @@ +#!/bin/python + +# kinda minimal lemonbar script by Vidhu Kant Sharma +# for herbstluftwm +# 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 +import os + + +day_name = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday','Sunday'] # to make day names more readable + +# japanese tag names +tag_names = { + '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}' +} + + +def getTags(): + tags = os.popen("herbstclient tag_status").read().split() # get tags in a list + + for i in range(len(tags)): + tag = tags[i] + + if tag[0] == ':': + tags[i] = ' ' + tag_names[tag[1]] + ' ' # format occupied tags + elif tag[0] == '#': + tags[i] = '%{F#6c71c4}%{B#d33682}%{F-} ' + tag_names[tag[1]] + '%{F#d33682} %{B#268bd2}%{F-}' # format active tag + else: + tags[i] = '%{F#443837} ' + tag_names[tag[1]] + '%{F-} ' # format other tags + + return '%{B#6c71c4} ' + ' '.join((str(x) for x in tags)) + '%{B-}' + '%{F#268bd2}%{F-}' # return formatted list in a cleaner form + + +def getTime(): + date = datetime.datetime.today().strftime("%d/%m") # date in DD/MM format + day_raw = datetime.datetime.today().weekday() # get number of day + 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 '%{B#171520}%{F#CB4B16}%{F-}%{B#CB4B16} ' + date + day + ' ' + time + ' %{B-}' + +def sleepNotifier(): + 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) # be nice to the CPU + output = getTags() + '%{r}' + sleepNotifier() + getTime() + os.system("echo '" + output + "'") # for some reason print() messes up everything diff --git a/lemonbar/ws_button_actions b/lemonbar/ws_button_actions new file mode 100755 index 00000000..bebf6635 --- /dev/null +++ b/lemonbar/ws_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/picom.conf b/picom.conf index b96fafda..a0a957a7 100644 --- a/picom.conf +++ b/picom.conf @@ -428,8 +428,13 @@ opacity-rule = [ "95:class_g = 'Thunderbird' && focused", "90:class_g = 'Thunderbird' && !focused", "90:name *?= 'AUR'", + "90:name *?= 'Arch'", + "90:name *?= 'google'", + "95:name *?= 'stackoverflow'", "90:name *?= 'Vidhu Kant'", "95:name *?= 'DuckDuckgo'", "98:name *?= 'twitter'", "98:name *?= 'Mail'", + "98:name *?= 'WhatsApp'", + "97:name *?= 'Discord'", ]; diff --git a/scripts/weather b/scripts/weather index 3fcab925..cc0ac150 100755 --- a/scripts/weather +++ b/scripts/weather @@ -1,12 +1,21 @@ #!/bin/bash get_current_temp() { - temp=$(curl wttr.in | grep °C | awk 'NR==1 {print $9 "°C"}' | sed -r "s/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g") # > /tmp/weather_temperature) - stat=$(curl wttr.in | awk 'NR==3 {print $1}') - echo $temp "("$stat")" + if [ $stat == "Smoke" ]; then + temp=$(curl wttr.in | grep °C | awk 'NR==1 {print $4 "°C"}' | sed -r "s/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g") + elif [ $stat == "Haze" ]; then + temp=$(curl wttr.in | grep °C | awk 'NR==1 {print $9 "°C"}' | sed -r "s/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g") + fi + + echo $temp +} + +get_current_weather() { + stat=$(curl wttr.in | awk 'NR==3 {print $1}') + echo $(get_current_temp) "("$stat")" } while :; do - echo $(get_current_temp) > /tmp/weather_stat + echo $(get_current_weather) > /tmp/weather_stat sleep 3600 done -- cgit v1.2.3