Skip to content

Commit 172d9d0

Browse files
author
gh0stzk
committed
Minimizing like... windows in bspwm
1 parent 566c35a commit 172d9d0

File tree

4 files changed

+191
-4
lines changed

4 files changed

+191
-4
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## feat - Minimizing like... windows in bspwm
2+
##### 12 Nov 2025
3+
4+
**New**
5+
I added a feature to make it appear as if the windows are "minimized," but they actually hide.
6+
7+
Then a menu appears with images of your "minimized" windows, allowing you to select one and restore it.
8+
9+
It's basically another method for hiding and showing windows, but with a nice menu.
10+
11+
I got the idea from https://github.com/ArnaudLelievre48/Minimizing-BSPWM, all credit to him.
12+
13+
https://github.com/user-attachments/assets/9e368822-f98d-4102-9c09-835751887c86
14+
115
## Feat - Dynamic rofi image header. - Modularized Theme.sh
216
##### 10 Nov 2025
317

config/bspwm/bin/HideNode

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/sh
2+
# =============================================================
3+
# Author: gh0stzk
4+
# Repo: https://github.com/gh0stzk/dotfiles
5+
# Date: 12.11.2025
6+
#
7+
# Original Idea: https://github.com/ArnaudLelievre48/Minimizing-BSPWM
8+
#
9+
# Script Name: HideNode
10+
# Description: Hides windows and displays a menu to restore them.
11+
#
12+
# Copyright (C) 2021-2025 gh0stzk <[email protected]>
13+
# Licensed under GPL-3.0 license
14+
# =============================================================
15+
16+
THUMB_DIR="/tmp/Minimize_thumbs"
17+
META_DIR="/tmp/Minimize_meta"
18+
THEME="$HOME/.config/bspwm/config/rofi-themes/Hide.rasi"
19+
mkdir -p "$THUMB_DIR"
20+
mkdir -p "$META_DIR"
21+
22+
hide() {
23+
wid=${1:-$(bspc query -N -n focused)}
24+
[ -z "$wid" ] && exit 1
25+
26+
desktop=$(bspc query -D -n "$wid" --names)
27+
echo "$desktop" > "$META_DIR/$wid.desktop"
28+
29+
maim -i "$wid" "$THUMB_DIR/$wid.webp"
30+
sleep 0.05
31+
bspc node "$wid" -g hidden=on
32+
}
33+
34+
restore() {
35+
wid=${1:-$(bspc query -N -n any.leaf.window -d hidden | head -n 1)}
36+
[ -z "$wid" ] && exit 1
37+
38+
rm -f "$THUMB_DIR/$wid.webp"
39+
bspc node "$wid" -g hidden=off
40+
bspc node "$wid" -t 'tiled ~'
41+
42+
desktop_file="$META_DIR/$wid.desktop"
43+
if [ -f "$desktop_file" ]; then
44+
original_desktop=$(cat "$desktop_file")
45+
bspc node "$wid" -d "$original_desktop"
46+
bspc desktop "$original_desktop" -f
47+
bspc node "$wid" -f
48+
rm -f "$desktop_file"
49+
else
50+
bspc node "$wid" -d focused
51+
fi
52+
}
53+
54+
menu() {
55+
entries=""
56+
wids=""
57+
k=0
58+
59+
for A in "$THUMB_DIR"/*; do
60+
[ -f "$A" ] || continue
61+
wid=$(basename "$A" .webp)
62+
window_name=$(xprop -id "$wid" WM_NAME 2>/dev/null | cut -d '"' -f2)
63+
[ -z "$window_name" ] && window_name="$wid"
64+
65+
entries="${entries}${k} ~ ${window_name}\000icon\037${A}\n"
66+
wids="${wids}${wid}|"
67+
k=$((k + 1))
68+
done
69+
70+
window=$(printf "%b" "$entries" | rofi -dmenu -show-icons -theme "$THEME")
71+
[ -z "$window" ] && exit 0
72+
73+
index=$(printf "%s" "$window" | cut -d ' ' -f1)
74+
index=$((index + 1))
75+
76+
wid=$(printf "%s" "$wids" | cut -d '|' -f"$index")
77+
[ -n "$wid" ] && restore "$wid"
78+
}
79+
80+
81+
case "$1" in
82+
--hide) hide "$2" ;;
83+
--menu) menu ;;
84+
*) echo "Uso: $0 --minimize [WID] | --menu"; exit 1 ;;
85+
esac
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// # z0mbi3 - https://github.com/gh0stzk/dotfiles
2+
3+
configuration {
4+
show-icons: true;
5+
}
6+
7+
@import "shared.rasi"
8+
9+
window {
10+
enabled: true;
11+
location: center;
12+
x-offset: 0;
13+
y-offset: 0;
14+
fullscreen: false;
15+
transparency: "real";
16+
cursor: "default";
17+
spacing: 0px;
18+
padding: 0px;
19+
border: 3px;
20+
border-radius: 15px;
21+
border-color: @bg-alt;
22+
background-color: transparent;
23+
}
24+
25+
mainbox {
26+
enabled: true;
27+
children: [ "listview" ];
28+
background-color: @background-alt;
29+
}
30+
31+
listview {
32+
enabled: true;
33+
columns: 6;
34+
lines: 1;
35+
spacing: 5px;
36+
padding: 10px;
37+
cycle: true;
38+
dynamic: false;
39+
scrollbar: false;
40+
layout: vertical;
41+
reverse: false;
42+
fixed-height: true;
43+
fixed-columns: true;
44+
cursor: "default";
45+
background-color: transparent;
46+
text-color: @foreground;
47+
}
48+
49+
element {
50+
enabled: true;
51+
spacing: 0px;
52+
padding: 8px;
53+
orientation: vertical;
54+
border-radius: 15px;
55+
cursor: pointer;
56+
background-color: transparent;
57+
text-color: @foreground;
58+
}
59+
60+
element selected.normal {
61+
background-color: @selected;
62+
text-color: @background;
63+
}
64+
65+
element-icon {
66+
size: 18%;
67+
cursor: inherit;
68+
background-color: transparent;
69+
text-color: inherit;
70+
border: 2px;
71+
border-color: @selected;
72+
border-radius: 10px;
73+
}
74+
75+
element-text {
76+
enabled: true;
77+
vertical-align: 0.5;
78+
horizontal-align: 0.5;
79+
font: "JetBrainsMono NF 9";
80+
padding: 0px;
81+
cursor: inherit;
82+
background-color: transparent;
83+
text-color: inherit;
84+
}

config/bspwm/config/sxhkdrc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,16 @@ alt + {t,shift + t,a,f}
153153
bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
154154

155155
# Set the node flags
156-
alt + {m,x,s,p,h}
157-
bspc node -g {marked,locked,sticky,private,hidden}
156+
alt + {m,x,s,p}
157+
bspc node -g {marked,locked,sticky,private}
158158

159-
# Show hidden nodes one by one
159+
# Hide window
160+
alt + h
161+
HideNode --hide
162+
163+
# Show menu to restore hidden windows
160164
ctrl + alt + h
161-
bspc node $(bspc query -N -n .hidden.local.window | head -n1) --flag hidden=off
165+
HideNode --menu
162166

163167
# ----- Focus/Swap Nodes ----- #
164168

0 commit comments

Comments
 (0)