Compare commits
2 Commits
a2abffad09
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f7620ab2c7 | |||
| bd25cc4efc |
2
apply.sh
2
apply.sh
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
stow -t ~ bash zsh tmux nvim hypr waybar alacritty rider-palette walker
|
||||
stow -t ~ bash zsh tmux nvim hypr waybar mako alacritty rider-palette walker
|
||||
|
||||
@@ -4,7 +4,7 @@ set -euo pipefail
|
||||
# ====== CONFIG ======
|
||||
DOTFILES_DIR="${DOTFILES_DIR:-$HOME/repos/dotfiles}"
|
||||
DOTFILES_GIT_URL="${DOTFILES_GIT_URL:-}" # ex: git@github.com:TON_USER/dotfiles.git
|
||||
STOW_PACKAGES_DEFAULT=("zsh" "tmux" "nvim" "hypr" "hypridle" "waybar" "alacritty")
|
||||
STOW_PACKAGES_DEFAULT=("zsh" "tmux" "nvim" "hypr" "waybar" "mako" "alacritty")
|
||||
|
||||
INSTALL_FONTS="${INSTALL_FONTS:-1}" # 1 = install nerd font, 0 = skip
|
||||
SET_DEFAULT_SHELL="${SET_DEFAULT_SHELL:-1}" # 1 = chsh to zsh, 0 = skip
|
||||
@@ -61,7 +61,7 @@ sudo_run apt install -y build-essential || true
|
||||
# Hypr ecosystem (availability depends on distro/repo)
|
||||
# We try, but do not fail if packages aren't found.
|
||||
log "Trying to install Hyprland ecosystem packages (best effort)"
|
||||
sudo_run apt install -y hyprland hypridle waybar alacritty 2>/dev/null || true
|
||||
sudo_run apt install -y hyprland hyprpaper hypridle waybar mako-notifier alacritty 2>/dev/null || true
|
||||
|
||||
# ====== DOTFILES CLONE (OPTIONAL) ======
|
||||
if [ ! -d "$DOTFILES_DIR/.git" ]; then
|
||||
|
||||
30
mako/.config/mako/config
Normal file
30
mako/.config/mako/config
Normal file
@@ -0,0 +1,30 @@
|
||||
font=JetBrainsMono Nerd Font 12
|
||||
background-color=#191A1C
|
||||
text-color=#BDBDBD
|
||||
border-color=#39CC9B
|
||||
progress-color=over #39CC9B
|
||||
width=420
|
||||
height=160
|
||||
outer-margin=16
|
||||
margin=12
|
||||
padding=14
|
||||
border-size=1
|
||||
border-radius=7
|
||||
icons=1
|
||||
max-icon-size=48
|
||||
markup=1
|
||||
actions=1
|
||||
max-visible=5
|
||||
max-history=50
|
||||
default-timeout=8000
|
||||
ignore-timeout=0
|
||||
anchor=bottom-right
|
||||
layer=overlay
|
||||
sort=-time
|
||||
|
||||
[urgency=high]
|
||||
border-color=#FF5647
|
||||
default-timeout=0
|
||||
|
||||
[mode=do-not-disturb]
|
||||
invisible=1
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"layer": "top",
|
||||
"position": "top",
|
||||
"layer": "bottom",
|
||||
"position": "bottom",
|
||||
"mod": "dock",
|
||||
"margin-left": 0,
|
||||
"margin-right": 0,
|
||||
@@ -23,6 +23,7 @@
|
||||
"bluetooth",
|
||||
"pulseaudio",
|
||||
"battery",
|
||||
"custom/mako",
|
||||
"custom/power"
|
||||
],
|
||||
"battery": {
|
||||
@@ -47,8 +48,8 @@
|
||||
"tooltip": true
|
||||
},
|
||||
"tray": {
|
||||
"icon-size": 18,
|
||||
"spacing": 12,
|
||||
"icon-size": 22,
|
||||
"spacing": 14,
|
||||
"rotate": 0
|
||||
},
|
||||
"custom/power": {
|
||||
@@ -73,6 +74,16 @@
|
||||
"tooltip": true,
|
||||
"on-click": "$HOME/.config/waybar/scripts/print-queue-view.sh"
|
||||
},
|
||||
"custom/mako": {
|
||||
"exec": "$HOME/.config/waybar/scripts/mako-notifications.sh status",
|
||||
"return-type": "json",
|
||||
"interval": 5,
|
||||
"signal": 8,
|
||||
"format": "{}",
|
||||
"tooltip": true,
|
||||
"on-click": "$HOME/.config/waybar/scripts/mako-notifications.sh toggle",
|
||||
"on-click-right": "$HOME/.config/waybar/scripts/mako-notifications.sh list"
|
||||
},
|
||||
"hyprland/workspaces": {
|
||||
"all-outputs": false,
|
||||
"sort-by-number": true
|
||||
|
||||
135
waybar/.config/waybar/scripts/mako-notifications.sh
Executable file
135
waybar/.config/waybar/scripts/mako-notifications.sh
Executable file
@@ -0,0 +1,135 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -eu
|
||||
|
||||
dnd_mode="do-not-disturb"
|
||||
|
||||
json_string() {
|
||||
if command -v jq >/dev/null 2>&1; then
|
||||
printf '%s' "$1" | jq -Rs .
|
||||
return
|
||||
fi
|
||||
|
||||
printf '%s' "$1" | awk '
|
||||
BEGIN { ORS = "" }
|
||||
{
|
||||
gsub(/\\/, "\\\\")
|
||||
gsub(/"/, "\\\"")
|
||||
gsub(/\t/, "\\t")
|
||||
if (NR > 1) {
|
||||
printf "\\n"
|
||||
}
|
||||
printf "%s", $0
|
||||
}
|
||||
END { printf "\n" }
|
||||
'
|
||||
}
|
||||
|
||||
refresh_waybar() {
|
||||
pkill -RTMIN+8 waybar >/dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
notification_count() {
|
||||
if ! command -v jq >/dev/null 2>&1; then
|
||||
printf '0'
|
||||
return
|
||||
fi
|
||||
|
||||
makoctl list -j 2>/dev/null \
|
||||
| jq '[.. | objects | select(has("id"))] | length' 2>/dev/null \
|
||||
|| printf '0'
|
||||
}
|
||||
|
||||
is_dnd() {
|
||||
makoctl mode 2>/dev/null | grep -qx "$dnd_mode"
|
||||
}
|
||||
|
||||
status() {
|
||||
if ! modes="$(makoctl mode 2>/dev/null)"; then
|
||||
text="$(json_string " n/a")"
|
||||
class="$(json_string "disabled")"
|
||||
tooltip="$(json_string "Mako is unavailable")"
|
||||
printf '{"text":%s,"class":%s,"tooltip":%s}\n' "$text" "$class" "$tooltip"
|
||||
return
|
||||
fi
|
||||
|
||||
count="$(notification_count)"
|
||||
count="${count:-0}"
|
||||
|
||||
if printf '%s\n' "$modes" | grep -qx "$dnd_mode"; then
|
||||
state="dnd"
|
||||
icon=""
|
||||
label="Do Not Disturb is on"
|
||||
elif [ "$count" -gt 0 ] 2>/dev/null; then
|
||||
state="active"
|
||||
icon=""
|
||||
label="Do Not Disturb is off"
|
||||
else
|
||||
state="normal"
|
||||
icon=""
|
||||
label="Do Not Disturb is off"
|
||||
fi
|
||||
|
||||
text="$(json_string "$icon $count")"
|
||||
class="$(json_string "$state")"
|
||||
tooltip="$(json_string "$label
|
||||
$count pending notifications
|
||||
Left click toggles DND
|
||||
Right click opens the notification list")"
|
||||
|
||||
printf '{"text":%s,"class":%s,"tooltip":%s}\n' "$text" "$class" "$tooltip"
|
||||
}
|
||||
|
||||
toggle() {
|
||||
makoctl mode -t "$dnd_mode" >/dev/null 2>&1 || true
|
||||
refresh_waybar
|
||||
}
|
||||
|
||||
list_notifications() {
|
||||
title="Notifications"
|
||||
|
||||
if command -v jq >/dev/null 2>&1; then
|
||||
list="$(
|
||||
makoctl list -j 2>/dev/null \
|
||||
| jq -r '
|
||||
[.. | objects | select(has("id"))]
|
||||
| if length == 0 then
|
||||
"No pending notifications"
|
||||
else
|
||||
.[]
|
||||
| [
|
||||
(."app-name" // .app_name // "app"),
|
||||
(.summary // ""),
|
||||
(.body // "")
|
||||
]
|
||||
| map(select(. != ""))
|
||||
| join(" - ")
|
||||
end
|
||||
' 2>/dev/null
|
||||
)"
|
||||
else
|
||||
list="$(makoctl list 2>/dev/null || printf 'No pending notifications')"
|
||||
fi
|
||||
|
||||
if [ -z "$list" ]; then
|
||||
list="No pending notifications"
|
||||
fi
|
||||
|
||||
if command -v wofi >/dev/null 2>&1; then
|
||||
printf '%s\n' "$list" | wofi --dmenu --prompt "$title" >/dev/null 2>&1 || true
|
||||
elif command -v alacritty >/dev/null 2>&1; then
|
||||
tmp="${TMPDIR:-/tmp}/mako-notifications.$$"
|
||||
printf '%s\n' "$list" > "$tmp"
|
||||
alacritty -e sh -c 'printf "%s\n\n" "$1"; cat "$2"; printf "\nPress Enter to close."; read -r _' sh "$title" "$tmp"
|
||||
rm -f "$tmp"
|
||||
else
|
||||
printf '%s\n' "$list"
|
||||
fi
|
||||
}
|
||||
|
||||
case "${1:-status}" in
|
||||
status) status ;;
|
||||
toggle) toggle ;;
|
||||
list) list_notifications ;;
|
||||
*) status ;;
|
||||
esac
|
||||
@@ -15,24 +15,25 @@
|
||||
* {
|
||||
color: @foreground;
|
||||
font-family: 'JetBrainsMono Nerd Font';
|
||||
font-size: 14px;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background: @background;
|
||||
border-top: 1px solid alpha(@foreground, 0.28);
|
||||
border-radius: 0px;
|
||||
box-shadow: none;
|
||||
color: @foreground;
|
||||
}
|
||||
|
||||
window#waybar>box {
|
||||
padding: 3px 2px;
|
||||
padding: 4px 2px;
|
||||
}
|
||||
|
||||
tooltip {
|
||||
background: @background;
|
||||
border: 1px solid @accent-alt;
|
||||
border-radius: 12px;
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
.modules-left,
|
||||
@@ -50,6 +51,7 @@ tooltip {
|
||||
#bluetooth,
|
||||
#pulseaudio,
|
||||
#battery,
|
||||
#custom-mako,
|
||||
#tray,
|
||||
#custom-power {
|
||||
background: transparent;
|
||||
@@ -58,7 +60,7 @@ tooltip {
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
margin: 0;
|
||||
padding: 0 10px;
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
#custom-launcher,
|
||||
@@ -75,31 +77,31 @@ tooltip {
|
||||
}
|
||||
|
||||
#custom-print-queue {
|
||||
padding: 0 10px;
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
#network {
|
||||
padding: 0 6px 0 10px;
|
||||
padding: 0 7px 0 12px;
|
||||
}
|
||||
|
||||
#bluetooth {
|
||||
padding: 0 6px;
|
||||
padding: 0 7px;
|
||||
}
|
||||
|
||||
#pulseaudio {
|
||||
padding: 0 10px 0 6px;
|
||||
padding: 0 12px 0 7px;
|
||||
}
|
||||
|
||||
#workspaces {
|
||||
padding: 0 5px;
|
||||
padding: 0 6px;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
all: initial;
|
||||
min-width: 24px;
|
||||
padding: 0 4px;
|
||||
min-width: 29px;
|
||||
padding: 0 5px;
|
||||
margin: 2px 2px;
|
||||
border-radius: 6px;
|
||||
border-radius: 7px;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
@@ -139,21 +141,29 @@ tooltip {
|
||||
|
||||
#window {
|
||||
color: @foreground-muted;
|
||||
padding: 0 14px;
|
||||
padding: 0 17px;
|
||||
}
|
||||
|
||||
#clock {
|
||||
padding: 0 15px;
|
||||
padding: 0 18px;
|
||||
box-shadow: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#tray {
|
||||
padding: 0 12px;
|
||||
padding: 0 14px;
|
||||
}
|
||||
|
||||
#custom-power {
|
||||
padding: 0px 16px 0px 12px;
|
||||
padding: 0px 19px 0px 14px;
|
||||
}
|
||||
|
||||
#custom-mako {
|
||||
min-width: 42px;
|
||||
}
|
||||
|
||||
#custom-mako.active {
|
||||
color: @accent;
|
||||
}
|
||||
|
||||
#custom-launcher:hover,
|
||||
@@ -163,6 +173,7 @@ tooltip {
|
||||
#bluetooth:hover,
|
||||
#pulseaudio:hover,
|
||||
#battery:hover,
|
||||
#custom-mako:hover,
|
||||
#tray:hover,
|
||||
#custom-power:hover,
|
||||
#clock:hover {
|
||||
@@ -182,14 +193,14 @@ tooltip {
|
||||
menu#menu {
|
||||
background: @background;
|
||||
border: 1px solid alpha(@accent-alt, 0.24);
|
||||
border-radius: 14px;
|
||||
padding: 8px;
|
||||
border-radius: 17px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
menu#menu menuitem {
|
||||
border-radius: 10px;
|
||||
margin: 10px;
|
||||
padding: 8px 12px;
|
||||
border-radius: 12px;
|
||||
margin: 12px;
|
||||
padding: 10px 14px;
|
||||
}
|
||||
|
||||
menu#menu menuitem:hover {
|
||||
@@ -198,9 +209,9 @@ menu#menu menuitem:hover {
|
||||
|
||||
menu#menu menuitem.section-header {
|
||||
color: @foreground-muted;
|
||||
font-size: 14px;
|
||||
font-size: 17px;
|
||||
margin-top: 4px;
|
||||
padding: 4px 12px;
|
||||
padding: 5px 14px;
|
||||
}
|
||||
|
||||
menu#menu menuitem#lock {
|
||||
@@ -227,5 +238,5 @@ menu#menu menuitem#shutdown {
|
||||
|
||||
menu#menu separator {
|
||||
background: alpha(@accent-alt, 0.24);
|
||||
margin: 6px 10px;
|
||||
margin: 7px 12px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user