summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-12-19 17:59:51 -0700
committerDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-12-19 17:59:51 -0700
commit1a2357773586ee8421379de4070f71da40d1c679 (patch)
tree0d56955ebb4d28120b9d04942dc59d2a7315bd80
parentffb920179648bd4fdde1eb8b2e8b8e068fb4eb4b (diff)
Almost fully using bspwm
-rw-r--r--.config/alacritty/alacritty.yml4
-rwxr-xr-x.config/bspwm/bspwmrc20
-rw-r--r--.config/i3/config2
-rw-r--r--.config/nvim/init.vim4
-rw-r--r--.config/shell/profile1
-rw-r--r--.config/sxhkd/sxhkdrc104
-rw-r--r--.config/x11/xprofile2
-rwxr-xr-x.local/bin/statusbar/statusbar35
-rwxr-xr-x.local/bin/statusbar/statusbar_bar1116
-rw-r--r--.local/bin/statusbar/statusbar_colors24
10 files changed, 260 insertions, 52 deletions
diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml
index eebf7ae..e6bb373 100644
--- a/.config/alacritty/alacritty.yml
+++ b/.config/alacritty/alacritty.yml
@@ -20,7 +20,8 @@ window:
# - none: Neither borders nor title bar
#decorations: full
#startup_mode: Windowed
- title: Alacritty
+ #title: Alacritty
+ dynamic_title: true
class:
instance: Alacritty
general: Alacritty
@@ -123,7 +124,6 @@ background_opacity: 0.9
#selection:
#save_to_clipboard: false
-#dynamic_title: true
cursor:
# - ▇ Block
diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc
index db9b707..b152f41 100755
--- a/.config/bspwm/bspwmrc
+++ b/.config/bspwm/bspwmrc
@@ -1,13 +1,23 @@
#!/bin/sh
-# Check if sxhkd is installed, I guess,
-# because bspwm doesn't have keybindings by default.
+# Checks if X program is already running, if not, run it.
pgrep -x sxhkd > /dev/null || sxhkd &
+pgrep -x statusbar > /dev/null || statusbar &
# Multihead.
-if [ $(hostname) == "arch" ]; then
- bspc monitor DP-0 -d I II III IV V
- bspc monitor HDMI-0 -d VI VII VIII IX X
+if [ $(uname -n) = "arch" ]; then
+ MAINMON="DP-0"
+ SECMON="HDMI-0"
+
+ bspc monitor $MAINMON -d 1 2 3 4 5
+ bspc monitor $SECMON -d 6 7 8 9 10
+
+ if [ $(pgrep -f bspwm_enforce_monitor_position) < 2]; then
+ bspwm_enforce_monitor_position $MAINMON '^1' &
+ else
+ killall bspwm_enforce_monitor_position
+ bspwm_enforce_monitor_position $MAINMON '^1' &
+ fi
else
bspc monitor -d I II III IV V VI VII VIII IX X
fi
diff --git a/.config/i3/config b/.config/i3/config
index 97dfbd4..2e0176d 100644
--- a/.config/i3/config
+++ b/.config/i3/config
@@ -78,7 +78,7 @@ font pango:monospace 10
assign [class="vlc"] $ws5
# WS6
# For a negative regex lookup: "^(?!Save As).*$", for example.
- assign [class="firefox"] $ws6
+ # assign [class="firefox"] $ws6
# WS7
assign [class="Thunderbird"] $ws7
# WS8
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
index 0f48c01..dbe061d 100644
--- a/.config/nvim/init.vim
+++ b/.config/nvim/init.vim
@@ -19,8 +19,11 @@ set showcmd
" Color schemes
" Plug 'altercation/vim-colors-solarized'
Plug 'dracula/vim'
+ Plug 'chrisbra/Colorizer'
+ let g:colorizer_colornames = 0
" Other
+ Plug 'baskerville/vim-sxhkdrc'
Plug 'mboughaba/i3config.vim'
Plug 'junegunn/goyo.vim'
Plug 'preservim/nerdtree'
@@ -98,6 +101,7 @@ set showcmd
colorscheme dracula
" Just so alacritty can use transparency.
hi Normal ctermbg=NONE
+ set title
set encoding=utf-8
set number relativenumber
set cursorline
diff --git a/.config/shell/profile b/.config/shell/profile
index 5a487ce..599924a 100644
--- a/.config/shell/profile
+++ b/.config/shell/profile
@@ -15,6 +15,7 @@ export STATUSBAR="i3blocks"
export MAILMGR="thunderbird"
# export MSGCHAT="telegram-desktop"
export SSMGR="flameshot"
+ export SSPATH="$HOME/pix/ss/"
## ~/ cleanup.
# XDG base directory specification found in:
diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc
index 46fa323..d4595ac 100644
--- a/.config/sxhkd/sxhkdrc
+++ b/.config/sxhkd/sxhkdrc
@@ -1,125 +1,143 @@
#
-# General keybinds.
+# General keybindings.
#
-# Terminal emulator.
+# Basic.
super + Return
- alacritty
-
-# Program launcher.
+ $TERMINAL
super + d
i3-dmenu-desktop
-
-# Reload sxhkd config.
super + Escape
pkill -USR1 -x sxhkd
+# Run programs.
+super + shift + w
+ $BROWSER
+super + shift + f
+ $TERMINAL -e $FILE
+super + Delete
+ $TERMINAL -e htop
+
+# Screenshots.
+{_,super, super + shift} + Print
+ $SSMGR {gui,full -c,full -p $SSPATH}
+
#
-# bspwm hotkeys
+# bspwm keybindings.
#
# Quit/restart bspwm.
-super + shift + r
- bspc wm -r
-# super + shift + {q,r}
-# bspc {quit,wm -r}
+super + shift + {e,r}
+ bspc {quit,wm -r}
# Close and kill.
-super + shift + q
- bspc node -k
-# super + {_,shift + }w
-# bspc node -{c,k}
+super + {_,shift + }q
+ bspc node -{c,k}
-# alternate between the tiled and monocle layout
+# Alternate between the tiled and monocle layout.
super + m
bspc desktop -l next
-# send the newest marked node to the newest preselected node
+# Send the newest marked node to the newest preselected node.
super + y
bspc node newest.marked.local -n newest.!automatic.local
-# swap the current node and the biggest window
+# Swap the current node and the biggest window.
super + g
bspc node -s biggest.window
#
-# state/flags
+# State/flags.
#
-# set the window state
+# Set the window state.
super + {t,shift + t,s,f}
bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
-# set the node flags
+# Set the node flags.
super + ctrl + {m,x,y,z}
bspc node -g {marked,locked,sticky,private}
#
-# focus/swap
+# Focus/swap.
#
-# focus the node in the given direction
+# Socus the node in the given direction.
super + {_,shift + }{h,j,k,l}
bspc node -{f,s} {west,south,north,east}
-# focus the node for the given path jump
+# Focus the node for the given path jump.
super + {p,b,comma,period}
bspc node -f @{parent,brother,first,second}
-# focus the next/previous window in the current desktop
+# Focus the next/previous window in the current desktop.
super + {_,shift + }c
bspc node -f {next,prev}.local.!hidden.window
-# focus the next/previous desktop in the current monitor
-super + bracket{left,right}
+# Focus the next/previous desktop in the current monitor.
+super + brace{left,right}
bspc desktop -f {prev,next}.local
-# focus the last node/desktop
-super + {grave,Tab}
+# Focus the last node/desktop.
+super + {Tab,dead_acute}
bspc {node,desktop} -f last
-# focus the older or newer node in the focus history
+# Focus the older or newer node in the focus history.
super + {o,i}
bspc wm -h off; \
bspc node {older,newer} -f; \
bspc wm -h on
-# focus or send to the given desktop
+# Focus or send to the given desktop.
super + {_,shift + }{1-9,0}
bspc {desktop -f,node -d} '^{1-9,10}'
#
-# preselect
+# Preselect.
#
-# preselect the direction
+# Preselect the direction.
super + ctrl + {h,j,k,l}
bspc node -p {west,south,north,east}
-# preselect the ratio
+# Preselect the ratio.
super + ctrl + {1-9}
bspc node -o 0.{1-9}
-# cancel the preselection for the focused node
+# Cancel the preselection for the focused node.
super + ctrl + space
bspc node -p cancel
-# cancel the preselection for the focused desktop
+# Cancel the preselection for the focused desktop.
super + ctrl + shift + space
bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
#
-# move/resize
+# Move/resize.
#
-# expand a window by moving one of its side outward
+# Expand a window by moving one of its side outward.
super + alt + {h,j,k,l}
- bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}
+ n=20; \
+ bspc node -z {left -$n 0,bottom 0 $n,top 0 -$n,right $n 0}
-# contract a window by moving one of its side inward
+# Contract a window by moving one of its side inward.
super + alt + shift + {h,j,k,l}
- bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}
+ n=20; \
+ bspc node -z {right -$n 0,top 0 $n,bottom 0 -$n,left $n 0}
-# move a floating window
+# Move a floating window.
super + {Left,Down,Up,Right}
bspc node -v {-20 0,0 20,0 -20,20 0}
+
+
+# Smart resize, will grow or shrink depending on location.
+# Will always grow for floating nodes.
+super + alt + ctrl + {Left,Down,Up,Right}
+ n=10; \
+ { d1=left; d2=right; dx=-$n; dy=0; \
+ , d1=bottom; d2=top; dx=0; dy=$n; \
+ , d1=top; d2=bottom; dx=0; dy=-$n; \
+ , d1=right; d2=left; dx=$n; dy=0; \
+ } \
+ bspc node --resize $d1 $dx $dy || bspc node --resize $d2 $dx $dy
diff --git a/.config/x11/xprofile b/.config/x11/xprofile
index b3abfbb..d0d380c 100644
--- a/.config/x11/xprofile
+++ b/.config/x11/xprofile
@@ -15,4 +15,4 @@ flameshot &
pasystray &
# At the end, start the WM.
-exec i3
+exec bspwm
diff --git a/.local/bin/statusbar/statusbar b/.local/bin/statusbar/statusbar
new file mode 100755
index 0000000..c5ee748
--- /dev/null
+++ b/.local/bin/statusbar/statusbar
@@ -0,0 +1,35 @@
+#!/bin/sh
+PANEL_FIFO=/tmp/panel-fifo
+PANEL_HEIGHT=24
+# PANEL_FONT="-*-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
+PANEL_WM_NAME=bspwm_statusbar
+
+if xdo id -a "$PANEL_WM_NAME" > /dev/null ; then
+ printf "%s\n" "The status bar is already running." >&2
+ exit 1
+fi
+
+trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
+
+[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
+mkfifo "$PANEL_FIFO"
+
+xtitle -sf 'T%s\n' > "$PANEL_FIFO" &
+# date +"S%d/%m%y %r" > "$PANEL_FIFO" &
+bspc subscribe report > "$PANEL_FIFO" &
+
+. statusbar_colors
+
+statusbar_bar1 < "$PANEL_FIFO" | lemonbar -a 32 -u 2 -n "$PANEL_WM_NAME" -g x$PANEL_HEIGHT -f "$PANEL_FONT" -F "$COLOR_DEFAULT_FG" -B "$COLOR_DEFAULT_BG" &
+
+# This only really works for one monitor.
+# wid=$(xdo id -m -a "$PANEL_WM_NAME")
+# xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid"
+
+bspid="$(xdo id -N Bspwm -n root | sort | head -n 1)"
+# The first part of the pipe is the "wid"
+xdo id -m -a "$PANEL_WM_NAME" | while read wid; do
+ xdo above -t "$bspid" "$wid"
+done
+
+wait
diff --git a/.local/bin/statusbar/statusbar_bar1 b/.local/bin/statusbar/statusbar_bar1
new file mode 100755
index 0000000..1aff3a9
--- /dev/null
+++ b/.local/bin/statusbar/statusbar_bar1
@@ -0,0 +1,116 @@
+#!/bin/sh
+
+. statusbar_colors
+
+num_mon=$(bspc query -M | wc -l)
+
+while read -r line ; do
+ case $line in
+ S*)
+ # clock output
+ sys="%{F$COLOR_SYS_FG}%{B$COLOR_SYS_BG} ${line#?} %{B-}%{F-}"
+ ;;
+ T*)
+ # xtitle output
+ title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG} ${line#?} %{B-}%{F-}"
+ ;;
+ W*)
+ # bspwm's state
+ wm=
+ IFS=':'
+ set -- ${line#?}
+ while [ $# -gt 0 ] ; do
+ item=$1
+ name=${item#?}
+ case $item in
+ [mM]*)
+ case $item in
+ m*)
+ # monitor
+ FG=$COLOR_MONITOR_FG
+ BG=$COLOR_MONITOR_BG
+ on_focused_monitor=
+ ;;
+ M*)
+ # focused monitor
+ FG=$COLOR_FOCUSED_MONITOR_FG
+ BG=$COLOR_FOCUSED_MONITOR_BG
+ on_focused_monitor=1
+ ;;
+ esac
+ [ $num_mon -lt 2 ] && shift && continue
+ wm="${wm}%{F${FG}}%{B${BG}}%{A:bspc monitor -f ${name}:} ${name} %{A}%{B-}%{F-}"
+ ;;
+ [fFoOuU]*)
+ case $item in
+ f*)
+ # free desktop
+ FG=$COLOR_FREE_FG
+ BG=$COLOR_FREE_BG
+ UL=$BG
+ ;;
+ F*)
+ if [ "$on_focused_monitor" ] ; then
+ # focused free desktop
+ FG=$COLOR_FOCUSED_FREE_FG
+ BG=$COLOR_FOCUSED_FREE_BG
+ UL=$BG
+ else
+ # active free desktop
+ FG=$COLOR_FREE_FG
+ BG=$COLOR_FREE_BG
+ UL=$COLOR_FOCUSED_FREE_BG
+ fi
+ ;;
+ o*)
+ # occupied desktop
+ FG=$COLOR_OCCUPIED_FG
+ BG=$COLOR_OCCUPIED_BG
+ UL=$BG
+ ;;
+ O*)
+ if [ "$on_focused_monitor" ] ; then
+ # focused occupied desktop
+ FG=$COLOR_FOCUSED_OCCUPIED_FG
+ BG=$COLOR_FOCUSED_OCCUPIED_BG
+ UL=$BG
+ else
+ # active occupied desktop
+ FG=$COLOR_OCCUPIED_FG
+ BG=$COLOR_OCCUPIED_BG
+ UL=$COLOR_FOCUSED_OCCUPIED_BG
+ fi
+ ;;
+ u*)
+ # urgent desktop
+ FG=$COLOR_URGENT_FG
+ BG=$COLOR_URGENT_BG
+ UL=$BG
+ ;;
+ U*)
+ if [ "$on_focused_monitor" ] ; then
+ # focused urgent desktop
+ FG=$COLOR_FOCUSED_URGENT_FG
+ BG=$COLOR_FOCUSED_URGENT_BG
+ UL=$BG
+ else
+ # active urgent desktop
+ FG=$COLOR_URGENT_FG
+ BG=$COLOR_URGENT_BG
+ UL=$COLOR_FOCUSED_URGENT_BG
+ fi
+ ;;
+ esac
+ wm="${wm}%{F${FG}}%{B${BG}}%{U${UL}}%{+u}%{A:bspc desktop -f ${name}:} ${name} %{A}%{B-}%{F-}%{-u}"
+ ;;
+ [LTG]*)
+ # layout, state and flags
+ wm="${wm}%{F$COLOR_STATE_FG}%{B$COLOR_STATE_BG} ${name} %{B-}%{F-}"
+ ;;
+ esac
+ shift
+ done
+ ;;
+ esac
+ printf "%s\n" "%{l}${wm}%{c}${title}%{r}${sys}"
+done
diff --git a/.local/bin/statusbar/statusbar_colors b/.local/bin/statusbar/statusbar_colors
new file mode 100644
index 0000000..4597036
--- /dev/null
+++ b/.local/bin/statusbar/statusbar_colors
@@ -0,0 +1,24 @@
+COLOR_DEFAULT_FG="#a7a5a5"
+COLOR_DEFAULT_BG="#333232"
+COLOR_MONITOR_FG="#8dbcdf"
+COLOR_MONITOR_BG="#333232"
+COLOR_FOCUSED_MONITOR_FG="#b1d0e8"
+COLOR_FOCUSED_MONITOR_BG="#144b6c"
+COLOR_FREE_FG="#737171"
+COLOR_FREE_BG="#333232"
+COLOR_FOCUSED_FREE_FG="#000000"
+COLOR_FOCUSED_FREE_BG="#504e4e"
+COLOR_OCCUPIED_FG="#a7a5a5"
+COLOR_OCCUPIED_BG="#333232"
+COLOR_FOCUSED_OCCUPIED_FG="#d6d3d2"
+COLOR_FOCUSED_OCCUPIED_BG="#504e4e"
+COLOR_URGENT_FG="#f15d66"
+COLOR_URGENT_BG="#333232"
+COLOR_FOCUSED_URGENT_FG="#501d1f"
+COLOR_FOCUSED_URGENT_BG="#d5443e"
+COLOR_STATE_FG="#89b09c"
+COLOR_STATE_BG="#333232"
+COLOR_TITLE_FG="#a8a2c0"
+COLOR_TITLE_BG="#333232"
+COLOR_SYS_FG="#b1a57d"
+COLOR_SYS_BG="#333232"