Commit bf3cb000 authored by Guilherme Semente's avatar Guilherme Semente 🌱

Refactoring of bspwm setup

parent d8b6af3c
! fonts: Monoid-12 Hack-14 FiraCode-14 ! fonts: Monoid-14 Hack-14 FiraCode-14
urxvt.font: xft:Monoid:size=12 urxvt.font: xft:Monoid:size=14
urxvt.background: #202122 urxvt.background: #202122
urxvt.foreground: #d3d7cf urxvt.foreground: #d3d7cf
urxvt.scrollBar: false urxvt.scrollBar: false
emacs.font: Monoid-12 emacs.font: Monoid-14
dzen2.background: #202122 dzen2.background: #202122
dzen2.foreground: #d3d7cf dzen2.foreground: #d3d7cf
st.font: Monoid-12 st.font: Monoid-14
st.color0: #202122 st.color0: #202122
st.color7: #d3d7cf st.color7: #d3d7cf
......
#!/bin/sh #!/bin/bash
# bspwm configuration file
# #
# - Get window class names using the `xprop WM_CLASS' command # NOTE This file must have executable permissions
# #
# See bspwm(1) and <https://github.com/baskerville/bspwm> for more information.
WALLPAPER_COLOR="#424344"
BORDER_COLOR="#535355"
FOCUSED_COLOR="#d3d7cf"
PRESEL_COLOR="$FOCUSED_COLOR"
# #
# displays
#
~/etc/setup-displays.sh
# turn off display after 8 minutes of inactivity
xset dpms 480 480 480
_BSPWM_BORDER_COLOR="${BSPWM_BORDER_COLOR:-#888888}"
# _BSPWM_FOCUSED_COLOR="${BSPWM_FOCUSED_COLOR:-#FFFFFF}"
# bspwm config _BSPWM_PRESEL_COLOR="${BSPWM_BORDER_COLOR:-$_BSPWM_FOCUSED_COLOR}"
#
bspc config split_ratio 0.52 bspc config split_ratio 0.52
bspc config focus_follows_pointer false bspc config focus_follows_pointer false
bspc config pointer_follows_focus true bspc config pointer_follows_focus true
bspc config pointer_follows_monitor true bspc config pointer_follows_monitor true
bspc config borderless_monocle false
bspc config borderless_monocle true
bspc config gapless_monocle false bspc config gapless_monocle false
bspc config single_monocle true bspc config single_monocle false
bspc config window_gap 64
bspc config window_gap 8
bspc config border_width 6 bspc config border_width 6
bspc config remove_disabled_monitors true bspc config remove_disabled_monitors true
bspc config remove_unplugged_monitors true bspc config remove_unplugged_monitors true
bspc config merge_overlapping_monitors true bspc config merge_overlapping_monitors true
bspc config normal_border_color "$_BSPWM_BORDER_COLOR"
bspc config focused_border_color "$_BSPWM_FOCUSED_COLOR"
bspc config presel_feedback_color "$_BSPWM_PRESEL_COLOR"
bspc monitor -d 1 2 3 4 bspc monitor -d 1 2 3 4
bspc rule -a "*" state=floating bspc rule -a "*" state=floating
# set wallpaper and cursor # bspc subscribe handler daemon
{ test -f "$HOME/.wallpaper" && hsetroot -fill "$HOME/.wallpaper"; } || hsetroot -solid "$WALLPAPER_COLOR" #setsid bspwm-subscribe-handler >/dev/null 2>&1 < /dev/null &
xsetroot -cursor_name left_ptr bspwm-subscribe-handler &
bspc config normal_border_color "$BORDER_COLOR"
bspc config focused_border_color "$FOCUSED_COLOR"
bspc config presel_feedback_color "$PRESEL_COLOR"
#
# startup
#
# start the hotkey daemon (see ~/.config/sxhkd/sxhkdrc)
pkill -USR1 -x sxhkd || sxhkd &
# auto lock screen after 8 minutes of inactivity
xautolock -secure -time 8 -locker x-lock &
...@@ -24,6 +24,10 @@ super + Return ...@@ -24,6 +24,10 @@ super + Return
super + {0-9} super + {0-9}
gnome-terminal -e "tmux new-session -A -s {0-9}" gnome-terminal -e "tmux new-session -A -s {0-9}"
# quick launch
super + semicolon ; {e,f,t}
{emacsclient -a="" -c,firefox,st -f monoid-14}
# rofi launcher # rofi launcher
super + space super + space
rofi -modi combi -show combi -combi-modi run,drun,window,ssh rofi -modi combi -show combi -combi-modi run,drun,window,ssh
...@@ -31,12 +35,12 @@ super + space ...@@ -31,12 +35,12 @@ super + space
# lock screen # lock screen
super + shift + l super + shift + l
x-lock xlock
# screen capture # screen capture
super + @Print super + @Print
mkdir -p ~/downloads/screenshots;\ mkdir -p ~/downloads/screenshots;\
x-message "PrtSc";\ xwrite "PrtSc";\
cd ~/downloads/screenshots && scrot --select --exec 'sxiv -b -g 1300x700 $f' cd ~/downloads/screenshots && scrot --select --exec 'sxiv -b -g 1300x700 $f'
...@@ -92,7 +96,7 @@ super + m ...@@ -92,7 +96,7 @@ super + m
# change window gap # change window gap
super + g super + g
bspc config -d focused window_gap {0,4,8,16,32,64,96,128} && x-message "$(bspc config -d focused window_gap)px" bspc config -d focused window_gap {0,4,8,16,32,64,96,128} && xwrite "$(bspc config -d focused window_gap)px"
# circulate windows in the current desktop # circulate windows in the current desktop
super + c super + c
...@@ -160,13 +164,13 @@ shift + super + BackSpace ...@@ -160,13 +164,13 @@ shift + super + BackSpace
# volume # volume
super + {bracketleft,bracketright} super + {bracketleft,bracketright}
pulsemixer --change-volume "{-,+}10" && x-message "$(pulsemixer --get-volume | cut -d' ' -f2)🔉" pulsemixer --change-volume "{-,+}10" && xwrite "$(pulsemixer --get-volume | cut -d' ' -f2)🔉"
{XF86AudioLowerVolume,XF86AudioRaiseVolume} {XF86AudioLowerVolume,XF86AudioRaiseVolume}
pulsemixer --change-volume "{-,+}10" && x-message "$(pulsemixer --get-volume | cut -d' ' -f2)🔉" pulsemixer --change-volume "{-,+}10" && xwrite "$(pulsemixer --get-volume | cut -d' ' -f2)🔉"
{XF86AudioMute,super + backslash} {XF86AudioMute,super + backslash}
pulsemixer --toggle-mute && x-message "0🔇" pulsemixer --toggle-mute && xwrite "0🔇"
# player control # player control
super + {comma,period,slash} super + {comma,period,slash}
...@@ -174,11 +178,11 @@ super + {comma,period,slash} ...@@ -174,11 +178,11 @@ super + {comma,period,slash}
# brightness and screen color temperature # brightness and screen color temperature
XF86MonBrightnessDown XF86MonBrightnessDown
xbacklight -dec 10 && x-message "$(printf "%d💡" $(xbacklight -get))" xbacklight -dec 10 && xwrite "$(printf "%d💡" $(xbacklight -get))"
XF86MonBrightnessUp XF86MonBrightnessUp
xbacklight -inc 10 && x-message "$(printf "%d💡" $(xbacklight -get))" xbacklight -inc 10 && xwrite "$(printf "%d💡" $(xbacklight -get))"
shift + super + s shift + super + s
temp="{6500k default,5000k day*,4000k moon,3000k warm*,2800k xwarm,1800k candle}";\ temp="{6500k default,5000k day*,4000k moon,3000k warm*,2800k xwarm,1800k candle}";\
sct "$temp" && x-message "$(printf "%s" $temp)" sct "$temp" && xwrite "$(printf "%s" $temp)"
XDG_DOCUMENTS_DIR="$HOME/org" XDG_DOCUMENTS_DIR="$HOME/doc"
XDG_DOWNLOAD_DIR="$HOME/downloads" XDG_DOWNLOAD_DIR="$HOME/downloads"
XDG_MUSIC_DIR="$HOME/media/music" XDG_MUSIC_DIR="$HOME/media/music"
......
#!/bin/bash
bspc subscribe all | while read -a msg ; do
echo "${msg[@]}"
case "${msg[0]}" in
desktop_focus)
#xwrite "$(bspc query -D -d --names)" &
;;
desktop_layout)
layout="${msg[3]}"
#xwrite "$layout" &
if [ "$layout" == "monocle" ]; then
hsetroot -solid "#132530"
bspc config focused_border_color "#9DA3AB"
bspc config border_width 6
else
hsetroot -solid "#222950"
bspc config focused_border_color "#59F487"
bspc config border_width 6
fi
;;
node_focus)
if [ -f "$XDG_RUNTIME_DIR/bspwm-scratchpad.wid" ]; then
id=$(cat "$XDG_RUNTIME_DIR/bspwm-scratchpad.wid")
bspc node "$id" --flag hidden
fi
;;
node_activate)
;;
node_flag)
;;
*)
esac
done
...@@ -4,23 +4,6 @@ ...@@ -4,23 +4,6 @@
# This tool is designed to prevent accidental pastes or leaks of data collected # This tool is designed to prevent accidental pastes or leaks of data collected
# by your desktop environment clipboard. # by your desktop environment clipboard.
# #
# If you use a freedesktop.org compatible desktop environment you can setup cbd
# as a XDG autostart application:
#
# $ sudo apt install xclip xprintidle
# $ cat <<EOF >~/.config/autostart/cbd.desktop
# [Desktop Entry]
# Name=cbd
# Exec=cbd
# Terminal=false
# Type=Application
# X-GNOME-Autostart-enabled=true
# EOF
#
# Then restart your desktop environment or run it in the background:
#
# $ ( cbd & ) &
#
while true; do while true; do
# 240000 milliseconds / 4 minutes # 240000 milliseconds / 4 minutes
......
#!/bin/bash
# sctd -- change the screen temperature color along the day with sct
#
# See <https://iristech.co/what-is-the-best-color-temperature/>.
#
SCTD_TEMP_TABLE=(
2800 # 00h00
2800
2800
2800
2800
3000 # 05h00
5000 # 06h00
5000
5000
5000
5000
5000
5000 # 12h00
5000
5000
5000
5000
5000
4000 # 18h00
4000
3000 # 20h00
3000
3000
3000 # 23h00
2800 # 24h00
)
while true; do
now=$(date +"%H")
ind=$((now + 1))
val=${SCTD_TEMP_TABLE[$ind]}
sct "$val" && echo "i:$ind v:$val"
sleep 240
done
#!/bin/bash
SCREEN_WIDTH=$(xdpyinfo | awk '/dimensions/{print $2}' | cut -dx -f1)
SCREEN_HEIGHT=$(xdpyinfo | awk '/dimensions/{print $2}' | cut -dx -f2)
LOCKSCREEN_IMAGE="$HOME/.cache/lockscreen-${SCREEN_WIDTH}x${SCREEN_HEIGHT}.png"
I3LOCK_ARGS=(--nofork --no-unlock-indicator --ignore-empty-password)
# don't lock the screen if ~/.caffeine was modified in the last two hours
test "$(find ~/.caffeine -mmin -120 2>/dev/null)" && exit 0
if [ -e "$LOCKSCREEN_IMAGE" ]; then
I3LOCK_ARGS+=("--image=$LOCKSCREEN_IMAGE")
elif [ -e "$HOME/etc/wallpaper" ]; then
convert "$HOME/etc/wallpaper" \
-resize "${SCREEN_WIDTH}x${SCREEN_HEIGHT}" "$LOCKSCREEN_IMAGE"
I3LOCK_ARGS+=("--image=$LOCKSCREEN_IMAGE")
fi
i3lock "${I3LOCK_ARGS[@]}"
#!/bin/bash
find -L ~ -type f -not -path '*/\.*' \( -iname "*.png" -o -iname "*.jpg" \) -mtime -10 \
| xargs -d\\n ls -t \
| exec sxiv -b -g 1300x700 -
#!/bin/bash
MESSAGE=${*:-?}
FONT_SIZE=64
FONT_NAME="Monoid-${FONT_SIZE}"
#SCREEN_WIDTH=$(xdpyinfo | awk '/dimensions/{print $2}' | cut -dx -f1)
SCREEN_HEIGHT=$(xdpyinfo | awk '/dimensions/{print $2}' | cut -dx -f2)
( echo "$MESSAGE" ; sleep 0.5 ) | dzen2 -bg "#14141E" -fn "$FONT_NAME" -ta c -h "$SCREEN_HEIGHT"
#!/bin/bash
# Invoke X clients and the session manager
#
# NOTE This file must have executable permissions
#
# See Xsession(5) for more information.
#
_X_WALLPAPER="${X_WALLPAPER:-#222222}" # set to file or solid color
# turn off display after 8 minutes of inactivity
xset dpms 480 480 480
# auto lock screen after 8 minutes of inactivity
xautolock -secure -time 8 -locker xlock &
# start system's default terminal emulator
x-terminal-emulator &
# start the hotkey daemon (see ~/.config/sxhkd/sxhkdrc)
sxhkd &
#pkill -USR1 -x sxhkd || sxhkd &
# screen color temperature daemon
sctd &
#setsid sctd >/dev/null 2>&1 < /dev/null &
# set wallpaper and cursor
xsetroot -cursor_name left_ptr
if [ -f "$_X_WALLPAPER" ]; then
hsetroot -fill "$X_WALLPAPER"
else
hsetroot -solid "$X_WALLPAPER"
fi
exec /usr/bin/bspwm
# -*- mode: shell-script -*-
# Locales and global environment variables for the X session
#
# NOTE This file must be POSIX compliant
#
# See Xsession(5) for more information.
#
# shellcheck source=/dev/null
[ -f "$HOME/.profile" ] && . "$HOME/.profile"
# shellcheck source=/dev/null
[ -f "$HOME/etc/xlocalrc" ] && . "$HOME/etc/xlocalrc"
[Desktop Entry]
Name=cbd
Exec=cbd
Terminal=false
Type=Application
X-GNOME-Autostart-enabled=true
[Desktop Entry]
Name=syncmaild
Exec=syncmaild
Terminal=false
Type=Application
X-GNOME-Autostart-enabled=true
#!/bin/sh
while true; do
# sync mail boxes
mbsync --quiet --all
# index mail boxes (i.e. update MU database)
mu index --quiet --maildir=~/mail
sleep 600 && echo Plop!
done
# ~/.profile: executed by the command interpreter for login shells. # Executed by the command interpreter for login shells
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login #
# exists. # NOTE This file must be POSIX compliant
# #
# For Zsh sessions add the following lines in your ~/.zprofile, so you # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists. For Zsh sessions add the following line in your ~/.zprofile, so you
# can share this initialization file between Bash and Zsh: # can share this initialization file between Bash and Zsh:
# #
# emulate sh -c 'source ~/.profile' # emulate sh -c 'source ~/.profile'
# #
#
# shellcheck source=/dev/null
[ -f "$HOME/etc/local.sh" ] && . "$HOME/etc/local.sh"
umask 022 umask 022
...@@ -42,6 +39,9 @@ MANWIDTH=88 ...@@ -42,6 +39,9 @@ MANWIDTH=88
export PATH GOPATH VERSION_CONTROL MANWIDTH export PATH GOPATH VERSION_CONTROL MANWIDTH
export PIPENV_COLORBLIND PIPENV_NOSPIN PIPENV_SHELL_FANCY PIPENV_VENV_IN_PROJECT export PIPENV_COLORBLIND PIPENV_NOSPIN PIPENV_SHELL_FANCY PIPENV_VENV_IN_PROJECT
# shellcheck source=/dev/null
[ -f "$HOME/etc/localrc" ] && . "$HOME/etc/localrc"
# link gpg-agent to the connected terminal (manpage gpg-agent(1)) # link gpg-agent to the connected terminal (manpage gpg-agent(1))
_set_gpg_tty () { _set_gpg_tty () {
...@@ -63,6 +63,8 @@ _set_ssh_agent () { ...@@ -63,6 +63,8 @@ _set_ssh_agent () {
if [ -n "$BASH_VERSION" ]; then if [ -n "$BASH_VERSION" ]; then
_set_gpg_tty _set_gpg_tty
_set_ssh_agent _set_ssh_agent
# shellcheck source=/dev/null
[ -f ~/.bashrc ] && . ~/.bashrc [ -f ~/.bashrc ] && . ~/.bashrc
fi fi
...@@ -75,4 +77,3 @@ if [ -n "$ZSH_VERSION" ]; then ...@@ -75,4 +77,3 @@ if [ -n "$ZSH_VERSION" ]; then
# are login shells or not, we don't need load ~/.zshrc here # are login shells or not, we don't need load ~/.zshrc here
: :
fi fi
if [ -f ~/.profile ]; then
. ~/.profile
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment