dtfscripts: Rename to concession
Ha ha
This commit is contained in:
		
							
								
								
									
										87
									
								
								.concession/common_service.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										87
									
								
								.concession/common_service.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,87 @@ | ||||
| #! /usr/bin/env bash | ||||
| # | ||||
| # wmstartup service common functions | ||||
| # Copyright (C) 2018 salt <salt@lap-th-e560-0> | ||||
| # | ||||
| # Distributed under terms of the MIT license. | ||||
| # | ||||
|  | ||||
| service_name="unnamed_service" | ||||
| service_process="true" | ||||
| service_kill_on_reload="true" | ||||
| service_flags="" | ||||
|  | ||||
| # Basic logging service. Do not override unless necessary | ||||
| function svc_log() { | ||||
| 	if [ -z ${1+x} ]; then return 1; fi | ||||
| 	out=1 | ||||
| 	if ! [ -z ${2+x} ]; then out="$2"; fi | ||||
| 	col_reset="\e[0m" | ||||
| 	col_svcname="\e[94m" | ||||
| 	col_message="\e[39m" | ||||
| 	if ! [ "$out" -eq "1" ]; then col_message="\e[31m"; fi | ||||
| 	if [ "$out" -eq "0" ]; then | ||||
| 		out=1 | ||||
| 		col_message="\e[37m" | ||||
| 	fi | ||||
| 	cnc_log "${col_svcname}${service_name}${col_reset}: ${col_message}${1}${col_reset}" >&${out} | ||||
| } | ||||
|  | ||||
| # Basic pre-start checks. Stick extra checks in prestart-extra | ||||
| function prestart() { | ||||
| 	if isup; then | ||||
| 		svc_log "Already running" 0 | ||||
| 		return 1 | ||||
| 	fi | ||||
| 	if ! which $service_process > /dev/null 2>&1; then | ||||
| 		svc_log "Could not find associated binary: \"${service_process}\"" 2 | ||||
| 		return 1 | ||||
| 	fi | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| # Template function. If it fails, the service will not be started | ||||
| function prestart-extra() { | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| # Basic start function. Override if you have special startup functionality | ||||
| function start() { | ||||
| 	svc_log "Starting" | ||||
| 	$service_process $service_flags > /dev/null 2>&1 & | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| # Template function. Override for post-startup tasks | ||||
| # Can also be used for blocking | ||||
| function start-extra() { | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| # Basic stop function. Kills the task and implements a SIGKILL timer | ||||
| function stop() { | ||||
| 	svc_log "Stopping" | ||||
| 	killall $service_process & | ||||
| 	for i in {1..100}; do | ||||
| 		if ! isup; then break; fi | ||||
| 		sleep 0.01 | ||||
| 		if (( $i > 99 )); then | ||||
| 			svc_log "Stopping with prejudice" | ||||
| 			killall -9 $service_process | ||||
| 		fi | ||||
| 	done | ||||
| 	return $? | ||||
| } | ||||
|  | ||||
| # Basic process detection function. Returns 0 if the process exists. | ||||
| function isup() { | ||||
| 	pgrep "$service_process" > /dev/null 2>&1 | ||||
| 	isup-extra $? | ||||
| 	return $? | ||||
| } | ||||
|  | ||||
| # Template function. Gets passed the result of a simple pgrep for the process | ||||
| function isup-extra() { | ||||
| 	return $1 | ||||
| } | ||||
|  | ||||
							
								
								
									
										24
									
								
								.concession/common_task.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										24
									
								
								.concession/common_task.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| #! /usr/bin/env bash | ||||
| # | ||||
| # wmstartup service common functions | ||||
| # Copyright (C) 2018 salt <salt@lap-th-e560-0> | ||||
| # | ||||
| # Distributed under terms of the MIT license. | ||||
| # | ||||
|  | ||||
| # Basic logging service. Do not override unless necessary | ||||
| function tsk_log() { | ||||
| 	if [ -z ${1+x} ]; then return 1; fi | ||||
| 	out=1 | ||||
| 	if ! [ -z ${2+x} ]; then out="$2"; fi | ||||
| 	col_reset="\e[0m" | ||||
| 	col_tskname="\e[96m" | ||||
| 	col_message="\e[39m" | ||||
| 	if ! [ "$out" -eq "1" ]; then col_message="\e[31m"; fi | ||||
| 	if [ "$out" -eq "0" ]; then | ||||
| 		out=1 | ||||
| 		col_message="\e[37m" | ||||
| 	fi | ||||
| 	cnc_log "${col_tskname}${task}${col_reset}: ${col_message}${1}${col_reset}" >&${out} | ||||
| } | ||||
|  | ||||
							
								
								
									
										160
									
								
								.concession/concede
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										160
									
								
								.concession/concede
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,160 @@ | ||||
| #!/usr/bin/env bash | ||||
|  | ||||
| # Copyright (c) 2018 rehashedsalt/vintagesalt | ||||
| #  | ||||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
| # of this software and associated documentation files (the "Software"), to deal | ||||
| # in the Software without restriction, including without limitation the rights | ||||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
| # copies of the Software, and to permit persons to whom the Software is | ||||
| # furnished to do so, subject to the following conditions: | ||||
| #  | ||||
| # The above copyright notice and this permission notice shall be included in all | ||||
| # copies or substantial portions of the Software. | ||||
| #  | ||||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
| # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
| # SOFTWARE. | ||||
|  | ||||
| ## Clean up some variables | ||||
| # General | ||||
| unset TERMINAL | ||||
| # Specific to these dtfscripts | ||||
| unset CNC_SERVICES | ||||
| unset CNC_TASKS | ||||
| # Polybar | ||||
| unset PB_MONITOR | ||||
| unset PB_WM_RESTACK | ||||
| unset PB_BAR_PRIMARY_MODULES_LEFT PB_BAR_PRIMARY_MODULES_CENTER PB_BAR_PRIMARY_MODULES_RIGHT | ||||
| unset PB_BAR_PRIMARY_2_MODULES_LEFT PB_BAR_PRIMARY_2_MODULES_CENTER PB_BAR_PRIMARY_2_MODULES_RIGHT | ||||
| unset PB_BAR_SECONDARY_MODULES_LEFT PB_BAR_SECONDARY_MODULES_CENTER PB_BAR_SECONDARY_MODULES_RIGHT | ||||
| unset PB_BAR_SECONDARY_2_MODULES_LEFT PB_BAR_SECONDARY_2_MODULES_CENTER PB_BAR_SECONDARY_2_MODULES_RIGHT | ||||
| unset PB_MODULE_BAR_WIDTH | ||||
| unset PB_MODULE_ETH_INTERFACE | ||||
| unset PB_MODULE_WLAN_INTERFACE | ||||
| # bspwm monitorset.sh | ||||
| unset BSPWM_BORDER_WIDTH | ||||
| unset BSPWM_DESKTOPS_TOTAL | ||||
| unset BSPWM_DESKTOPS_PRIMARY | ||||
| unset BSPWM_WINDOW_GAP | ||||
|  | ||||
| function cnc_log() { | ||||
| 	name="$(basename $0 .sh)" | ||||
| 	if [ -z ${1+x} ]; then return 1; fi | ||||
| 	printf "$name: $1\n" | ||||
| } | ||||
|  | ||||
| ## Patch some directories | ||||
| if [[ "$PATH" != *"$HOME/.local/bin"* ]]; then | ||||
| 	cnc_log "Patching path for $HOME/.local/bin" | ||||
| 	export PATH="$HOME/.local/bin:$PATH" | ||||
| fi | ||||
| if [[ "$XDG_CONFIG_HOME" == "" ]]; then | ||||
| 	cnc_log "Correcting configuration directory" | ||||
| 	export XDG_CONFIG_HOME="$HOME/.config" | ||||
| fi | ||||
| if [[ "$XDG_RUNTIME_DIR" == "" ]]; then | ||||
| 	cnc_log "Correcting runtime directory" | ||||
| 	export XDG_RUNTIME_DIR="/run/user/$UID" | ||||
| fi | ||||
|  | ||||
| ## Set some more variables | ||||
| export CNC_HOME="$HOME/.concession" | ||||
| export CNC_DEVICES_DIR="$CNC_HOME/devices" | ||||
| export CNC_SERVICES_DIR="$CNC_HOME/services" | ||||
| export CNC_TASKS_DIR="$CNC_HOME/tasks" | ||||
|  | ||||
| ## Load device-specific scripts | ||||
| if [[ -x "$CNC_DEVICES_DIR/$(hostname).rc" ]]; then | ||||
| 	cnc_log "Found device-specific config for $(hostname)" | ||||
| 	source "$CNC_DEVICES_DIR/$(hostname).rc" | ||||
| fi | ||||
|  | ||||
| ## Determine which tasks to run | ||||
| # If CNC_TASKS is set, use that | ||||
| # Otherwise, run everything | ||||
| if [[ "$CNC_TASKS" == "" ]]; then | ||||
| 	cnc_log "Performing all tasks" | ||||
| 	for task in $CNC_TASKS_DIR/*; do | ||||
| 		export CNC_TASKS="$CNC_TASKS $(basename "$task")" | ||||
| 	done | ||||
| else | ||||
| 	cnc_log "Performing a subset of all tasks" | ||||
| fi | ||||
|  | ||||
| ## Define (and export) a task run function | ||||
| function cnc_task_run() { | ||||
| 	[ -z ${1+x} ] && return 1 | ||||
| 	task_full="$CNC_TASKS_DIR/$1" | ||||
| 	( | ||||
| 	if ! [ -r "$task_full" ]; then | ||||
| 		cnc_log "Task is unreadable or missing: $task" | ||||
| 		exit 1 | ||||
| 	fi | ||||
| 	if ! [ -x "$task_full" ]; then | ||||
| 		cnc_log "Task is unexecutable: $task" | ||||
| 		exit 1 | ||||
| 	fi | ||||
| 	source "$CNC_HOME/common_task.sh" | ||||
| 	source "$task_full" | ||||
| 	) | ||||
| } | ||||
| export -f cnc_task_run | ||||
|  | ||||
| ## Run tasks | ||||
| for task in $CNC_TASKS; do | ||||
| 	cnc_task_run $task | ||||
| done | ||||
|  | ||||
| ## Determine which services to run | ||||
| # Same as above | ||||
| if [[ "$CNC_SERVICES" == "" ]]; then | ||||
| 	cnc_log "Starting all available services" | ||||
| 	for service in $CNC_SERVICES_DIR/*.dtf; do | ||||
| 		export CNC_SERVICES="$CNC_SERVICES $(basename "$service")" | ||||
| 	done | ||||
| else | ||||
| 	cnc_log "Starting a subset of available services" | ||||
| fi | ||||
|  | ||||
| ## Define (and export) service functions | ||||
| function cnc_service_validate() { | ||||
| 	service_full="$CNC_SERVICES_DIR/$1" | ||||
| 	if ! [ -r "$service_full" ]; then | ||||
| 		cnc_log "Service is unreadable or missing: $1" | ||||
| 		return 1 | ||||
| 	fi | ||||
| 	if ! [ -x "$service_full" ]; then | ||||
| 		cnc_log "Service is unexecutable: $1" | ||||
| 		return 1 | ||||
| 	fi | ||||
| 	return 0 | ||||
| } | ||||
| export -f cnc_service_validate | ||||
|  | ||||
| function cnc_service_start() { | ||||
| 	service_full="$CNC_SERVICES_DIR/$1" | ||||
| 	cnc_service_validate $1 || return 1 | ||||
| 	( | ||||
| 	source "$CNC_HOME/common_service.sh" | ||||
| 	source "$service_full" | ||||
| 	isup && [[ "$service_kill_on_reload" == "true" ]] && stop | ||||
| 	prestart || exit 1 | ||||
| 	prestart-extra || exit 1 | ||||
| 	start | ||||
| 	start-extra | ||||
| 	) | ||||
| } | ||||
| export -f cnc_service_start | ||||
|  | ||||
| ## Run startup scripts | ||||
| for service in $CNC_SERVICES; do | ||||
| 	cnc_service_start $service | ||||
| done | ||||
|  | ||||
| cnc_log "Finished initialization" | ||||
|  | ||||
							
								
								
									
										7
									
								
								.concession/devices/dsk-cstm-0.rc
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										7
									
								
								.concession/devices/dsk-cstm-0.rc
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| #!/bin/sh | ||||
| export TERMINAL=konsole | ||||
| export PB_MODULE_ETH_INTERFACE=eno1 | ||||
| export PB_MODULE_WLAN_INTERFACE=wlp5s0 | ||||
| export BSPWM_WINDOW_GAP=16 | ||||
| # vim:ft=sh | ||||
|  | ||||
							
								
								
									
										4
									
								
								.concession/devices/lap-th-e560-0.rc
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										4
									
								
								.concession/devices/lap-th-e560-0.rc
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| #!/bin/sh | ||||
| export TERMINAL=konsole | ||||
| # vim:ft=sh | ||||
|  | ||||
							
								
								
									
										19
									
								
								.concession/services/bspwm_sxhkd.dtf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										19
									
								
								.concession/services/bspwm_sxhkd.dtf
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| #! /usr/bin/env bash | ||||
| # | ||||
| # Simple wmstartup service | ||||
| # Copyright (C) 2018 salt <salt@lap-th-e560-0> | ||||
| # | ||||
| # Distributed under terms of the MIT license. | ||||
| # | ||||
|  | ||||
| service_name="sxhkd" | ||||
| service_process="sxhkd" | ||||
|  | ||||
| function prestart-extra() { | ||||
| 	if ! pgrep bspwm > /dev/null 2>&1; then | ||||
| 		svc_log "Not under bspwm" 2 | ||||
| 		return 1 | ||||
| 	fi | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
							
								
								
									
										19
									
								
								.concession/services/compton.dtf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										19
									
								
								.concession/services/compton.dtf
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| #! /usr/bin/env bash | ||||
| # | ||||
| # Simple wmstartup service | ||||
| # Copyright (C) 2018 salt <salt@lap-th-e560-0> | ||||
| # | ||||
| # Distributed under terms of the MIT license. | ||||
| # | ||||
|  | ||||
| service_name="Compton" | ||||
| service_process="compton" | ||||
|  | ||||
| function prestart-extra() { | ||||
| 	if [[ "$HOST" == "vm-*" ]]; then | ||||
| 		svc_log "Will not start: in a VM" 2 | ||||
| 		return 1 | ||||
| 	fi | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
							
								
								
									
										31
									
								
								.concession/services/conky.dtf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										31
									
								
								.concession/services/conky.dtf
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| #! /usr/bin/env bash | ||||
| # | ||||
| # Simple wmstartup service | ||||
| # Copyright (C) 2018 salt <salt@lap-th-e560-0> | ||||
| # | ||||
| # Distributed under terms of the MIT license. | ||||
| # | ||||
|  | ||||
| service_name="Conky" | ||||
| service_process="conky" | ||||
|  | ||||
| function start() { | ||||
| 	for file in $XDG_CONFIG_HOME/conky/*.conf; do | ||||
| 		svc_log "Starting with config $file" | ||||
| 		conky -c $file > /dev/null 2>&1 & | ||||
| 	done | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
| function start-extra() { | ||||
| 	for i in {1..100}; do | ||||
| 		if xprop -name "Conky" > /dev/null 2>&1; then break; fi | ||||
| 		sleep 0.01 | ||||
| 		if (( $i > 99 )); then | ||||
| 			svc_log "Conky may spawn behind the current desktop" 2 | ||||
| 			break | ||||
| 		fi | ||||
| 	done | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
							
								
								
									
										12
									
								
								.concession/services/dropbox.dtf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								.concession/services/dropbox.dtf
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| #! /usr/bin/env bash | ||||
| # | ||||
| # Simple wmstartup service | ||||
| # Copyright (C) 2018 salt <salt@lap-th-e560-0> | ||||
| # | ||||
| # Distributed under terms of the MIT license. | ||||
| # | ||||
|  | ||||
| service_name="Dropbox" | ||||
| service_process="dropbox" | ||||
| service_kill_on_reload="false" | ||||
|  | ||||
							
								
								
									
										11
									
								
								.concession/services/dunst.dtf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										11
									
								
								.concession/services/dunst.dtf
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| #! /usr/bin/env bash | ||||
| # | ||||
| # Simple wmstartup service | ||||
| # Copyright (C) 2018 salt <salt@lap-th-e560-0> | ||||
| # | ||||
| # Distributed under terms of the MIT license. | ||||
| # | ||||
|  | ||||
| service_name="Dunst" | ||||
| service_process="dunst" | ||||
|  | ||||
							
								
								
									
										11
									
								
								.concession/services/plasmashell.dtf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										11
									
								
								.concession/services/plasmashell.dtf
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| #! /usr/bin/env bash | ||||
| # | ||||
| # Simple wmstartup service | ||||
| # Copyright (C) 2018 salt <salt@lap-th-e560-0> | ||||
| # | ||||
| # Distributed under terms of the MIT license. | ||||
| # | ||||
|  | ||||
| service_name="Plasma" | ||||
| service_process="plasmashell" | ||||
|  | ||||
							
								
								
									
										39
									
								
								.concession/services/polybar.dtf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										39
									
								
								.concession/services/polybar.dtf
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,39 @@ | ||||
| #! /usr/bin/env bash | ||||
| # | ||||
| # Simple wmstartup service | ||||
| # Copyright (C) 2018 salt <salt@lap-th-e560-0> | ||||
| # | ||||
| # Distributed under terms of the MIT license. | ||||
| # | ||||
|  | ||||
| service_name="Polybar" | ||||
| service_process="polybar" | ||||
|  | ||||
| function start() { | ||||
| 	# Set some variables, if necessary | ||||
| 	if [[ "$PB_BAR_BORDER_SIZE" == "" ]] && pgrep bspwm > /dev/null 2>&1; then | ||||
| 		if ! [[ "$BSPWM_WINDOW_GAP" == "" ]]; then | ||||
| 			svc_log "Inferring bar size from BSPWM_WINDOW_GAP" | ||||
| 			export PB_BAR_BORDER_SIZE="$BSPWM_WINDOW_GAP" | ||||
| 		fi | ||||
| 	fi | ||||
| 	# Spawn bars on the primary monitor | ||||
| 	export PB_MONITOR=$(xrandr -q | awk '/primary/{print $1}') | ||||
| 	svc_log "Starting primary bar(s) on monitor $PB_MONITOR" | ||||
| 	polybar -r primary >/dev/null 2>/dev/null & | ||||
| 	polybar -r primary-2 >/dev/null 2>/dev/null & | ||||
|  | ||||
| 	# Spawn more for each secondary | ||||
| 	export secondary_monitors=$(xrandr -q | grep ' connected' | grep -v 'primary' | awk '{print $1}') | ||||
| 	if [[ "$secondary_monitors" == "" ]]; then | ||||
| 		return 0 | ||||
| 	fi | ||||
| 	for monitor in $secondary_monitors; do | ||||
| 		svc_log "Starting secondary bar(s) on monitor $monitor" | ||||
| 		PB_MONITOR=$monitor | ||||
| 		polybar -r secondary >/dev/null 2>/dev/null & | ||||
| 		polybar -r secondary-2 >/dev/null 2>/dev/null & | ||||
| 	done | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
							
								
								
									
										12
									
								
								.concession/services/redshift.dtf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								.concession/services/redshift.dtf
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| #! /usr/bin/env bash | ||||
| # | ||||
| # Simple wmstartup service | ||||
| # Copyright (C) 2018 salt <salt@lap-th-e560-0> | ||||
| # | ||||
| # Distributed under terms of the MIT license. | ||||
| # | ||||
|  | ||||
| service_name="Redshift" | ||||
| service_process="redshift" | ||||
| service_kill_on_reload="false" | ||||
|  | ||||
							
								
								
									
										13
									
								
								.concession/services/syncthing.dtf
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										13
									
								
								.concession/services/syncthing.dtf
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| #! /usr/bin/env bash | ||||
| # | ||||
| # Simple wmstartup service | ||||
| # Copyright (C) 2018 salt <salt@lap-th-e560-0> | ||||
| # | ||||
| # Distributed under terms of the MIT license. | ||||
| # | ||||
|  | ||||
| service_name="Syncthing" | ||||
| service_process="syncthing" | ||||
| service_kill_on_reload="false" | ||||
| service_flags="--no-browser" | ||||
|  | ||||
							
								
								
									
										60
									
								
								.concession/tasks/bspwm.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										60
									
								
								.concession/tasks/bspwm.sh
									
									
									
									
									
										Executable 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 | ||||
|  | ||||
							
								
								
									
										80
									
								
								.concession/tasks/bspwm_monitorset.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										80
									
								
								.concession/tasks/bspwm_monitorset.sh
									
									
									
									
									
										Executable 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 | ||||
|  | ||||
							
								
								
									
										20
									
								
								.concession/tasks/kill_krunner.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										20
									
								
								.concession/tasks/kill_krunner.sh
									
									
									
									
									
										Executable 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
									
								
								.concession/tasks/xrdbupdate.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								.concession/tasks/xrdbupdate.sh
									
									
									
									
									
										Executable 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
									
								
								.concession/tasks/xset.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										11
									
								
								.concession/tasks/xset.sh
									
									
									
									
									
										Executable 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 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user