aboutsummaryrefslogtreecommitdiff
path: root/bspwm
diff options
context:
space:
mode:
Diffstat (limited to 'bspwm')
-rwxr-xr-xbspwm/.config/bspwm/bspwmrc38
-rwxr-xr-xbspwm/scripts/bspwm/border_colors.sh19
-rwxr-xr-xbspwm/scripts/bspwm/desktops.sh38
-rwxr-xr-xbspwm/scripts/bspwm/wallpaper.sh46
4 files changed, 141 insertions, 0 deletions
diff --git a/bspwm/.config/bspwm/bspwmrc b/bspwm/.config/bspwm/bspwmrc
new file mode 100755
index 0000000..c6bbbfe
--- /dev/null
+++ b/bspwm/.config/bspwm/bspwmrc
@@ -0,0 +1,38 @@
+#! /bin/bash
+
+run () {
+ pgrep -f "$*" && echo "$1 already running" || $* &
+}
+
+xrdb -merge .Xdefaults
+xsetroot -cursor_name left_ptr
+
+run sxhkd
+run polybar bspwm
+run ~/scripts/bspwm/desktops.sh
+run ~/scripts/bspwm/border_colors.sh
+~/scripts/bspwm/wallpaper.sh
+
+#compton -i .8 --focus-exclude '_NET_WM_NAME@:s = "rofi"' --blur-background --blur-kern '3,3,0.1,1,1,1,1,1,1,1' &
+
+# Create at least a desktop named "1" and add all the other existing desktop
+bspc monitor -d $(cat <(echo 1) <(bspc query --names -D) | sort -u -V | tr -s '\n' ' ')
+
+bspc config border_width 2
+bspc config window_gap 12
+
+bspc config split_ratio 0.52
+bspc config borderless_monocle true
+bspc config gapless_monocle true
+bspc config single_monocle true
+
+bspc config focus_follows_pointer true
+
+#bspc rule -a Gimp desktop='^8' state=floating follow=on
+#bspc rule -a Screenkey manage=off
+#bspc rule -a Thunderbird desktop='Mail'
+#bspc rule -a 'Firefox-esr' desktop='Web'
+#bspc rule -a Gmpc desktop='Musique'
+
+bspc rule -r "*"
+bspc rule -a "QtPass:qtpass" sticky=on state=floating
diff --git a/bspwm/scripts/bspwm/border_colors.sh b/bspwm/scripts/bspwm/border_colors.sh
new file mode 100755
index 0000000..dc03a3f
--- /dev/null
+++ b/bspwm/scripts/bspwm/border_colors.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+: "${MARKED_NORMAL_BCOLOR:=0x0000ff}"
+: "${MARKED_ACTIVE_BCOLOR:=0x00ff00}"
+: "${MARKED_FOCUSED_BCOLOR:=0xff0000}"
+
+while bspc subscribe -c 1 node_focus node_flag > /dev/null; do
+ bspc config focused_border_color "$(bspc config focused_border_color)"
+
+ bspc query -N -n '.marked.!focused.window' | while read -r wid; do
+ chwb -c "$MARKED_NORMAL_BCOLOR" "$wid"
+ done
+ bspc query -N -n '.marked.active.!focused.window' | while read -r wid; do
+ chwb -c "$MARKED_ACTIVE_BCOLOR" "$wid"
+ done
+ bspc query -N -n "focused.marked" | while read -r wid; do
+ chwb -c "$MARKED_FOCUSED_BCOLOR" "$wid"
+ done
+done
diff --git a/bspwm/scripts/bspwm/desktops.sh b/bspwm/scripts/bspwm/desktops.sh
new file mode 100755
index 0000000..d073bb8
--- /dev/null
+++ b/bspwm/scripts/bspwm/desktops.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+bspc subscribe desktop | while read -r event monitor_id desktop_id name; do
+ case $event in
+ desktop_focus)
+ ~/scripts/bspwm/wallpaper.sh &
+ for desktop in $(bspc query -D); do
+ test "x${desktop}" = "x${desktop_id}" && continue
+
+ nodes=$(bspc query -d ${desktop} -N)
+ # If the desktop is empty, delete it
+ test -z "${nodes}" && bspc desktop ${desktop} -r
+ done
+ ;;
+ desktop_add)
+ bspc monitor -o $(bspc query --names -D| sort -V | tr -s '\n' ' ')
+ case $name in
+ Musique)
+ bspc node @$name:/ -i
+ bspc rule --add Gmpc -o node=@$name:/
+ gmpc &
+ ;;
+ Web)
+ bspc node @$name:/ -i
+ bspc rule --add Firefox-esr -o node=@$name:/
+ firefox &
+ ;;
+ Mail)
+ bspc node @$name:/ -i
+ bspc rule --add thunderbird -o node=@$name:/
+ thunderbird &
+ ;;
+ esac
+ ;;
+ desktop_rename)
+ bspc monitor -o $(bspc query --names -D| sort -V | tr -s '\n' ' ')
+ ;;
+ esac
+done
diff --git a/bspwm/scripts/bspwm/wallpaper.sh b/bspwm/scripts/bspwm/wallpaper.sh
new file mode 100755
index 0000000..552da76
--- /dev/null
+++ b/bspwm/scripts/bspwm/wallpaper.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+#image=$(find ~/wallpaper/wallpaper/wallpapers -type f \( -name '*.jpg' -o -name '*.png' \) -print0 | shuf -n1 -z | xargs -0)
+image=$1
+
+#height=$(identify -format '%[fx:h/1.11]' ${image})
+#convert -crop %100x10+0+${height} ${image} out.jpg
+#color=$(.virtualenvs/pywal/bin/colorz -n 1 --no-preview out.jpg | cut -d' ' -f1)
+#rm out.jpg
+#echo $color
+#neg=$(python ~/scripts/i3/negate_color.py "${color}")
+
+#.virtualenvs/pywal/bin/wal -n -i "${image}" --saturate .8 -a 90
+#hsetroot \
+# -fill "${image}" \
+# -add "#ffffffff" \
+# -addd "#77777700" 5 \
+# -addd "#ffffff00" 10 \
+# -addd "#ffffff00" 90 \
+# -gradient 0
+
+if [ -z "${VNCDESKTOP}" ]; then
+ hsetroot \
+ -fill "${image}" \
+ -add "#ffffff77" \
+ -addd "#ffffff77" 2 \
+ -addd "#ffffff00" 0 \
+ -addd "#ffffff00" 90 \
+ -gradient 0
+else
+ #dominant=$(hexdump -n 3 -e '"%06X" 1 "\n"' /dev/urandom)
+
+ # Traverse the chromatic circle in 5 hours
+ cutoff=18000
+ background="#eceff4"
+
+ dominant=$(python3 -c "import colorsys ; import datetime ; now = datetime.datetime.now() ; min = datetime.datetime.min ; sec = (now - min).seconds % $cutoff ; print(''.join('%02x' % int(i*255) for i in colorsys.hsv_to_rgb(sec/$cutoff, 0.35, 1)))")
+ hsetroot \
+ -solid "#${dominant}" \
+ -add "${background}" \
+ -addd "${background}" 5 \
+ -addd "#ffffff77" 40 \
+ -addd "#ffffff77" 90 \
+ -addd "#F0F0F0FF" 40 \
+ -addd "#F0F0F0" 5 \
+ -gradient 0
+fi