diff options
| author | Timmy Keller <tjk@tjkeller.xyz> | 2021-12-07 00:15:00 -0600 | 
|---|---|---|
| committer | Timmy Keller <tjk@tjkeller.xyz> | 2021-12-07 00:15:00 -0600 | 
| commit | 705b49a0d66cfaaa3b41bbba651e6c614cdfbced (patch) | |
| tree | 6bff935791d4f08295d1a15e091524379d42a1cb | |
| parent | eb0ec035d14325a6b7bbb4fa3fe294a7beee2b9f (diff) | |
| download | scripts-705b49a0d66cfaaa3b41bbba651e6c614cdfbced.tar.xz scripts-705b49a0d66cfaaa3b41bbba651e6c614cdfbced.zip  | |
start of compress script, core dump script, lsdu, and setup script
| -rwxr-xr-x | misc/cprs | 2 | ||||
| -rwxr-xr-x | misc/enablecoredumps | 3 | ||||
| -rwxr-xr-x | misc/lsdu | 7 | ||||
| -rwxr-xr-x | misc/setup | 74 | ||||
| -rwxr-xr-x | x11/settitle | 7 | 
5 files changed, 90 insertions, 3 deletions
diff --git a/misc/cprs b/misc/cprs new file mode 100755 index 0000000..c9b99c2 --- /dev/null +++ b/misc/cprs @@ -0,0 +1,2 @@ +#!/bin/sh +tar cvzf "$(echo $1 | sed 's/\/$//').tar.gz" "$1" diff --git a/misc/enablecoredumps b/misc/enablecoredumps new file mode 100755 index 0000000..e435cc7 --- /dev/null +++ b/misc/enablecoredumps @@ -0,0 +1,3 @@ +#!/bin/sh +ulimit -c unlimited +sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t diff --git a/misc/lsdu b/misc/lsdu new file mode 100755 index 0000000..9b1295a --- /dev/null +++ b/misc/lsdu @@ -0,0 +1,7 @@ +#!/bin/sh +for file in $(ls -a); do +	([ "$file" = "." ] || [ "$file" = ".." ]) && continue +	files="${files:+$files\n}$(du -h "$file" 2>/dev/null | tail -1)" +done +echo "$files" | sort -h + diff --git a/misc/setup b/misc/setup new file mode 100755 index 0000000..cd0ed87 --- /dev/null +++ b/misc/setup @@ -0,0 +1,74 @@ +#!/bin/sh + +interactiveopt() { +	# Usage: interactiveopt "options" "prompt" +	echo "$1" | nl -s': ' 1>&2 +	# Parse user input +	read -p "$2" choices 1>&2 \ +		&& choices="$(echo $choices | cut -d' ' -f1-)" +	for choice in $choices; do +		case "$choice" in +			[0-9]*)	opt="$opt $(echo "$1" | head -"$(echo $choice | tr -cd '[:digit:]')" | tail -1)";; +			*) echo "Invalid option \"$opt\"" 1>&2							;; +		esac +	done +	echo "$opt" +} + +# Open as root in pcmanfm +pcmanfmconf() { +	pcmanfmroot=~/.local/share/file-manager/actions +	mkdir -p $pcmanfmroot +	echo " [Desktop Entry] +Type=Action +Tooltip=Open Folder As Root +Name=Open Folder As Root +Profiles=profile-zero; +Icon=gtk-dialog-authentication + +[X-Action-Profile profile-zero] +MimeTypes=inode/directory; +Exec=/usr/bin/doas /usr/bin/pcmanfm %u +Name=Default profile" > $pcmanfmroot/root.desktop +} + +minticons() { +	gitdir="/tmp/mint-y-icons" +	iconsdir="$gitdir/usr/share/icons" +	git clone https://github.com/linuxmint/mint-y-icons.git "$gitdir" +	iconsets="$(interactiveopt "$(ls "$iconsdir")" "Choose icon sets (if using dark theme, COPY THE NON-DARK THEME TOO): ")" +	iconsets="$iconset Mint-Y" +	for iconset in $iconsets; do +		mv "$iconsdir/$iconset" $iconsdestdir +	done +	gtk-update-icon-cache +} + +mintthemes() { +	gitdir="/tmp/mint-themes" +	themesdir="$gitdir/usr/share/themes" +	#iconsdir="$gitdir/usr/share/icons" +	git clone https://github.com/linuxmint/mint-themes.git "$gitdir" +	curdir="$(pwd)" +	cd $gitdir +	make +	themes="$(interactiveopt "$(ls "$themesdir")" "Choose themes: ")" +	#iconset="$iconset Mint-Y" +	for theme in $themes; do +		mv "$themesdir/$theme" $themesdestdir +	done +	#iconsets="$(interactiveopt "$(ls "$iconsdir")" "Choose icon set (if using dark theme, COPY THE NON-DARK THEME TOO): ")" +	#iconset="$iconset Mint-Y" +	#for iconset in $iconsets; do +	#	mv "$iconsdir/$iconset" $iconsdestdir +	#done +	#gtk-update-icon-cache +} + +iconsdestdir=~/.local/share/icons +themesdestdir=~/.local/share/themes +mkdir -p $iconsdestdir $themesdestdir + +pcmanfmconf +minticons +mintthemes diff --git a/x11/settitle b/x11/settitle index df613ca..7cdd7d1 100755 --- a/x11/settitle +++ b/x11/settitle @@ -1,3 +1,4 @@ -#!/usr/bin/env bash -xdotool getactivewindow set_window --class "$1" -[ -z "$2" ] && echo -en "\e]0;$2\a" +#!/bin/sh +xdotool set_window --class "$2" $(xdotool search --pid $1) # command chaining doesnt work for some reason +#xdotool getactivewindow set_window --class "$1" +#[ -z "$2" ] && echo -n "\e]0;$2\a"  | 
