feat: added rofi config
This commit is contained in:
54
rofi.custom/notifications/dunst-json.sh
Executable file
54
rofi.custom/notifications/dunst-json.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
# == USER DEFINED LOGOS ==
|
||||
declare -A logo_map=(
|
||||
["signal"]="/usr/share/icons/hicolor/32x32/apps/signal-desktop.png"
|
||||
["mattermost"]="/usr/share/icons/hicolor/32x32/apps/mattermost-desktop.png"
|
||||
)
|
||||
|
||||
|
||||
# == CONST ==
|
||||
icon_theme="Paper"
|
||||
|
||||
dunstctl history | jq -cr '.data[0][] | map(.data) | @tsv' | sed 's/\t/|/g' |
|
||||
while IFS="|" read -r body message summary appname category defaut_action_name icon_path id timestamp timeout progress
|
||||
do
|
||||
if [[ $summary == "" || $summary == 'null' ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Fix for Brave
|
||||
if [[ $appname == "Brave" ]]; then
|
||||
swap=$(sed 's|</\?\(a\)[^>]*>||gm' <<< "$body")
|
||||
body=$summary
|
||||
summary=$swap
|
||||
fi
|
||||
|
||||
output="${id}: <b>${summary}</b>"
|
||||
|
||||
if [[ $appname != "" && $appname != 'null' ]]; then
|
||||
output="${output} <span weight='light' size='small'><i>(${appname})</i></span>"
|
||||
|
||||
if [[ $icon_path == "" || $icon_path == 'null' ]]; then
|
||||
lc_appname=$(echo "$appname" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
if [[ $icon_path == "" ]] || [ ! -f $icon_path ]; then
|
||||
icon_path="${logo_map[$lc_appname]}"
|
||||
fi
|
||||
if [[ $icon_path == "" ]] || [ ! -f $icon_path ]; then
|
||||
icon_path="/usr/share/icons/${icon_theme}/32x32/apps/${lc_appname}.png"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $body != "" && $body != 'null' ]]; then
|
||||
output="${output}\n${body}"
|
||||
fi
|
||||
|
||||
if [[ $icon_path != "" && $icon_path != 'null' ]]; then
|
||||
output="${output}\0icon\x1f${icon_path}"
|
||||
fi
|
||||
|
||||
echo -en "${output}|"
|
||||
done
|
||||
exit 0
|
||||
40
rofi.custom/notifications/notification.sh
Executable file
40
rofi.custom/notifications/notification.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya (adi1090x)
|
||||
## Github : @adi1090x
|
||||
#
|
||||
## Rofi : Launcher (Modi Drun, Run, File Browser, Window)
|
||||
#
|
||||
## Available Styles
|
||||
#
|
||||
## style-1 style-2 style-3 style-4 style-5
|
||||
## style-6 style-7 style-8 style-9 style-10
|
||||
|
||||
dir="$HOME/.config/rofi.custom/notifications"
|
||||
theme='style-4'
|
||||
|
||||
dunstctl close-all
|
||||
|
||||
## Run
|
||||
while
|
||||
selected=$(~/.config/rofi.custom/notifications/dunst-json.sh | rofi \
|
||||
-dmenu \
|
||||
-sep '|' \
|
||||
-p '' \
|
||||
-kb-delete-entry "" \
|
||||
-kb-remove-char-forward "" \
|
||||
-kb-custom-1 "Delete" \
|
||||
-kb-custom-2 "Shift+Delete" \
|
||||
-theme ${dir}/${theme}.rasi)
|
||||
|
||||
status=$?
|
||||
# echo "Status: $status"
|
||||
# echo "Selected: $selected"
|
||||
if [[ "$status" == 10 && "$selected" != "" ]]; then
|
||||
dunstctl history-rm $(echo $selected | sed -r 's/^([0-9]+): .*/\1/')
|
||||
elif [[ "$status" == 11 ]]; then
|
||||
dunstctl history-clear
|
||||
fi
|
||||
[[ "$status" == 10 ]]
|
||||
do :; done
|
||||
|
||||
18
rofi.custom/notifications/shared/colors.rasi
Normal file
18
rofi.custom/notifications/shared/colors.rasi
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
*
|
||||
* Author : Aditya Shakya (adi1090x)
|
||||
* Github : @adi1090x
|
||||
*
|
||||
* Colors
|
||||
*
|
||||
* Available Colors Schemes
|
||||
*
|
||||
* adapta catppuccin everforest navy paper
|
||||
* arc cyberpunk gruvbox nord solarized
|
||||
* black dracula lovelace onedark yousai
|
||||
*
|
||||
**/
|
||||
|
||||
/* Import color-scheme from `colors` directory */
|
||||
|
||||
@import "~/.config/rofi/colors/onedark.rasi"
|
||||
12
rofi.custom/notifications/shared/fonts.rasi
Normal file
12
rofi.custom/notifications/shared/fonts.rasi
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
*
|
||||
* Author : Aditya Shakya (adi1090x)
|
||||
* Github : @adi1090x
|
||||
*
|
||||
* Fonts
|
||||
*
|
||||
**/
|
||||
|
||||
* {
|
||||
font: "Iosevka Nerd Font 10";
|
||||
}
|
||||
277
rofi.custom/notifications/style-4.rasi
Normal file
277
rofi.custom/notifications/style-4.rasi
Normal file
@@ -0,0 +1,277 @@
|
||||
/**
|
||||
*
|
||||
* Author : Aditya Shakya (adi1090x)
|
||||
* Github : @adi1090x
|
||||
*
|
||||
* Rofi Theme File
|
||||
* Rofi Version: 1.7.3
|
||||
**/
|
||||
|
||||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
modi: "notifications";
|
||||
show-icons: true;
|
||||
display-notifications: "";
|
||||
display-run: "";
|
||||
display-filebrowser: "";
|
||||
display-window: "";
|
||||
drun-display-format: "{name} [<span weight='light' size='small'><i>({generic})</i></span>]";
|
||||
window-format: "{w} · {c} · {t}";
|
||||
|
||||
close-on-delete: false;
|
||||
}
|
||||
|
||||
/*****----- Global Properties -----*****/
|
||||
@import "shared/colors.rasi"
|
||||
@import "shared/fonts.rasi"
|
||||
|
||||
* {
|
||||
border-colour: var(selected);
|
||||
handle-colour: var(selected);
|
||||
background-colour: var(background);
|
||||
foreground-colour: var(foreground);
|
||||
alternate-background: var(background-alt);
|
||||
normal-background: var(background);
|
||||
normal-foreground: var(foreground);
|
||||
urgent-background: var(urgent);
|
||||
urgent-foreground: var(background);
|
||||
active-background: var(active);
|
||||
active-foreground: var(background);
|
||||
selected-normal-background: var(selected);
|
||||
selected-normal-foreground: var(background);
|
||||
selected-urgent-background: var(active);
|
||||
selected-urgent-foreground: var(background);
|
||||
selected-active-background: var(urgent);
|
||||
selected-active-foreground: var(background);
|
||||
alternate-normal-background: var(background);
|
||||
alternate-normal-foreground: var(foreground);
|
||||
alternate-urgent-background: var(urgent);
|
||||
alternate-urgent-foreground: var(background);
|
||||
alternate-active-background: var(active);
|
||||
alternate-active-foreground: var(background);
|
||||
}
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
/* properties for window widget */
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 800px;
|
||||
x-offset: 0px;
|
||||
y-offset: 0px;
|
||||
|
||||
/* properties for all widgets */
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
cursor: "default";
|
||||
background-color: @background-colour;
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 30px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
children: [ "inputbar", "listview" ];
|
||||
}
|
||||
|
||||
/*****----- Inputbar -----*****/
|
||||
inputbar {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 0px 0px 10px 10px;
|
||||
border: 0px;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: @background-colour;
|
||||
text-color: @foreground-colour;
|
||||
children: [ "prompt", "entry" ];
|
||||
}
|
||||
|
||||
prompt {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
str: "::";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
entry {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
cursor: text;
|
||||
placeholder: "";
|
||||
placeholder-color: inherit;
|
||||
}
|
||||
|
||||
/*****----- Listview -----*****/
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 1;
|
||||
lines: 10;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
scrollbar: false;
|
||||
layout: vertical;
|
||||
reverse: false;
|
||||
fixed-height: true;
|
||||
fixed-columns: true;
|
||||
|
||||
spacing: 0px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
cursor: "default";
|
||||
}
|
||||
scrollbar {
|
||||
handle-width: 5px ;
|
||||
handle-color: @handle-colour;
|
||||
border-radius: 0px;
|
||||
background-color: @alternate-background;
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 27.5px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
cursor: pointer;
|
||||
}
|
||||
element normal.normal {
|
||||
background-color: var(normal-background);
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element normal.urgent {
|
||||
background-color: var(urgent-background);
|
||||
text-color: var(urgent-foreground);
|
||||
}
|
||||
element normal.active {
|
||||
background-color: var(active-background);
|
||||
text-color: var(active-foreground);
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(alternate-background);
|
||||
text-color: var(foreground-colour);
|
||||
}
|
||||
element selected.urgent {
|
||||
background-color: var(selected-urgent-background);
|
||||
text-color: var(selected-urgent-foreground);
|
||||
}
|
||||
element selected.active {
|
||||
background-color: var(selected-active-background);
|
||||
text-color: var(selected-active-foreground);
|
||||
}
|
||||
element alternate.normal {
|
||||
background-color: var(alternate-normal-background);
|
||||
text-color: var(alternate-normal-foreground);
|
||||
}
|
||||
element alternate.urgent {
|
||||
background-color: var(alternate-urgent-background);
|
||||
text-color: var(alternate-urgent-foreground);
|
||||
}
|
||||
element alternate.active {
|
||||
background-color: var(alternate-active-background);
|
||||
text-color: var(alternate-active-foreground);
|
||||
}
|
||||
element-icon {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
size: 32px;
|
||||
cursor: inherit;
|
||||
}
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
highlight: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
markup: true;
|
||||
}
|
||||
|
||||
/*****----- Mode Switcher -----*****/
|
||||
mode-switcher{
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
button {
|
||||
padding: 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: @alternate-background;
|
||||
text-color: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
button selected {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(selected-normal-foreground);
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
textbox {
|
||||
padding: 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: @alternate-background;
|
||||
text-color: @foreground-colour;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
highlight: none;
|
||||
placeholder-color: @foreground-colour;
|
||||
blink: true;
|
||||
markup: true;
|
||||
}
|
||||
error-message {
|
||||
padding: 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: @background-colour;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
Reference in New Issue
Block a user