dtfscript: Move to dedicated folder

This commit is contained in:
2018-09-27 20:48:37 -05:00
parent 28817a4542
commit df9bf53a9d
20 changed files with 7 additions and 7 deletions

60
.dtfscripts/tasks/bspwm.sh Executable file
View File

@@ -0,0 +1,60 @@
#! /bin/bash
#
# bspwm.sh
# Copyright (C) 2018 salt <salt@lap-th-e560-0>
#
# Distributed under terms of the MIT license.
#
if ! pgrep bspwm > /dev/null 2>&1; then
tsk_log "Not under bspwm" 1
exit 1
fi
tsk_log "Configuring bspwm miscellanea"
## Behavior
tsk_log "Configuring behavior" 0
# Tiling behavior
bspc config split_ratio 0.50
bspc config remove_disabled_monitors false
bspc config remove_unplugged_monitors true
# Pointer behavior
bspc config click_to_focus any
bspc config pointer_follows_focus false
bspc config pointer_follows_monitor true
bspc config pointer_modifier mod1
bspc config pointer_action1 move #LMB
bspc config pointer_action2 resize_corner #RMB
## Looks
tsk_log "Configuring looks" 0
# Padding
bspc config border_width ${BSPWM_BORDER_WIDTH:-2}
bspc config window_gap ${BSPWM_WINDOW_GAP:-8}
bspc config single_monocle false
bspc config borderless_monocle false
bspc config gapless_monocle true
# Colors
bspc config normal_border_color "#3c3836" #Unfocused
bspc config active_border_color "#458588" #Focused, but current monitor isn't
bspc config focused_border_color "#83a598" #Focused completely
bspc config presel_feedback_color "#9b9b9b" #???
tsk_log "Setting window rules" 0
bspc rule -r '*'
bspc rule -a Firefox desktop=1
bspc rule -a Firefox-esr desktop=1
bspc rule -a Waterfox desktop=1
bspc rule -a discord desktop=7
bspc rule -a spotify desktop=8
bspc rule -a 'Minecraft 1.7.10' state=fullscreen
# For fullscreen Wine
bspc rule -a explorer.exe state=fullscreen
# Plasma rules
bspc rule -a plasmashell state=floating sticky=on border=off
bspc rule -a krunner state=floating layer=above sticky=on border=off
# Widgets
bspc rule -a Conky state=floating layer=below sticky=on
bspc rule -a pavucontrol-qt state=floating layer=above sticky=on

View File

@@ -0,0 +1,80 @@
#! /bin/bash
#
# monitorset.sh
# Copyright (C) 2018 salt <salt@dsk-cstm-0>
#
# Distributed under terms of the MIT license.
#
if ! pgrep bspwm > /dev/null 2>&1; then
tsk_log "Not under bspwm" 1
exit 1
fi
monitor_primary=$(xrandr -q | awk '/primary/{print $1}')
monitors_secondary=($(xrandr -q | grep ' connected' | grep -v 'primary' | awk '{print $1}'))
desktops_total=${BSPWM_DESKTOPS_TOTAL:-8}
desktops_primary=${BSPWM_DESKTOPS_PRIMARY:-6}
desktops_secondary=$(($desktops_total - $desktops_primary))
# Sanity checks
if ! [[ "$desktops_total" -ge 1 ]]; then
tsk_log "desktops_total cannot be $desktops_total, defaulting to 8" 0
desktops_total=8
fi
if ! [[ "$desktops_primary" -ge 1 ]]; then
tsk_log "desktops_primary cannot be $desktops_primary, defaulting to 6" 0
desktops_primary=6
fi
# Do we have enough desktops for all monitors?
# We can correct this without defaulting, so don't error
if [[ $desktops_secondary -lt ${#monitors_secondary[@]} ]]; then
tsk_log "Configuration would leave some monitors without desktops; adding more" 0
desktops_secondary=${#monitors_secondary[@]}
desktops_total=$(($desktops_secondary + $desktops_primary))
deskpermon=1
tsk_log "Remaining desktops set to $desktops_secondary, highest desktop is now $desktops_total" 0
fi
# Can we actually reach all of these desktops via keybinds?
if [[ $desktops_total -gt 10 ]]; then
tsk_log "More than ten desktops were allocated! Not all of these can be reached via keybinds!" 0
if [[ $(($desktops_total - $desktops_secondary)) -gt 0 ]]; then
tsk_log "Adjusting primary desktop reservation" 0
desktops_primary=$(($desktops_total - $desktops_secondary))
tsk_log "Set reserved desktops to $desktops_primary" 0
else
tsk_log "Cannot resolve this situation without starving the primary monitor of desktops!" 1
tsk_log "This may result in desktops being allocated that cannot be easily accessed!" 1
fi
fi
# The code that actually sets the monitors up
# First, do we actually have any secondaries?
if [[ $(echo ${monitors_secondary:-0}) == "0" ]]; then
# We only have one monitor, so give it everything
layout=$(seq --separator=" " 1 $desktops_total)
tsk_log "Found one monitor: $monitor_primary, so giving it layout \"$layout\""
bspc monitor $monitor_primary -d $layout
else
deskpermon=$(($desktops_secondary / ${#monitors_secondary[@]}))
layout=$(seq --separator=" " 1 $desktops_primary)
tsk_log "Giving primary monitor $monitor_primary layout \"$layout\""
bspc monitor $monitor_primary -d $layout
unset layout
tsk_log "Attempting to put $desktops_secondary desktops across ${#monitors_secondary[@]} monitors, $deskpermon each" 0
for m in $(seq 0 $((${#monitors_secondary[@]} - 1))); do
layout=$(seq --separator=" " $((1 + $m + $desktops_primary)) ${#monitors_secondary[@]} "$desktops_total")
tsk_log "Giving monitor $m (${monitors_secondary[$m]}) layout \"$layout\""
bspc monitor ${monitors_secondary[$m]} -d $layout
done
fi
unset monitor_primary
unset monitors_secondary
unset desktops_total
unset desktops_primary
unset desktops_secondary

View File

@@ -0,0 +1,20 @@
#! /bin/sh
if ! pgrep krunner > /dev/null 2>&1; then
exit 0
fi
killall krunner
for i in {1..100}; do
if ! pgrep krunner; then break ;fi
sleep 0.01
if (( $i > 99 )); then
killall -9 krunner
fi
done
if pgrep krunner > /dev/null 2>&1; then
tsk_log "Failed to kill krunner" 1
exit 1
else
tsk_log "Killed krunner"
exit 0
fi

14
.dtfscripts/tasks/xrdbupdate.sh Executable file
View File

@@ -0,0 +1,14 @@
#! /bin/sh
if [ -r ~/.Xresources ]; then
tsk_log "Loading .Xresources"
xrdb ~/.Xresources
fi
for file in $XDG_CONFIG_HOME/xrdb/*.xresources; do
if ! [ -r "$file" ]; then
tsk_log "Could not read file \"$file\"" 1
else
tsk_log "Merging in file \"$file\""
xrdb -merge "$file"
fi
done

11
.dtfscripts/tasks/xset.sh Executable file
View File

@@ -0,0 +1,11 @@
#! /bin/sh
#
# xset.sh
# Copyright (C) 2018 salt <salt@lap-th-e560-0>
#
# Distributed under terms of the MIT license.
#
tsk_log "Disabling bell"
xset -b