move ghostty and hyprland to dotfiles

This commit is contained in:
Johannes Knopp
2025-09-06 16:23:15 +02:00
parent 14e4d4fe3e
commit 465634d8bf
16 changed files with 3290 additions and 2 deletions

View File

@ -0,0 +1,142 @@
{
"layer": "top",
"position": "top",
/* order: 1-2-3 | window-title | tray + clock */
"modules-left": [ "custom/page1", "custom/page2", "custom/page3", "custom/page4","custom/page5","custom/page6","custom/page7","custom/page8","custom/page9","custom/page10"],
"modules-center": [ "hyprland/window" ],
"modules-right": [ "tray", "custom/separator", "network", "bluetooth", "custom/separator", "disk", "cpu", "memory", "pulseaudio", "custom/separator", "clock"],
/* three persistent page buttons */
"custom/page1": {
"exec": "~/.config/waybar/scripts/page.sh 1",
"exec-persistent": true,
"return-type": "json"
},
"custom/page2": {
"exec": "~/.config/waybar/scripts/page.sh 2",
"exec-persistent": true,
"return-type": "json"
},
"custom/page3": {
"exec": "~/.config/waybar/scripts/page.sh 3",
"exec-persistent": true,
"return-type": "json"
},
"custom/page4": {
"exec": "~/.config/waybar/scripts/page.sh 4",
"exec-persistent": true,
"return-type": "json"
},
"custom/page5": {
"exec": "~/.config/waybar/scripts/page.sh 5",
"exec-persistent": true,
"return-type": "json"
},
"custom/page6": {
"exec": "~/.config/waybar/scripts/page.sh 6",
"exec-persistent": true,
"return-type": "json"
},
"custom/page7": {
"exec": "~/.config/waybar/scripts/page.sh 7",
"exec-persistent": true,
"return-type": "json"
},
"custom/page8": {
"exec": "~/.config/waybar/scripts/page.sh 8",
"exec-persistent": true,
"return-type": "json"
},
"custom/page9": {
"exec": "~/.config/waybar/scripts/page.sh 9",
"exec-persistent": true,
"return-type": "json"
},
"custom/page10": {
"exec": "~/.config/waybar/scripts/page.sh 10",
"exec-persistent": true,
"return-type": "json"
},
"hyprland/window": { "format": "{title}", "max-length": 60 },
// "tray": { "icon-size": 16, "spacing": 6 },
"tray": { "icon-size": 16, "spacing": 10 },
"pulseaudio": {
// ——— behaviour ———
"scroll-step": 5, // ± 5 % per wheel-step
"max-volume": 150, // allow 0 150 %
"on-click": "pactl set-sink-mute @DEFAULT_SINK@ toggle",
"on-click-right": "pavucontrol",
// ——— appearance ———
"markup": "pango", // enable coloured markup
"format": "<span color='#e5c07b'>{icon} </span> <span color='#ffffff'>{volume}%</span>",
"format-muted": "<span color='#e5c07b'> </span> muted",
// choose the glyphs you like (Nerd Font / Font Awesome)
"format-icons": {
"default": "", // speaker
"muted": "", // muted speaker
"headphones": ""
}
},
"custom/separator": {
// emit a JSON object with field "text"
"exec": "echo '{\"text\":\"|\"}'",
// treat stdout as JSON
"return-type": "json",
// wrap the text in a colored Pango span
"format": "<span color='#555'>{text}</span>",
"markup": "pango",
// refresh only hourly
"interval": 3600
},
"cpu": {
"interval": 1, // update every second
"markup": "pango",
"format": "<span color='#E06C75'> </span> {usage}%"
},
"memory": {
"interval": 2, // fast enough, still light
"markup": "pango",
"format": "<span color='#98C379'> </span> {percentage}%"
},
"disk": {
"interval": 30, // disks change slowly
"path": "/",
"markup": "pango",
"format": "<span color='#C678DD'>󰋊 </span> {percentage_used}%"
},
/* CLOCK (add date) */
"clock": {
"interval": 1,
"format": "{:%Y-%m-%d %H:%M:%S}",
"format-alt": "{:%Y-%m-%d %H:%M}"
},
/* NETWORK */
"network": {
"interface": ["enp.*", "eth.*"], // wired NICs (regex—adjust if needed)
"interval": 3,
"markup": "pango",
"format-ethernet": "<span color='#61AFEF'>󰈀 </span> up",
"format-wifi": "<span color='#61AFEF'> </span> {essid}",
// "format-linked": "<span color='#61AFEF'></span> link",
"format-unknown": "<span color='#61AFEF'>󰈂 </span> up",
"format-disconnected":"<span color='#E06C75'> </span> down",
"on-click": "nm-connection-editor"
},
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,76 @@
#!/usr/bin/env bash
# page.sh 110 Waybar “page” indicator
# deps: socat, awk • (still no jq)
page=$1 # this script instances page (110)
# ── icon lookup table ────────────────────────────────────────────
icons=( "" "" "" "" "" "" "" "" "" "" "󰝚" )
# map numeric workspace → page (110)
to_page() {
(( $1 <= 3 )) && echo 1 && return
(( $1 <= 6 )) && echo 2 && return
(( $1 <= 9 )) && echo 3 && return
(( $1 <= 12 )) && echo 4 && return
(( $1 <= 15 )) && echo 5 && return
(( $1 <= 18 )) && echo 6 && return
(( $1 <= 21 )) && echo 7 && return
(( $1 <= 24 )) && echo 8 && return
(( $1 <= 27 )) && echo 9 && return
echo 10
}
# does THIS page contain at least one window?
is_occupied() {
while read -r ws_id; do
(( $(to_page "$ws_id") == page )) && return 0
done < <(hyprctl clients | awk '/workspace:/ {print $2}')
return 1
}
emit() {
local classes=()
if (( $1 == page )); then # ← is THIS instance the active page?
classes+=(active) # yes → mark it only “active”
else
is_occupied && classes+=(occupied) # no → maybe “occupied”
fi
if ((${#classes[@]})); then
printf '{"text":"%s","class":"%s"}\n' \
"${icons[page]}" "$(IFS=' '; echo "${classes[*]}")"
else
printf '{"text":"%s"}\n' "${icons[page]}"
fi
}
# ── initial state ────────────────────────────────────────────────
active_ws=$(hyprctl activeworkspace | awk '/^ID /{print $2}')
current_page=$(to_page "${active_ws:-1}")
emit "$current_page"
current_occ=$(is_occupied && echo 1 || echo 0)
# ── live updates via Hyprland socket2 ───────────────────────────
socket="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"
socat -U - UNIX-CONNECT:"$socket" | while read -r line; do
[[ $line =~ ^(workspace|openwindow|closewindow) ]] || continue
# recompute state if anything relevant changed
if [[ $line == workspace* ]]; then
ws=${line#*>>}; ws=${ws%% *}
new_page=$(to_page "$ws")
else
new_page=$current_page
fi
new_occ=$(is_occupied && echo 1 || echo 0)
# update Waybar only when something actually changed
if (( new_page != current_page || new_occ != current_occ )); then
emit "$new_page"
current_page=$new_page
current_occ=$new_occ
fi
done

View File

@ -0,0 +1,91 @@
/* --- GENERAL BAR STYLE (unchanged) --- */
* {
border: none;
/* padding: 0 6px; */
padding: 0 6px;
margin-top: 2px;
font-family: "JetBrains Mono", monospace;
font-size: 14px;
}
window#waybar { background: transparent; color: #ffffff; }
/* --- PAGE BUTTONS --- */
/* IDs are #custom-page1, #custom-page2, #custom-page3 */
#custom-page1, #custom-page2, #custom-page3, #custom-page4, #custom-page5, #custom-page6, #custom-page7, #custom-page8, #custom-page9, #custom-page10 {
background: transparent;
min-width: 18px; /* keeps them evenly spaced */
padding-left: 2px;
color: #fff;
/* text-align: center; */
}
#custom-page1.active,
#custom-page2.active,
#custom-page3.active,
#custom-page4.active,
#custom-page5.active,
#custom-page6.active,
#custom-page7.active,
#custom-page8.active,
#custom-page9.active,
#custom-page10.active
{
background: rgba(255,255,255,0.15);
border-radius: 8px;
color: #fff;
}
#custom-page1.occupied:not(.active),
#custom-page2.occupied:not(.active),
#custom-page3.occupied:not(.active),
#custom-page4.occupied:not(.active),
#custom-page5.occupied:not(.active),
#custom-page6.occupied:not(.active),
#custom-page7.occupied:not(.active),
#custom-page8.occupied:not(.active),
#custom-page9.occupied:not(.active),
#custom-page10.occupied:not(.active) {
color: #42A5F5; /* blue pick any shade you like */
}
#custom-page1.active.occupied,
#custom-page2.active.occupied,
#custom-page3.active.occupied,
#custom-page4.active.occupied,
#custom-page5.active.occupied,
#custom-page6.active.occupied,
#custom-page7.active.occupied,
#custom-page8.active.occupied,
#custom-page9.active.occupied,
#custom-page10.active.occupied {
background: rgba(255,255,255,0.15); /* same as .active */
/* optional: keep the icon white, or turn it blue: */
/* color: #42A5F5; */
}
/* --- OTHER MODULES (carry-over from your previous setup) --- */
#window, #tray, #clock { background: transparent;}
#tray {
margin-right: -5;
}
#tray * {
padding-left: 0px;
padding-right: 0px;
}
/* ─── kill the gap your * rule adds ─────────────────────────────── */
#tray menu { /* the whole right-click window */
padding: 5px 0; /* 0 instead of the 6 px from * */
margin: 0; /* 0 instead of the 2 px top margin */
border: 1px solid #555;
}
/* ─── (optional) give the rows some room & hover style ─────────── */
#tray menu menuitem {
padding: 4px 12px; /* tweak to taste */
}
#tray menu menuitem:hover {
background: rgba(66,165,245,.25);
}