Merge branch 'upstream-custom' into dev

This commit is contained in:
Yingjie Wang 2024-08-27 10:56:13 -04:00
commit eff1f37c03
6 changed files with 59 additions and 3 deletions

View File

@ -85,7 +85,7 @@
}, },
{ {
"type": "editor", "type": "editor",
"key": "├─", "key": "├─",
"keyColor": "yellow" "keyColor": "yellow"
}, },
{ {

View File

@ -1,5 +1,5 @@
font_family Fira Code Nerd Font font_family Fira Code Nerd Font
font_size 14.0 font_size 16.0
bold_font auto bold_font auto
italic_font auto italic_font auto
bold_italic_font auto bold_italic_font auto

34
scripts/waybar-khal.py Normal file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env python
import subprocess
import datetime
import json
from html import escape
data = {}
today = datetime.date.today().strftime("%Y-%m-%d")
next_week = (datetime.date.today() +
datetime.timedelta(days=10)).strftime("%Y-%m-%d")
output = subprocess.check_output("khal list now "+next_week, shell=True)
output = output.decode("utf-8")
lines = output.split("\n")
new_lines = []
for line in lines:
clean_line = escape(line).split(" ::")[0]
if len(clean_line) and not clean_line[0] in ['0', '1', '2']:
clean_line = "\n<b>"+clean_line+"</b>"
new_lines.append(clean_line)
output = "\n".join(new_lines).strip()
if today in output:
data['text'] = "" + output.split('\n')[1]
else:
data['text'] = ""
data['tooltip'] = output
print(json.dumps(data))

View File

@ -80,7 +80,7 @@
// Modules Right // Modules Right
"modules-right": [ "modules-right": [
"tray", "tray",
"clock" "custom/events"
] ]
}] }]

View File

@ -456,5 +456,16 @@
"deactivated": "" "deactivated": ""
}, },
"on-click-right": "hyprlock" "on-click-right": "hyprlock"
},
"custom/events": {
"format": "{}",
"tooltip": true,
"interval": 300,
"format-icons": {
"default": ""
},
"exec": "python3 ~/dotfiles/scripts/waybar-khal.py",
"return-type": "json"
} }
} }

View File

@ -364,6 +364,17 @@ window#waybar.empty #window {
/* border:3px solid @bordercolor; */ /* border:3px solid @bordercolor; */
} }
#custom-events {
background-color: @backgroundlight;
font-size: 14px;
color: @textcolor1;
border-radius: 10px;
padding: 0px 8px 0px 8px;
margin: 8px 10px 8px 0px;
opacity:0.8;
/* border:3px solid @bordercolor; */
}
/* ----------------------------------------------------- /* -----------------------------------------------------
* Pulseaudio * Pulseaudio
* ----------------------------------------------------- */ * ----------------------------------------------------- */