1
0
mirror of https://github.com/alrayyes/dotfiles/ synced 2023-11-14 15:56:30 +00:00

feat: refactored x config

This commit is contained in:
Ryan Kes 2020-12-01 20:02:19 +01:00
parent 5c4f606b3b
commit 8f59319027
9 changed files with 169 additions and 34 deletions

View File

@ -137,9 +137,8 @@ pkill -f cleanfullscreen
###---System lock---### ###---System lock---###
pkill -f xss-lock pkill -f xss-lock
xss-lock -n ~/.local/bin/lock -- ~/.local/bin/lock & xset s 300 5
pkill -f xautolock xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock
xautolock -time 10 -locker ~/.local/bin/lock &
###---Misc---### ###---Misc---###
# Needed for Jetbrains products to work # Needed for Jetbrains products to work

View File

@ -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 &

View File

@ -3,13 +3,13 @@
unread="$(find ~/.local/share/mail/*/INBOX/new/* -type f 2>/dev/null | wc -l)" unread="$(find ~/.local/share/mail/*/INBOX/new/* -type f 2>/dev/null | wc -l)"
if [ ! "$(pgrep -x mbsync)" ]; then if [ ! "$(pgrep -x mbsync)" ]; then
icon="" icon="📬"
else else
icon="痢" icon="🔃"
fi fi
if [ ! "$unread" -eq 0 ]; then if [ ! "$unread" -eq 0 ]; then
echo "$icon $unread" echo "$icon $unread"
else else
echo "%{F#666}%{F-}" echo "%{F#666}%{F-}"
fi fi

View File

