init
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
* {
|
||||
on: #98B3C8;
|
||||
off: #CC9498;
|
||||
}
|
||||
|
||||
/*****----- Global Properties -----*****/
|
||||
@import "../colors.rasi"
|
||||
@import "../fonts.rasi"
|
||||
|
||||
configuration {
|
||||
show-icons: false;
|
||||
icon-theme: "Papirus";
|
||||
display-drun: ":";
|
||||
drun-display-format: "{name}";
|
||||
threads: 0;
|
||||
scroll-method: 0;
|
||||
disable-history: false;
|
||||
fullscreen: false;
|
||||
hide-scrollbar: true;
|
||||
sidebar-mode: false;
|
||||
}
|
||||
|
||||
window {
|
||||
transparency: "real";
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
border: 0px;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
width: 384px;
|
||||
location: center;
|
||||
anchor: center;
|
||||
x-offset: 0;
|
||||
y-offset: 0;
|
||||
}
|
||||
|
||||
prompt {
|
||||
enabled: true;
|
||||
padding: 4px 4px 6px 6px;
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
}
|
||||
|
||||
textbox-prompt-colon {
|
||||
expand: false;
|
||||
str: "";
|
||||
background-color: @background;
|
||||
text-color: @urgent;
|
||||
padding: 5px 0px 0px 4px;
|
||||
}
|
||||
|
||||
inputbar {
|
||||
children: [ textbox-prompt-colon, prompt ];
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
expand: false;
|
||||
border: 0px 0px 1px 0px;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
margin: 0px 0px 0px 0px;
|
||||
padding: 0px 0px 0px 0px;
|
||||
position: center;
|
||||
}
|
||||
|
||||
|
||||
entry {
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
placeholder-color: @foreground;
|
||||
expand: true;
|
||||
horizontal-align: 0;
|
||||
placeholder: "Search";
|
||||
blink: true;
|
||||
padding: 4px 0px 0px 0px;
|
||||
}
|
||||
|
||||
case-indicator {
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
spacing: 0;
|
||||
}
|
||||
|
||||
|
||||
listview {
|
||||
background-color: @background;
|
||||
columns: 9;
|
||||
lines: 7;
|
||||
spacing: 5px;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
layout: vertical;
|
||||
}
|
||||
|
||||
mainbox {
|
||||
background-color: @background;
|
||||
children: [ inputbar, listview ];
|
||||
spacing: 5px;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
element {
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
orientation: horizontal;
|
||||
border: 0px;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
element-icon {
|
||||
size: 24px;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
element-text {
|
||||
|
||||
expand: true;
|
||||
horizontal-align: 0;
|
||||
vertical-align: 0;
|
||||
margin: 2px 0px 2px 2px;
|
||||
}
|
||||
|
||||
element selected {
|
||||
background-color: @selected;
|
||||
text-color: @background;
|
||||
border: 0px;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
}
|
||||
|
||||
element.active,
|
||||
element.selected.urgent {
|
||||
background-color: @background-alt;
|
||||
text-color: @background;
|
||||
border-color: @background-alt;
|
||||
}
|
||||
|
||||
element.selected.urgent {
|
||||
border-color: @urgent;
|
||||
}
|
||||
|
||||
element.urgent,
|
||||
element.selected.active {
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
border-color: @background;
|
||||
}
|
||||
|
||||
element.selected.active {
|
||||
border-color: @selected;
|
||||
}
|
||||
|
||||
element-text, element-icon {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
Executable
+95
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
DIR=$(dirname $PWD)
|
||||
|
||||
current_day=$(date +"%e")
|
||||
current_month=$(date +"%m")
|
||||
current_year=$(date +"%Y")
|
||||
|
||||
month=$(date +"%-m")
|
||||
year=$(date +"%Y")
|
||||
previous_month="◀"
|
||||
next_month="▶"
|
||||
last_selected_option=""
|
||||
|
||||
format_calendar () {
|
||||
echo "$1" \
|
||||
| sed -E 's/([[:alpha:]])__/\1\n/g' \
|
||||
| sed -E 's/___([[:digit:]])/.\n\1/g' \
|
||||
| sed -e 's/___/\n./g' \
|
||||
| sed -e 's/__/\n/g' \
|
||||
| sed -e 's/_/\n/g'
|
||||
}
|
||||
|
||||
print_month() {
|
||||
calendar="$(cal -v -- $1 $2 | tail -n +2 | sed -e 's/ /_/g')"
|
||||
echo "$(format_calendar "$calendar")"
|
||||
}
|
||||
|
||||
find_day_index() {
|
||||
index=0
|
||||
while IFS=' ' read -ra arr; do
|
||||
for i in "${arr[@]}"; do
|
||||
if [[ "$i" == "$2" ]]; then
|
||||
echo "$index"
|
||||
break
|
||||
fi
|
||||
((index++))
|
||||
done
|
||||
done <<< "$1"
|
||||
}
|
||||
|
||||
calendar_menu() {
|
||||
calendar_header=$(cal -v -- $month $year | head -n 1)
|
||||
|
||||
month_page="$(print_month $month $year)"
|
||||
calendar_body="\n\n\n$previous_month\n\n\n\n$month_page\n\n\n\n$next_month\n\n\n"
|
||||
|
||||
previous_month_index="3"
|
||||
next_month_index="59"
|
||||
calendar_body_column="7"
|
||||
urgent="-u $previous_month_index,$next_month_index"
|
||||
active=""
|
||||
selected_row=""
|
||||
|
||||
if [[ "$(echo $current_month | bc) $current_year" == "$(echo $month | bc) $year" ]]; then
|
||||
current_day_index=$(($(find_day_index "$month_page" $current_day) + $calendar_body_column))
|
||||
active="-a $current_day_index"
|
||||
selected_row="-selected-row $current_day_index"
|
||||
fi
|
||||
|
||||
if [[ $last_selected_option == $previous_month ]]; then
|
||||
selected_row="-selected-row $previous_month_index"
|
||||
fi
|
||||
|
||||
if [[ $last_selected_option == $next_month ]]; then
|
||||
selected_row="-selected-row $next_month_index"
|
||||
fi
|
||||
|
||||
echo -e "$calendar_body" | rofi -dmenu \
|
||||
-theme $HOME/.config/rofi/calendar/rofi-calendar.rasi \
|
||||
-p "$calendar_header" $urgent $active $selected_row
|
||||
}
|
||||
|
||||
while [[ true ]]; do
|
||||
selected=$(calendar_menu)
|
||||
last_selected_option="$selected"
|
||||
case $selected in
|
||||
$previous_month)
|
||||
((month--))
|
||||
if [[ $month -lt 1 ]]; then
|
||||
month=12
|
||||
((year--))
|
||||
fi
|
||||
;;
|
||||
$next_month)
|
||||
((month++))
|
||||
if [[ $month -gt 12 ]]; then
|
||||
month=1
|
||||
((year++))
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
Reference in New Issue
Block a user