From 8f593190272a7b48391be01c7ce7395b9c965bd8 Mon Sep 17 00:00:00 2001 From: Ryan Kes <> Date: Tue, 1 Dec 2020 20:02:19 +0100 Subject: [PATCH] feat: refactored x config --- bspwm/.config/bspwm/bspwmrc | 5 +- dwm/.local/share/dwm/autostart.sh | 97 +++++++++++++++++++ polybar/.config/polybar/bin/mailcount | 6 +- polybar/.config/polybar/config | 87 ++++++++++++----- sxhkd/.config/sxhkd/sxhkdrc | 3 +- {bspwm => x}/.config/X11/.Xresources.desktop | 0 {bspwm => x}/.config/X11/.Xresources.thinkpad | 0 x/.config/X11/xinitrc | 3 + .../.config/X11/xinitrc => x/.local/bin/lock | 2 +- 9 files changed, 169 insertions(+), 34 deletions(-) create mode 100755 dwm/.local/share/dwm/autostart.sh rename {bspwm => x}/.config/X11/.Xresources.desktop (100%) rename {bspwm => x}/.config/X11/.Xresources.thinkpad (100%) create mode 100755 x/.config/X11/xinitrc rename bspwm/.config/X11/xinitrc => x/.local/bin/lock (54%) diff --git a/bspwm/.config/bspwm/bspwmrc b/bspwm/.config/bspwm/bspwmrc index b12ccbb..aaf319d 100755 --- a/bspwm/.config/bspwm/bspwmrc +++ b/bspwm/.config/bspwm/bspwmrc @@ -137,9 +137,8 @@ pkill -f cleanfullscreen ###---System lock---### pkill -f xss-lock -xss-lock -n ~/.local/bin/lock -- ~/.local/bin/lock & -pkill -f xautolock -xautolock -time 10 -locker ~/.local/bin/lock & +xset s 300 5 +xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock ###---Misc---### # Needed for Jetbrains products to work diff --git a/dwm/.local/share/dwm/autostart.sh b/dwm/.local/share/dwm/autostart.sh new file mode 100755 index 0000000..4e71fab --- /dev/null +++ b/dwm/.local/share/dwm/autostart.sh @@ -0,0 +1,97 @@ +#!/bin/sh + +###---Start app if not running already---### +start_if_not_running() { + ###---iceweasel/firefox is weird---### + if [ "$1" = "iceweasel" ]; then + PROCESS_NAME="iceweasel|MainThread" + elif [ "$1" = "element-desktop-nightly" ]; then + PROCESS_NAME="element-desktop" + else + PROCESS_NAME=$1 + fi + + if [ "$(pgrep -u "$(id -u)" -x "$PROCESS_NAME" | wc -l)" -lt 1 ]; then + if command -v "$1"; then + eval "$1 &" + fi + fi +} + +###---Start app in alacritty if not running already---### +start_shell_if_not_running() { + if [ "$(pgrep -u "$(id -u)" -x "$1" | wc -l)" -lt 1 ]; then + if command -v "$1"; then + eval "st -c $1 -e $1 &" + fi + fi +} + +# Set screen orientation if second monitor is connected +SCREENCOUNT=$(xrandr | grep -c "\*") + +# If multi screen add special mode for monitor so it supports 1440p over HDMI +if [ "$SCREENCOUNT" -eq 2 ]; then + if [ -f "$HOME/.local/bin/screen_desktop" ]; then + screen_desktop & + # Make sure mouse is on main screen so windows are launched there + xdotool mousemove 3360 1080 & + fi +else + if [ -f "$HOME/.local/bin/screen" ]; then + screen & + fi +fi + +###---Set working directory---### +cd ~ || exit + +###---Load xresources---### +xrdb -load ~/.config/X11/xresources & + +###---Sxhkd---### +start_if_not_running sxhkd + +###---Keyboard---### +setxkbmap -option caps:escape & + +###---Wallpaper, colours & opacity---### +~/.local/bin/wallpaper & +wal -n -R & +picom -b & +sh ~/.cache/wal/colors.sh & + +###---Switch off microphones---### +# switch off microphones +amixer -c 2 set Mic nocap & +amixer -c 3 set Mic nocap & + +###---Autostart---### +start_if_not_running dunst +start_if_not_running unclutter +start_if_not_running nm-applet +start_if_not_running pasystray +start_if_not_running redshift-gtk +start_if_not_running syncthing-gtk +start_if_not_running caffeine + +start_if_not_running brave +start_if_not_running iceweasel +start_if_not_running firefox +start_if_not_running emacs +start_if_not_running element-desktop +start_if_not_running element-desktop-nightly + +if [ "$SCREENCOUNT" -eq 2 ]; then + start_shell_if_not_running castero + start_if_not_running slack +fi + +###---System lock---### +pkill -f xss-lock +xset s 300 5 & +env XSECURELOCK_FONT="Hack Nerd Font" xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock & + +###---Misc---### +# Needed for Jetbrains products to work +wmname LG3D & diff --git a/polybar/.config/polybar/bin/mailcount b/polybar/.config/polybar/bin/mailcount index 169fdac..e7536a0 100755 --- a/polybar/.config/polybar/bin/mailcount +++ b/polybar/.config/polybar/bin/mailcount @@ -3,13 +3,13 @@ unread="$(find ~/.local/share/mail/*/INBOX/new/* -type f 2>/dev/null | wc -l)" if [ ! "$(pgrep -x mbsync)" ]; then - icon="ī›­" + icon="đŸ“Ŧ" else - icon="ī§Ĩ" + icon="🔃" fi if [ ! "$unread" -eq 0 ]; then - echo "$icon $unread" + echo "$icon $unread" else echo "%{F#666}ī›­%{F-}" fi diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index f84e6f6..648b163 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -41,16 +41,16 @@ wm-restack = bspwm [bar/base-laptop] inherit = "bar/base" font-0 = Hack Nerd Font:pixelsize=16 -font-1 = Noto Sans Symbols2:size=16 -font-2 = Unifont Upper:size=16 -font-3 = JoyPixels:size=16 +font-1 = JoyPixels:style=Regular:scale=6;1 +font-2 = Noto Sans Symbols2:size=16 +font-3 = Unifont Upper:size=16 [bar/base-desktop] inherit = "bar/base" font-0 = Hack Nerd Font:size=10 -font-1 = Noto Sans Symbols2:size=10 -font-2 = Unifont Upper:size=10 -font-3 = JoyPixels:size=10 +font-1 = JoyPixels:style=Regular:scale=10;2 +font-2 = Noto Sans Symbols2:size=10 +font-3 = Unifont Upper:size=10 [bar/laptop-bottom] inherit = bar/base-laptop @@ -66,7 +66,7 @@ monitor = ${env:MONITOR:eDP1} modules-left = bspwm modules-center = battery0 battery1 seperator wlan wg0 wg1 bluetooth -modules-right = seperator xbacklight volume-laptop seperator docker memory cpu temperature seperator filesystem seperator updates-arch-combined mail reddit github rss seperator weather date +modules-right = seperator xbacklight volume-laptop seperator docker memory cpu-laptop temperature seperator filesystem seperator updates-arch-combined mail reddit github rss seperator weather seperator date seperator tray-position = right @@ -76,7 +76,7 @@ monitor = ${env:MONITOR:DP-1} modules-left = bspwm modules-center = mpd player-mpris-tail -modules-right = eth bluetooth seperator volume seperator docker memory cpu temperature seperator system-usb-udev filesystem seperator updates-arch-combined mail reddit github rss seperator weather date +modules-right = seperator eth bluetooth seperator volume seperator docker memory cpu temperature seperator system-usb-udev filesystem seperator updates-arch-combined mail reddit github rss seperator weather seperator date seperator tray-position = right @@ -143,7 +143,7 @@ bar-progress-empty = ─ type = internal/xbacklight format =