@ -41,16 +41,16 @@ wm-restack = bspwm
[bar/base-laptop] [bar/base-laptop]
inherit = "bar/base" inherit = "bar/base"
font-0 = Hack Nerd Font:pixelsize=16 font-0 = Hack Nerd Font:pixelsize=16
font-1 = Noto Sans Symbols2:size=16 font-1 = JoyPixels:style=Regular:scale=6;1
font-2 = Unifont Upper:size=16 font-2 = Noto Sans Symbols2:size=16
font-3 = JoyPixels:size=16 font-3 = Unifont Upper:size=16
[bar/base-desktop] [bar/base-desktop]
inherit = "bar/base" inherit = "bar/base"
font-0 = Hack Nerd Font:size=10 font-0 = Hack Nerd Font:size=10
font-1 = Noto Sans Symbols2:size=10 font-1 = JoyPixels:style=Regular:scale=10;2
font-2 = Unifont Upper:size=10 font-2 = Noto Sans Symbols2:size=10
font-3 = JoyPixels:size=10 font-3 = Unifont Upper:size=10
[bar/laptop-bottom] [bar/laptop-bottom]
inherit = bar/base-laptop inherit = bar/base-laptop
@ -66,7 +66,7 @@ monitor = ${env:MONITOR:eDP1}
modules-left = bspwm modules-left = bspwm
modules-center = battery0 battery1 seperator wlan wg0 wg1 bluetooth 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 tray-position = right
@ -76,7 +76,7 @@ monitor = ${env:MONITOR:DP-1}
modules-left = bspwm modules-left = bspwm
modules-center = mpd player-mpris-tail 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 tray-position = right
@ -143,7 +143,7 @@ bar-progress-empty = ─
type = internal/xbacklight type = internal/xbacklight
format = <label> format = <label>
label = %percentage%% label = 💡 %percentage%%
bar-width = 10 bar-width = 10
bar-indicator = | bar-indicator = |
@ -156,11 +156,27 @@ bar-empty = ─
bar-empty-font = 2 bar-empty-font = 2
bar-empty-foreground = ${colors.foreground-alt} bar-empty-foreground = ${colors.foreground-alt}
[module/cpu-laptop]
type = internal/cpu
format = <label> <ramp-load>
format-prefix = "💻 "
label =
ramp-load-0 = ▁
ramp-load-1 = ▂
ramp-load-2 = ▃
ramp-load-3 = ▄
ramp-load-4 = ▅
ramp-load-5 = ▆
ramp-load-6 = ▇
ramp-load-7 = █
[module/cpu] [module/cpu]
type = internal/cpu type = internal/cpu
format = <label> <ramp-coreload> format = <label> <ramp-coreload>
format-prefix = " " format-prefix = "💻 "
label = %percentage%% label = %percentage%%
@ -194,24 +210,35 @@ type = internal/network
interface = wlp4s0 interface = wlp4s0
interval = 3.0 interval = 3.0
format-connected = <label-connected> format-connected = <ramp-signal>
format-packetloss = <animation-packetloss> <label-connected> format-packetloss = <animation-packetloss> <label-connected>
format-disconnected = format-disconnected =
format-connected-prefix = " " format-connected-prefix = " "
format-disconnected-prefix = "睊 " format-disconnected-prefix = "睊"
label-connected = " %downspeed%  %upspeed%" label-connected = " %downspeed%  %upspeed%"
label-disconnected = label-disconnected =
ramp-signal-0 = ▁
ramp-signal-1 = ▂
ramp-signal-2 = ▃
ramp-signal-3 = ▄
ramp-signal-4 = ▅
ramp-signal-5 = ▆
ramp-signal-6 = ▇
ramp-signal-7 = █
animation-packetloss-0 = ⚠ animation-packetloss-0 = ⚠
animation-packetloss-0-foreground = #ffa64c
animation-packetloss-1 = 📶 animation-packetloss-1 = 📶
animation-packetloss-1-foreground = #000000
animation-packetloss-framerate = 500 animation-packetloss-framerate = 500
[module/eth] [module/eth]
type = internal/network type = internal/network
interface = eno1 interface = eno1
format-connected-prefix = " " format-connected-prefix = " "
format-disconnected-prefix = " " format-disconnected-prefix = " "
label-connected = "%local_ip%  %downspeed%  %upspeed%" label-connected = "%local_ip%  %downspeed%  %upspeed%"
@ -223,7 +250,7 @@ date-alt = " %d-%m-%Y"
time = "%H:%M" time = "%H:%M"
time-alt = time-alt =
format-prefix = format-prefix = 📅
label = %date% %time% label = %date% %time%
label-padding-right=1 label-padding-right=1
@ -232,22 +259,32 @@ label-padding-right=1
type = internal/pulseaudio type = internal/pulseaudio
sink = alsa_output.pci-0000_00_1b.0.iec958-stereo sink = alsa_output.pci-0000_00_1b.0.iec958-stereo
label-volume = 蓼 %percentage%% format-volume = <ramp-volume>
label-muted = "遼"
label-muted-foreground = ${colors.disabled} label-muted = 🔇 muted
label-muted-foreground = #666
click-right = setsid alacritty --class=float,float -e pulsemixer click-right = setsid alacritty --class=float,float -e pulsemixer
ramp-volume-0 = 🔈
ramp-volume-1 = 🔉
ramp-volume-2 = 🔊
[module/volume-laptop] [module/volume-laptop]
type = internal/pulseaudio type = internal/pulseaudio
sink = alsa_output.pci-0000_00_1f.3.analog-stereo sink = alsa_output.pci-0000_00_1f.3.analog-stereo
label-volume = 蓼 %percentage%% format-volume = <ramp-volume>
label-muted = "遼"
label-muted-foreground = ${colors.disabled}
click-right = setsid alacritty --class=float,float -e pulsemixer click-right = setsid alacritty --class=float,float -e pulsemixer
label-muted = 🔇 muted
label-muted-foreground = #666
ramp-volume-0 = 🔈
ramp-volume-1 = 🔉
ramp-volume-2 = 🔊
[module/battery0] [module/battery0]
type = internal/battery type = internal/battery
battery = BAT0 battery = BAT0
@ -281,7 +318,7 @@ full-at = 70
format-charging = <animation-charging> <label-charging> format-charging = <animation-charging> <label-charging>
format-discharging = <animation-discharging> <label-discharging> format-discharging = <animation-discharging> <label-discharging>
format-full-prefix = " " format-full-prefix = "🔋 "
format-full-prefix-foreground = ${colors.foreground-alt} format-full-prefix-foreground = ${colors.foreground-alt}
animation-charging-0 =  animation-charging-0 = 
@ -301,7 +338,7 @@ animation-discharging-framerate = 5000
[module/temperature] [module/temperature]
type = internal/temperature type = internal/temperature
format-prefix = " " format-prefix = "🌡 "
label-warn-foreground = ${colors.alert} label-warn-foreground = ${colors.alert}
@ -328,7 +365,7 @@ format-prefix = " "
[module/player-mpris-tail] [module/player-mpris-tail]
type = custom/script type = custom/script
exec = python ~/.local/share/polybar-scripts/polybar-scripts/player-mpris-tail/player-mpris-tail.py -f '{:title: {icon} {artist} - {title}:}' --icon-playing '' --icon-paused '' --icon-stop '栗' exec = python ~/.local/share/polybar-scripts/polybar-scripts/player-mpris-tail/player-mpris-tail.py -f '{:title: {icon} {artist} - {title}:}' --icon-playing '' --icon-paused '' --icon-stop '栗'
tail = true tail = true
click-left = python ~/.local/share/polybar-scripts/polybar-scripts/player-mpris-tail/player-mpris-tail.py previous & click-left = python ~/.local/share/polybar-scripts/polybar-scripts/player-mpris-tail/player-mpris-tail.py previous &
@ -366,7 +403,7 @@ type = custom/script
exec = ~/.config/polybar/bin/notification-reddit.sh exec = ~/.config/polybar/bin/notification-reddit.sh
interval = 300 interval = 300
label = %output% label = %output%
click-left = brave https://www.reddit.com/message/unread click-left = brave https://www.reddit.com/message/unread

View File

@ -47,7 +47,6 @@ XF86MonBrightnessUp
~/.local/bin/brightness inc ~/.local/bin/brightness inc
XF86MonBrightnessDown XF86MonBrightnessDown
~/.local/bin/brightness dec ~/.local/bin/brightness dec
# Shutdown / reboot # Shutdown / reboot
XF86Eject XF86Eject
prompt "Shutdown computer?" "sudo -A shutdown -h now" prompt "Shutdown computer?" "sudo -A shutdown -h now"
@ -66,7 +65,7 @@ Print
#-----------------------------------------------------------App shortcuts-------------------------------------------------------------- #-----------------------------------------------------------App shortcuts--------------------------------------------------------------
# terminal emulator # terminal emulator
super + Return super + Return
alacritty st
# program launcher # program launcher
super + @space super + @space

3
x/.config/X11/xinitrc Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
exec dwm

View File

@ -1,3 +1,3 @@
#!/usr/bin/env sh #!/usr/bin/env sh
exec bspwm xset s activate