From d28348a998bfc12f2b348eb9984ad66239c323cd Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 14 Nov 2022 23:49:43 +0200 Subject: Added bspwm --- .config/bspwm/bspcmd | 37 +++++++ .config/bspwm/bspwmrc | 184 ++++++++++++++++++++++++++++++++ .config/bspwm/menu.sh | 64 +++++++++++ .config/bspwm/noswallow | 2 + .config/bspwm/scripts/external_rules.sh | 39 +++++++ .config/bspwm/swallow | 3 + .config/bspwm/sysmenu.sh | 70 ++++++++++++ .config/bspwm/terminals | 1 + 8 files changed, 400 insertions(+) create mode 100755 .config/bspwm/bspcmd create mode 100755 .config/bspwm/bspwmrc create mode 100755 .config/bspwm/menu.sh create mode 100644 .config/bspwm/noswallow create mode 100755 .config/bspwm/scripts/external_rules.sh create mode 100644 .config/bspwm/swallow create mode 100755 .config/bspwm/sysmenu.sh create mode 100644 .config/bspwm/terminals (limited to '.config/bspwm') diff --git a/.config/bspwm/bspcmd b/.config/bspwm/bspcmd new file mode 100755 index 0000000..94bed26 --- /dev/null +++ b/.config/bspwm/bspcmd @@ -0,0 +1,37 @@ +#!/bin/bash + +CMD=${1:-help}; shift + +help() { + echo "Available commands:" + echo " * unhide - select and unhide window" +} + +unhide() { + action=${1:-list} + case $action in + "list") + selection=`for id in $(bspc query -N -n .hidden); do + title=$(xtitle $id) + [[ -z "$title" ]] && title="" + echo $id $title + done | rofi -dmenu -i -p "Hidden windows" | cut -f1 -d' '` + + [[ -z "$selection" ]] && exit 1 + + bspc node $selection -g hidden=off + ;; + esac +} + +case $CMD in + "help") + help + ;; + "unhide") + unhide $1 + ;; + *) + help + ;; +esac diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc new file mode 100755 index 0000000..935f41b --- /dev/null +++ b/.config/bspwm/bspwmrc @@ -0,0 +1,184 @@ +#! /bin/sh + +#░█▀▄░█▀▀░█▀█░█░█░█▄█ +#░█▀▄░▀▀█░█▀▀░█▄█░█░█ +#░▀▀░░▀▀▀░▀░░░▀░▀░▀░▀ + +bspc monitor LVDS-1 -d 1 2 3 4 5 +bspc monitor HDMI-1 -d 6 7 8 9 0 +#xdo below -t $(xdo id -n root) $(xdo id -a polybar-bottom_LVDS-1) + +###---Global Settings---### +bspc config automatic_scheme alternate +bspc config initial_polarity second_child +bspc config pointer_action1 move +bspc config pointer_action2 resize_side +bspc config pointer_action2 resize_corner +bspc config focus_follows_pointer false +bspc config remove_disabled_monitors true +bspc config remove_unplugged_monitors true +bspc config merge_overlapping_monitors true +bspc config border_width 2 +bspc config window_gap 10 +bspc config split_ratio 0.52 +bspc config borderless_monocle true +bspc config gapless_monocle true +bspc config swallow_first_click false +bspc config pointer_modifier mod1 +#bspc config pointer_action1 resize_side +#bspc config pointer_action1 resize_corner +#bspc config pointer_action3 move +bspc config normal_border_color "#282828" +bspc config active_border_color "#ebdbb2" +bspc config focused_border_color "#77dd77" +bspc config presel_feedback_color "#BF616A" +#bspc config normal_border_color "#282828" +#bspc config active_border_color "#ebdbb2" +#bspc config focused_border_color "#fe8019" + +# remove all rules first +bspc rule -r *:* + +#bspc rule -a Plank layer=above manage=on border=off focus=off locked=off +bspc rule -a Plank layer=above border=off + + +###---Autostart---#### +#pkill sxhkd; sxhkd & +pgrep -x sxhkd > /dev/null || sxhkd & +picom -b --experimental-backends & +if [[ $(xrandr -q | grep 'HDMI-1 connected') ]]; then + xrandr --output LVDS-1 --primary --mode 1366x768 --rotate normal --output HDMI-1 --mode 1920x1080 --rotate normal --right-of LVDS-1 +fi +xfce4-panel --disable-wm-check & +"$HOME"/.config/polybar/launch.sh & +dunst & # notification daemon +unclutter & # Remove mouse when idle +nitrogen --force-setter=xinerama --restore & +bspc rule -a \* rectangle=680x700+340+40 +bspc rule -a '*:*:Picture-in-Picture' state=floating sticky=on layer=above +bspc rule -a '*:*:Picture in picture' state=floating sticky=on layer=above +#if [ -n "Picture-in-Picture" ]; then +# xdo raise "Picture-in-Picture" +#fi +bspc rule -a firefox:Toolkit focus=on state=floating sticky=on layer=above rectangle=320x190+1030+480 +#bspc rule -a firefox:Toolkit sticky=on state=floating +#bspc rule -a firefox desktop='^3' state=pseudo_tiled rectangle=1260x760+0+0 center=on follow=on +#bspc rule -a firefox:firefox state=floating rectangle=748x478+0+0 center=on sticky=on +#bspc rule -a firefox:Firefox state=floating rectangle=499x289+0+0 center=on sticky=on +#bspc rule -a InputOutput state=floating sticky=on +bspc rule -a "https://www.youtube.com - Enhancer for YouTube™ — Mozilla Firefox" state=floating sticky=on layer=above +#bspc rule -a firefox state=floating +bspc rule -a Zathura state=floating + +eww daemon & +#killall bspswallow +#pidof bspswallow | bspswallow & +#fcitx -d & +#plank & +#bspc rule -a scratchpad sticky=on state=floating rectangle=560x260+500+0 +#killall plank; plank; xdotool search --class Plank windowraise & +#xdotool search --onlyvisible --class Plank set_window $window_id windowraise & +#xdotool search --class Plank windowreparent & + +# SCRATCHPAD + +#scratchpad_xy="750x265" +#display_xy=$(xdpyinfo | grep -i dimensions | awk '{ print $2 }') +#half_display=$(echo $display_xy | tr 'x' ' ' | cut -f1 -d' ' | xargs -I _ echo _/2 | bc) +#half_scratchpad=$(echo $scratchpad_xy | tr 'x' ' ' | cut -f1 -d' ' | xargs -I _ echo _/2 | bc) +#offset=$(echo ${half_display}-${half_scratchpad} | bc) + +#sid=$(wmctrl -lx | grep scratch.scratchpad| cut -d' ' -f1| head -1) \ +#&& [ -z "$(echo $sid)" ] \ +# && alacritty -t scratchpad --class scratch,scratchpad -e zsh -c "zsh tmux attach -t scratch || tmux new -s scratch"\ +# & sleep 1 \ +# && sid=$(wmctrl -lx | grep scratch.scratchpad| cut -d' ' -f1| head -1) \ +# && echo "$sid" > /tmp/scratchID ; +#-e tmux attach -t scratchpad || tmux new -s scratchpad; +#-e zsh -c "macchina; zsh"\ +#bspc rule -a scratchpad sticky=on state=floating hidden=on rectangle=750x265+310+480 +#bspc rule -a scratchpad sticky=on state=floating rectangle=800x240+281+502 +#bspc rule -a scratchpad sticky=on state=floating focus=on rectangle=800x240+280+500 +#bspc rule -a alacritty sticky=on state=floating focus=on rectangle=680x700+340+40 + +#bspc rule -a scratchpad sticky=on state=floating focus=on rectangle=680x260+340+420 +#bspc rule -a scratchpad sticky=on state=floating focus=on rectangle=510x520+425+200 +#bspc rule -a scratchpad sticky=on state=floating focus=on rectangle=465x320+425+390 +#bspc rule -a scratchpad sticky=on state=floating focus=on rectangle=425x390+468+320 +bspc rule -a scratch sticky=on state=floating rectangle=575x320+393+370 +#bspc rule -a scratchpad sticky=on state=floating focus=on + + +#bspc rule -a scratch sticky=on state=floating focus=on rectangle=680x300+340+420 +bspc rule -a Heads-Up-Display sticky=on state=floating rectangle=320x140+1030+32 +[ "$1" = 0 ] && { + nm-applet & + plank & +} +#if [ -n plank ]; then +# xdo above plank +#fi +#xdotool search --classname plank windowraise +#xdotool search --classname plank windowraise +#xdotool getwindowfocus getwindowgeometry +#scratchpad -e bspc node -g hidden & +#xdotool search --sync --class scratchpad windowunmap --sync %@ +# Autostart +#plank=/tmp/bspwm-startup.lock +#if [ ! -f $plank ]; then +# echo "dummy" > $plank +# plank & +#fi +# Autostart +#touch /tmp/bspwm-startup.lock +#startup_lock_file=/tmp/bspwm-startup.lock +#if [ ! -f $startup_lock_file ]; then +# echo "dummy" > $startup_lock_file +# plank & +#fi + +pkill xfce4-power-manager; sleep 1 && nice -n 1 xfce4-power-manager & +pkill volumeicon; sleep 2 && nice -n 2 volumeicon & +pkill mictray; sleep 2 && nice -n 2 mictray & +#pkill blueman-applet; sleep 3 && nice -n 3 blueman-applet & +#pkill qlipper; sleep 6 && nice -n 6 qlipper & + +bspc subscribe node_state | while read -r _ _ _ _ state flag; do + if [[ "$state" != fullscreen ]]; then continue; fi + if [[ "$flag" == on ]]; then + xdo lower -N Plank + else + xdo raise -N Plank + fi +done & + +#killall plank; plank & +#bspc rule -a kitty sticky=on state=floating rectangle=420x260+11+22 +#pkill nm-applet; nm-applet & +#pkill xfce4-power-manager; xfce4-power-manager & +#pkill volumeicon; volumeicon & +#pkill mictray; mictray & +#pkill blueman-applet; blueman-applet & +#pkill qlipper; qlipper & +#flameshot & +#sleep 1 && nice -n 0 pkill nm-applet; nm-applet & +#sleep 2 && nice -n 1 pkill xfce4-power-manager; xfce4-power-manager & +#sleep 3 && nice -n 2 pkill volumeicon; volumeicon & +#sleep 4 && nice -n 2 pkill mictray; mictray & +#sleep 5 && nice -n 3 pkill blueman-applet; blueman-applet & +#sleep 6 && nice -n 5 pkill qlipper; qlipper & +#sleep 1 && nice -n 18 pkill udiskie; udiskie --no-automount --tray & +xrdb ~/.config/X11/.Xresources & +# Start tmux if not already running +# Calculate the center of the screen for a 600x400 scratchpad +# rectangle=WidthxHeight+Xoffset+Yoffset +#bspc rule -a scratchy sticky=on state=floating rectangle=${scratchpad_xy}+${offset}+0 +#xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" $(xdo id -n polybar bottom) +#xdo lower -N polybar bottom +#xdo above -N polybar bottom -t $(xdo id -N Bspwm -n root) +#xdo below -t $(xdo id -n root) $(xdo id -a polybar bottom) +#xdo lower -N "polybar" +#xdo above -N "polybar" -t $(xdo id -N Bspwm -n root) +#xdo below -t $(xdo id -n root) $(xdo id -a polybar-bottom_LDVS-1) +bspc config external_rules_command ~/.config/bspwm/scripts/external_rules.sh diff --git a/.config/bspwm/menu.sh b/.config/bspwm/menu.sh new file mode 100755 index 0000000..f678ae1 --- /dev/null +++ b/.config/bspwm/menu.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +# Custom Rofi Script + +BORDER="#1F1F1F" +SEPARATOR="#1F1F1F" +FOREGROUND="#A9ABB0" +BACKGROUND="#1F1F1F" +BACKGROUND_ALT="#252525" +HIGHLIGHT_BACKGROUND="#1A237E" +HIGHLIGHT_FOREGROUND="#FFFFFF" + +BLACK="#000000" +WHITE="#ffffff" +RED="#e53935" +GREEN="#43a047" +YELLOW="#fdd835" +BLUE="#1e88e5" +MAGENTA="#00897b" +CYAN="#00acc1" +PINK="#d81b60" +PURPLE="#8e24aa" +INDIGO="#3949ab" +TEAL="#00897b" +LIME="#c0ca33" +AMBER="#ffb300" +ORANGE="#fb8c00" +BROWN="#6d4c41" +GREY="#757575" +BLUE_GREY="#546e7a" +DEEP_PURPLE="#5e35b1" +DEEP_ORANGE="#f4511e" +LIGHT_BLUE="#039be5" +LIGHT_GREEN="#7cb342" + +# Launch Rofi +rofi -no-lazy-grab -show drun \ +-display-drun "Applications " -drun-display-format "{name}" \ +-hide-scrollbar true \ +-bw 0 \ +-lines 10 \ +-line-padding 10 \ +-padding 20 \ +-width 30 \ +-xoffset 27 -yoffset 60 \ +-location 1 \ +-columns 2 \ +-show-icons -icon-theme "Papirus" \ +-font "Fantasque Sans Mono 10" \ +-color-enabled true \ +-color-window "$BACKGROUND,$BORDER,$SEPARATOR" \ +-color-normal "$BACKGROUND_ALT,$FOREGROUND,$BACKGROUND_ALT,$HIGHLIGHT_BACKGROUND,$HIGHLIGHT_FOREGROUND" \ +-color-active "$BACKGROUND,$MAGENTA,$BACKGROUND_ALT,$HIGHLIGHT_BACKGROUND,$HIGHLIGHT_FOREGROUND" \ +-color-urgent "$BACKGROUND,$YELLOW,$BACKGROUND_ALT,$HIGHLIGHT_BACKGROUND,$HIGHLIGHT_FOREGROUND" + +# More Options +# -fullscreen \ + +# Theming help +# color window = background, border, separator +# color normal = background, foreground, background-alt, highlight-background, highlight-foreground +# color active = background, foreground, background-alt, highlight-background, highlight-foreground +# color urgent = background, foreground, background-alt, highlight-background, highlight-foreground + diff --git a/.config/bspwm/noswallow b/.config/bspwm/noswallow new file mode 100644 index 0000000..139597f --- /dev/null +++ b/.config/bspwm/noswallow @@ -0,0 +1,2 @@ + + diff --git a/.config/bspwm/scripts/external_rules.sh b/.config/bspwm/scripts/external_rules.sh new file mode 100755 index 0000000..74fdaa0 --- /dev/null +++ b/.config/bspwm/scripts/external_rules.sh @@ -0,0 +1,39 @@ +#!/bin/env bash + +#instance=$3 +#[!-z"$3"] && xdo raise -a polybar-bottom_LVDS-1 +#[!-z"$3"] && xdo below -a polybar-bottom_LVDS-1 -t $(xdo id -N Bspwm -n root) + + +#bspc subscribe node_state | while read -r _ _ _ _ state flag; do +# if [[ "$state" != fullscreen ]]; then continue; fi +# if [[ "$flag" == on ]]; then +# xdo lower -N Plank +# else +# xdo raise -N Plank +# fi +#done & +# +#eval $4 +#bspc query -N -d ${desktop:-focused} -n .fullscreen >/dev/null && +# echo layer=above + + +#bspc subscribe node_state | while read -r _ _ _ _ state flag; do +# if [[ "$state" != fullscreen ]]; then continue; fi +# if [[ "$flag" == on ]]; then +# xdo lower -a polybar-bottom_LVDS-1 +# else +# xdo raise -a polybar-bottom_LVDS-1 +# fi +#done & + +# Allow any type of window to ignore fullscreen windows (allow fullscreen to +# stay) +wid="$1" +class="$2" +instance="$3" +eval "$4" + +[[ "$state" = floating ]] \ + && echo 'layer=above' diff --git a/.config/bspwm/swallow b/.config/bspwm/swallow new file mode 100644 index 0000000..21b7f00 --- /dev/null +++ b/.config/bspwm/swallow @@ -0,0 +1,3 @@ +sxiv +Sxiv +zathura diff --git a/.config/bspwm/sysmenu.sh b/.config/bspwm/sysmenu.sh new file mode 100755 index 0000000..1bdc35e --- /dev/null +++ b/.config/bspwm/sysmenu.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +# Custom Rofi Script + +BORDER="#1F1F1F" +SEPARATOR="#1F1F1F" +FOREGROUND="#A9ABB0" +BACKGROUND="#1F1F1F" +BACKGROUND_ALT="#252525" +HIGHLIGHT_BACKGROUND="#1A237E" +HIGHLIGHT_FOREGROUND="#FFFFFF" + +BLACK="#000000" +WHITE="#ffffff" +RED="#e53935" +GREEN="#43a047" +YELLOW="#fdd835" +BLUE="#1e88e5" +MAGENTA="#00897b" +CYAN="#00acc1" +PINK="#d81b60" +PURPLE="#8e24aa" +INDIGO="#3949ab" +TEAL="#00897b" +LIME="#c0ca33" +AMBER="#ffb300" +ORANGE="#fb8c00" +BROWN="#6d4c41" +GREY="#757575" +BLUE_GREY="#546e7a" +DEEP_PURPLE="#5e35b1" +DEEP_ORANGE="#f4511e" +LIGHT_BLUE="#039be5" +LIGHT_GREEN="#7cb342" + +# Launch Rofi +MENU="$(rofi -no-lazy-grab -sep "|" -dmenu -i -p 'System :' \ +-hide-scrollbar true \ +-bw 0 \ +-lines 4 \ +-line-padding 10 \ +-padding 20 \ +-width 15 \ +-xoffset -27 -yoffset 60 \ +-location 3 \ +-columns 1 \ +-show-icons -icon-theme "Papirus" \ +-font "Fantasque Sans Mono 10" \ +-color-enabled true \ +-color-window "$BACKGROUND,$BORDER,$SEPARATOR" \ +-color-normal "$BACKGROUND_ALT,$FOREGROUND,$BACKGROUND_ALT,$HIGHLIGHT_BACKGROUND,$HIGHLIGHT_FOREGROUND" \ +-color-active "$BACKGROUND,$MAGENTA,$BACKGROUND_ALT,$HIGHLIGHT_BACKGROUND,$HIGHLIGHT_FOREGROUND" \ +-color-urgent "$BACKGROUND,$YELLOW,$BACKGROUND_ALT,$HIGHLIGHT_BACKGROUND,$HIGHLIGHT_FOREGROUND" \ +<<< " Lock| Logout| Reboot| Shutdown")" +case "$MENU" in + *Lock) i3lock -c 282a36 -n ;; + *Logout) openbox --exit;; + *Reboot) sudo reboot ;; + *Shutdown) sudo shutdown -r now +esac + +# More Options +# -fullscreen \ + +# Theming help +# color window = background, border, separator +# color normal = background, foreground, background-alt, highlight-background, highlight-foreground +# color active = background, foreground, background-alt, highlight-background, highlight-foreground +# color urgent = background, foreground, background-alt, highlight-background, highlight-foreground + diff --git a/.config/bspwm/terminals b/.config/bspwm/terminals new file mode 100644 index 0000000..414337e --- /dev/null +++ b/.config/bspwm/terminals @@ -0,0 +1 @@ +Alacritty -- cgit v1.2.3