From 93d2743e3864e9eab0699b1bb1ea5f01c10bdbc1 Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Mon, 23 Sep 2019 06:32:38 +0300 Subject: initial commit --- dotfiles/.scripts/activenv | 3 + dotfiles/.scripts/camtoggle | 3 + dotfiles/.scripts/changeoutput | 18 ++ dotfiles/.scripts/ddquakemite | 12 + dotfiles/.scripts/ddtelegram | 12 + dotfiles/.scripts/ddvk | 12 + dotfiles/.scripts/git-prompt | 484 +++++++++++++++++++++++++++++++++ dotfiles/.scripts/i3barbattery | 34 +++ dotfiles/.scripts/i3barmusic | 18 ++ dotfiles/.scripts/i3barweather | 18 ++ dotfiles/.scripts/i3session | 35 +++ dotfiles/.scripts/linkhandler | 22 ++ dotfiles/.scripts/listsinks | 3 + dotfiles/.scripts/lmc | 20 ++ dotfiles/.scripts/lock-color | 86 ++++++ dotfiles/.scripts/mailcheck | 35 +++ dotfiles/.scripts/mako_launch | 9 + dotfiles/.scripts/menudisplay | 14 + dotfiles/.scripts/menuducksearch | 18 ++ dotfiles/.scripts/menuemoji | 16 ++ dotfiles/.scripts/menugrim | 33 +++ dotfiles/.scripts/menuoutput | 16 ++ dotfiles/.scripts/menuprompt | 7 + dotfiles/.scripts/menurun | 6 + dotfiles/.scripts/menusession | 8 + dotfiles/.scripts/mopidy_launch | 4 + dotfiles/.scripts/notistats | 10 + dotfiles/.scripts/paccheck | 10 + dotfiles/.scripts/qmi_setup | 104 +++++++ dotfiles/.scripts/setbg | 3 + dotfiles/.scripts/setbglblur | 8 + dotfiles/.scripts/setbglsimple | 7 + dotfiles/.scripts/swaygetcurrentwindow | 5 + dotfiles/.scripts/swaykbd | 20 ++ dotfiles/.scripts/swayresize | 27 ++ dotfiles/.scripts/swaystart | 12 + dotfiles/.scripts/sxiv-rifle | 48 ++++ dotfiles/.scripts/vifm_launch | 15 + dotfiles/.scripts/waybar_launch | 9 + dotfiles/.scripts/xway | 10 + 40 files changed, 1234 insertions(+) create mode 100755 dotfiles/.scripts/activenv create mode 100755 dotfiles/.scripts/camtoggle create mode 100755 dotfiles/.scripts/changeoutput create mode 100755 dotfiles/.scripts/ddquakemite create mode 100755 dotfiles/.scripts/ddtelegram create mode 100755 dotfiles/.scripts/ddvk create mode 100755 dotfiles/.scripts/git-prompt create mode 100755 dotfiles/.scripts/i3barbattery create mode 100755 dotfiles/.scripts/i3barmusic create mode 100755 dotfiles/.scripts/i3barweather create mode 100755 dotfiles/.scripts/i3session create mode 100755 dotfiles/.scripts/linkhandler create mode 100755 dotfiles/.scripts/listsinks create mode 100755 dotfiles/.scripts/lmc create mode 100755 dotfiles/.scripts/lock-color create mode 100755 dotfiles/.scripts/mailcheck create mode 100755 dotfiles/.scripts/mako_launch create mode 100755 dotfiles/.scripts/menudisplay create mode 100755 dotfiles/.scripts/menuducksearch create mode 100755 dotfiles/.scripts/menuemoji create mode 100755 dotfiles/.scripts/menugrim create mode 100755 dotfiles/.scripts/menuoutput create mode 100755 dotfiles/.scripts/menuprompt create mode 100755 dotfiles/.scripts/menurun create mode 100755 dotfiles/.scripts/menusession create mode 100755 dotfiles/.scripts/mopidy_launch create mode 100755 dotfiles/.scripts/notistats create mode 100755 dotfiles/.scripts/paccheck create mode 100755 dotfiles/.scripts/qmi_setup create mode 100755 dotfiles/.scripts/setbg create mode 100755 dotfiles/.scripts/setbglblur create mode 100755 dotfiles/.scripts/setbglsimple create mode 100755 dotfiles/.scripts/swaygetcurrentwindow create mode 100755 dotfiles/.scripts/swaykbd create mode 100755 dotfiles/.scripts/swayresize create mode 100755 dotfiles/.scripts/swaystart create mode 100755 dotfiles/.scripts/sxiv-rifle create mode 100755 dotfiles/.scripts/vifm_launch create mode 100755 dotfiles/.scripts/waybar_launch create mode 100755 dotfiles/.scripts/xway (limited to 'dotfiles/.scripts') diff --git a/dotfiles/.scripts/activenv b/dotfiles/.scripts/activenv new file mode 100755 index 0000000..6ffac10 --- /dev/null +++ b/dotfiles/.scripts/activenv @@ -0,0 +1,3 @@ +#!/bin/bash + +source ~/Documents/venvs/$1/bin/activate diff --git a/dotfiles/.scripts/camtoggle b/dotfiles/.scripts/camtoggle new file mode 100755 index 0000000..ba8b0d3 --- /dev/null +++ b/dotfiles/.scripts/camtoggle @@ -0,0 +1,3 @@ +#!/bin/sh + +pkill -f /dev/video || mpv --gpu-context=wayland --no-osc --no-input-default-bindings --input-conf=/dev/null --geometry=-0-0 --autofit=30% --title="mpvfloat" /dev/video2 diff --git a/dotfiles/.scripts/changeoutput b/dotfiles/.scripts/changeoutput new file mode 100755 index 0000000..eab2cf9 --- /dev/null +++ b/dotfiles/.scripts/changeoutput @@ -0,0 +1,18 @@ +#!/bin/sh + +if [ -z "$1" ]; then + echo "Usage: $0 " >&2 + echo "Valid sinks:" >&2 + pactl list short sinks >&2 + exit 1 +fi + +newSink="$1" + +pactl list short sink-inputs|while read stream; do + streamId=$(echo $stream|cut '-d ' -f1) + echo "moving stream $streamId" + pactl move-sink-input "$streamId" "$newSink" +done + +pactl set-default-sink $newSink diff --git a/dotfiles/.scripts/ddquakemite b/dotfiles/.scripts/ddquakemite new file mode 100755 index 0000000..16855f4 --- /dev/null +++ b/dotfiles/.scripts/ddquakemite @@ -0,0 +1,12 @@ +#!/bin/sh + +if ! [ -z $(swaymsg -t get_tree | grep 'quakemite') ]; then + if [ -z $(swaymsg -t get_tree | grep -A 42 'quakemite' | tail -n 1 | grep 'true') ]; then + swaymsg '[title="quakemite"] scratchpad show' + else + swaymsg '[title="quakemite"] move scratchpad' + fi +else + $TERMINAL -t "quakemite" -e "$SHELL -c 'TERM=st; TERMINAL=termite; tmux a || tmux'" +fi + diff --git a/dotfiles/.scripts/ddtelegram b/dotfiles/.scripts/ddtelegram new file mode 100755 index 0000000..8ddff22 --- /dev/null +++ b/dotfiles/.scripts/ddtelegram @@ -0,0 +1,12 @@ +#!/bin/sh + +if pidof telegram-desktop > /dev/null; then + if [ -z $(swaymsg -t get_tree | grep -A 1 'telegramdesktop' | tail -n 1 | grep 'true') ]; then + swaymsg '[app_id="telegramdesktop"] scratchpad show' + else + swaymsg '[app_id="telegramdesktop"] move scratchpad' + fi +else + telegram-desktop +fi + diff --git a/dotfiles/.scripts/ddvk b/dotfiles/.scripts/ddvk new file mode 100755 index 0000000..dedd2c9 --- /dev/null +++ b/dotfiles/.scripts/ddvk @@ -0,0 +1,12 @@ +#!/bin/sh + +if pidof vk > /dev/null; then + if [ -z $(swaymsg -t get_tree | grep -B 5 'vk' | head -n 1 | grep 'true') ]; then + swaymsg '[instance="vk"] scratchpad show' + else + swaymsg '[instance="vk"] move scratchpad' + fi +else + xway vk-messenger +fi + diff --git a/dotfiles/.scripts/git-prompt b/dotfiles/.scripts/git-prompt new file mode 100755 index 0000000..048d2d7 --- /dev/null +++ b/dotfiles/.scripts/git-prompt @@ -0,0 +1,484 @@ +# bash/zsh git prompt support +# +# Copyright (C) 2006,2007 Shawn O. Pearce +# Distributed under the GNU General Public License, version 2.0. +# +# This script allows you to see repository status in your prompt. +# +# To enable: +# +# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh). +# 2) Add the following line to your .bashrc/.zshrc: +# source ~/.git-prompt.sh +# 3a) Change your PS1 to call __git_ps1 as +# command-substitution: +# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ' +# ZSH: setopt PROMPT_SUBST ; PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ ' +# the optional argument will be used as format string. +# 3b) Alternatively, for a slightly faster prompt, __git_ps1 can +# be used for PROMPT_COMMAND in Bash or for precmd() in Zsh +# with two parameters,
 and , which are strings
+#        you would put in $PS1 before and after the status string
+#        generated by the git-prompt machinery.  e.g.
+#        Bash: PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\\$ "'
+#          will show username, at-sign, host, colon, cwd, then
+#          various status string, followed by dollar and SP, as
+#          your prompt.
+#        ZSH:  precmd () { __git_ps1 "%n" ":%~$ " "|%s" }
+#          will show username, pipe, then various status string,
+#          followed by colon, cwd, dollar and SP, as your prompt.
+#        Optionally, you can supply a third argument with a printf
+#        format string to finetune the output of the branch status
+#
+# The repository status will be displayed only if you are currently in a
+# git repository. The %s token is the placeholder for the shown status.
+#
+# The prompt status always includes the current branch name.
+#
+# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty value,
+# unstaged (*) and staged (+) changes will be shown next to the branch
+# name.  You can configure this per-repository with the
+# bash.showDirtyState variable, which defaults to true once
+# GIT_PS1_SHOWDIRTYSTATE is enabled.
+#
+# You can also see if currently something is stashed, by setting
+# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
+# then a '$' will be shown next to the branch name.
+#
+# If you would like to see if there're untracked files, then you can set
+# GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
+# files, then a '%' will be shown next to the branch name.  You can
+# configure this per-repository with the bash.showUntrackedFiles
+# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is
+# enabled.
+#
+# If you would like to see the difference between HEAD and its upstream,
+# set GIT_PS1_SHOWUPSTREAM="auto".  A "<" indicates you are behind, ">"
+# indicates you are ahead, "<>" indicates you have diverged and "="
+# indicates that there is no difference. You can further control
+# behaviour by setting GIT_PS1_SHOWUPSTREAM to a space-separated list
+# of values:
+#
+#     verbose       show number of commits ahead/behind (+/-) upstream
+#     name          if verbose, then also show the upstream abbrev name
+#     legacy        don't use the '--count' option available in recent
+#                   versions of git-rev-list
+#     git           always compare HEAD to @{upstream}
+#     svn           always compare HEAD to your SVN upstream
+#
+# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
+# find one, or @{upstream} otherwise.  Once you have set
+# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
+# setting the bash.showUpstream config variable.
+#
+# If you would like to see more information about the identity of
+# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
+# to one of these values:
+#
+#     contains      relative to newer annotated tag (v1.6.3.2~35)
+#     branch        relative to newer tag or branch (master~4)
+#     describe      relative to older annotated tag (v1.6.3.1-13-gdd42c2f)
+#     default       exactly matching tag
+#
+# If you would like a colored hint about the current dirty state, set
+# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
+# the colored output of "git status -sb" and are available only when
+# using __git_ps1 for PROMPT_COMMAND or precmd.
+
+# check whether printf supports -v
+__git_printf_supports_v=
+printf -v __git_printf_supports_v -- '%s' yes >/dev/null 2>&1
+
+# stores the divergence from upstream in $p
+# used by GIT_PS1_SHOWUPSTREAM
+__git_ps1_show_upstream ()
+{
+	local key value
+	local svn_remote svn_url_pattern count n
+	local upstream=git legacy="" verbose="" name=""
+
+	svn_remote=()
+	# get some config options from git-config
+	local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
+	while read -r key value; do
+		case "$key" in
+		bash.showupstream)
+			GIT_PS1_SHOWUPSTREAM="$value"
+			if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then
+				p=""
+				return
+			fi
+			;;
+		svn-remote.*.url)
+			svn_remote[$((${#svn_remote[@]} + 1))]="$value"
+			svn_url_pattern="$svn_url_pattern\\|$value"
+			upstream=svn+git # default upstream is SVN if available, else git
+			;;
+		esac
+	done <<< "$output"
+
+	# parse configuration values
+	for option in ${GIT_PS1_SHOWUPSTREAM}; do
+		case "$option" in
+		git|svn) upstream="$option" ;;
+		verbose) verbose=1 ;;
+		legacy)  legacy=1  ;;
+		name)    name=1 ;;
+		esac
+	done
+
+	# Find our upstream
+	case "$upstream" in
+	git)    upstream="@{upstream}" ;;
+	svn*)
+		# get the upstream from the "git-svn-id: ..." in a commit message
+		# (git-svn uses essentially the same procedure internally)
+		local -a svn_upstream
+		svn_upstream=($(git log --first-parent -1 \
+					--grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null))
+		if [[ 0 -ne ${#svn_upstream[@]} ]]; then
+			svn_upstream=${svn_upstream[${#svn_upstream[@]} - 2]}
+			svn_upstream=${svn_upstream%@*}
+			local n_stop="${#svn_remote[@]}"
+			for ((n=1; n <= n_stop; n++)); do
+				svn_upstream=${svn_upstream#${svn_remote[$n]}}
+			done
+
+			if [[ -z "$svn_upstream" ]]; then
+				# default branch name for checkouts with no layout:
+				upstream=${GIT_SVN_ID:-git-svn}
+			else
+				upstream=${svn_upstream#/}
+			fi
+		elif [[ "svn+git" = "$upstream" ]]; then
+			upstream="@{upstream}"
+		fi
+		;;
+	esac
+
+	# Find how many commits we are ahead/behind our upstream
+	if [[ -z "$legacy" ]]; then
+		count="$(git rev-list --count --left-right \
+				"$upstream"...HEAD 2>/dev/null)"
+	else
+		# produce equivalent output to --count for older versions of git
+		local commits
+		if commits="$(git rev-list --left-right "$upstream"...HEAD 2>/dev/null)"
+		then
+			local commit behind=0 ahead=0
+			for commit in $commits
+			do
+				case "$commit" in
+				"<"*) ((behind++)) ;;
+				*)    ((ahead++))  ;;
+				esac
+			done
+			count="$behind	$ahead"
+		else
+			count=""
+		fi
+	fi
+
+	# calculate the result
+	if [[ -z "$verbose" ]]; then
+		case "$count" in
+		"") # no upstream
+			p="" ;;
+		"0	0") # equal to upstream
+			p="=" ;;
+		"0	"*) # ahead of upstream
+			p=">" ;;
+		*"	0") # behind upstream
+			p="<" ;;
+		*)	    # diverged from upstream
+			p="<>" ;;
+		esac
+	else
+		case "$count" in
+		"") # no upstream
+			p="" ;;
+		"0	0") # equal to upstream
+			p=" u=" ;;
+		"0	"*) # ahead of upstream
+			p=" u+${count#0	}" ;;
+		*"	0") # behind upstream
+			p=" u-${count%	0}" ;;
+		*)	    # diverged from upstream
+			p=" u+${count#*	}-${count%	*}" ;;
+		esac
+		if [[ -n "$count" && -n "$name" ]]; then
+			__git_ps1_upstream_name=$(git rev-parse \
+				--abbrev-ref "$upstream" 2>/dev/null)
+			if [ $pcmode = yes ]; then
+				# see the comments around the
+				# __git_ps1_branch_name variable below
+				p="$p \${__git_ps1_upstream_name}"
+			else
+				p="$p ${__git_ps1_upstream_name}"
+				# not needed anymore; keep user's
+				# environment clean
+				unset __git_ps1_upstream_name
+			fi
+		fi
+	fi
+
+}
+
+# Helper function that is meant to be called from __git_ps1.  It
+# injects color codes into the appropriate gitstring variables used
+# to build a gitstring.
+__git_ps1_colorize_gitstring ()
+{
+	if [[ -n ${ZSH_VERSION-} ]]; then
+		local c_red='%F{red}'
+		local c_green='%F{green}'
+		local c_lblue='%F{blue}'
+		local c_clear='%f'
+	else
+		# Using \[ and \] around colors is necessary to prevent
+		# issues with command line editing/browsing/completion!
+		local c_red='\[\e[31m\]'
+		local c_green='\[\e[32m\]'
+		local c_lblue='\[\e[1;34m\]'
+		local c_clear='\[\e[0m\]'
+	fi
+	local bad_color=$c_red
+	local ok_color=$c_green
+	local flags_color="$c_lblue"
+
+	local branch_color=""
+	if [ $detached = no ]; then
+		branch_color="$ok_color"
+	else
+		branch_color="$bad_color"
+	fi
+	c="$branch_color$c"
+
+	z="$c_clear$z"
+	if [ "$w" = "*" ]; then
+		w="$bad_color$w"
+	fi
+	if [ -n "$i" ]; then
+		i="$ok_color$i"
+	fi
+	if [ -n "$s" ]; then
+		s="$flags_color$s"
+	fi
+	if [ -n "$u" ]; then
+		u="$bad_color$u"
+	fi
+	r="$c_clear$r"
+}
+
+# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
+# when called from PS1 using command substitution
+# in this mode it prints text to add to bash PS1 prompt (includes branch name)
+#
+# __git_ps1 requires 2 or 3 arguments when called from PROMPT_COMMAND (pc)
+# in that case it _sets_ PS1. The arguments are parts of a PS1 string.
+# when two arguments are given, the first is prepended and the second appended
+# to the state string when assigned to PS1.
+# The optional third parameter will be used as printf format string to further
+# customize the output of the git-status string.
+# In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true
+__git_ps1 ()
+{
+	local pcmode=no
+	local detached=no
+	local ps1pc_start='\u@\h:\w '
+	local ps1pc_end='\$ '
+	local printf_format=' %s '
+
+	case "$#" in
+		2|3)	pcmode=yes
+			ps1pc_start="$1"
+			ps1pc_end="$2"
+			printf_format="${3:-$printf_format}"
+		;;
+		0|1)	printf_format="${1:-$printf_format}"
+		;;
+		*)	return
+		;;
+	esac
+
+	local repo_info rev_parse_exit_code
+	repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
+		--is-bare-repository --is-inside-work-tree \
+		--short HEAD 2>/dev/null)"
+	rev_parse_exit_code="$?"
+
+	if [ -z "$repo_info" ]; then
+		if [ $pcmode = yes ]; then
+			#In PC mode PS1 always needs to be set
+			PS1="$ps1pc_start$ps1pc_end"
+		fi
+		return
+	fi
+
+	local short_sha
+	if [ "$rev_parse_exit_code" = "0" ]; then
+		short_sha="${repo_info##*$'\n'}"
+		repo_info="${repo_info%$'\n'*}"
+	fi
+	local inside_worktree="${repo_info##*$'\n'}"
+	repo_info="${repo_info%$'\n'*}"
+	local bare_repo="${repo_info##*$'\n'}"
+	repo_info="${repo_info%$'\n'*}"
+	local inside_gitdir="${repo_info##*$'\n'}"
+	local g="${repo_info%$'\n'*}"
+
+	local r=""
+	local b=""
+	local step=""
+	local total=""
+	if [ -d "$g/rebase-merge" ]; then
+		read b 2>/dev/null <"$g/rebase-merge/head-name"
+		read step 2>/dev/null <"$g/rebase-merge/msgnum"
+		read total 2>/dev/null <"$g/rebase-merge/end"
+		if [ -f "$g/rebase-merge/interactive" ]; then
+			r="|REBASE-i"
+		else
+			r="|REBASE-m"
+		fi
+	else
+		if [ -d "$g/rebase-apply" ]; then
+			read step 2>/dev/null <"$g/rebase-apply/next"
+			read total 2>/dev/null <"$g/rebase-apply/last"
+			if [ -f "$g/rebase-apply/rebasing" ]; then
+				read b 2>/dev/null <"$g/rebase-apply/head-name"
+				r="|REBASE"
+			elif [ -f "$g/rebase-apply/applying" ]; then
+				r="|AM"
+			else
+				r="|AM/REBASE"
+			fi
+		elif [ -f "$g/MERGE_HEAD" ]; then
+			r="|MERGING"
+		elif [ -f "$g/CHERRY_PICK_HEAD" ]; then
+			r="|CHERRY-PICKING"
+		elif [ -f "$g/REVERT_HEAD" ]; then
+			r="|REVERTING"
+		elif [ -f "$g/BISECT_LOG" ]; then
+			r="|BISECTING"
+		fi
+
+		if [ -n "$b" ]; then
+			:
+		elif [ -h "$g/HEAD" ]; then
+			# symlink symbolic ref
+			b="$(git symbolic-ref HEAD 2>/dev/null)"
+		else
+			local head=""
+			if ! read head 2>/dev/null <"$g/HEAD"; then
+				if [ $pcmode = yes ]; then
+					PS1="$ps1pc_start$ps1pc_end"
+				fi
+				return
+			fi
+			# is it a symbolic ref?
+			b="${head#ref: }"
+			if [ "$head" = "$b" ]; then
+				detached=yes
+				b="$(
+				case "${GIT_PS1_DESCRIBE_STYLE-}" in
+				(contains)
+					git describe --contains HEAD ;;
+				(branch)
+					git describe --contains --all HEAD ;;
+				(describe)
+					git describe HEAD ;;
+				(* | default)
+					git describe --tags --exact-match HEAD ;;
+				esac 2>/dev/null)" ||
+
+				b="$short_sha..."
+				b="($b)"
+			fi
+		fi
+	fi
+
+	if [ -n "$step" ] && [ -n "$total" ]; then
+		r="$r $step/$total"
+	fi
+
+	local w=""
+	local i=""
+	local s=""
+	local u=""
+	local c=""
+	local p=""
+
+	if [ "true" = "$inside_gitdir" ]; then
+		if [ "true" = "$bare_repo" ]; then
+			c="BARE:"
+		else
+			b="GIT_DIR!"
+		fi
+	elif [ "true" = "$inside_worktree" ]; then
+		if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] &&
+		   [ "$(git config --bool bash.showDirtyState)" != "false" ]
+		then
+			git diff --no-ext-diff --quiet --exit-code || w="*"
+			if [ -n "$short_sha" ]; then
+				git diff-index --cached --quiet HEAD -- || i="+"
+			else
+				i="#"
+			fi
+		fi
+		if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] &&
+		   [ -r "$g/refs/stash" ]; then
+			s="$"
+		fi
+
+		if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
+		   [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
+		   git ls-files --others --exclude-standard --error-unmatch -- '*' >/dev/null 2>/dev/null
+		then
+			u="%${ZSH_VERSION+%}"
+		fi
+
+		if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
+			__git_ps1_show_upstream
+		fi
+	fi
+
+	local z="${GIT_PS1_STATESEPARATOR-" "}"
+
+	# NO color option unless in PROMPT_COMMAND mode
+	if [ $pcmode = yes ] && [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
+		__git_ps1_colorize_gitstring
+	fi
+
+	b=${b##refs/heads/}
+	if [ $pcmode = yes ]; then
+		# In pcmode (and only pcmode) the contents of
+		# $gitstring are subject to expansion by the shell.
+		# Avoid putting the raw ref name in the prompt to
+		# protect the user from arbitrary code execution via
+		# specially crafted ref names (e.g., a ref named
+		# '$(IFS=_;cmd=sudo_rm_-rf_/;$cmd)' would execute
+		# 'sudo rm -rf /' when the prompt is drawn).  Instead,
+		# put the ref name in a new global variable (in the
+		# __git_ps1_* namespace to avoid colliding with the
+		# user's environment) and reference that variable from
+		# PS1.
+		__git_ps1_branch_name=$b
+		# note that the $ is escaped -- the variable will be
+		# expanded later (when it's time to draw the prompt)
+		b="\${__git_ps1_branch_name}"
+	fi
+
+	local f="$w$i$s$u"
+	local gitstring="$c$b${f:+$z$f}$r$p"
+
+	if [ $pcmode = yes ]; then
+		if [ "${__git_printf_supports_v-}" != yes ]; then
+			gitstring=$(printf -- "$printf_format" "$gitstring")
+		else
+			printf -v gitstring -- "$printf_format" "$gitstring"
+		fi
+		PS1="$ps1pc_start$gitstring$ps1pc_end"
+	else
+		printf -- "$printf_format" "$gitstring"
+	fi
+}
diff --git a/dotfiles/.scripts/i3barbattery b/dotfiles/.scripts/i3barbattery
new file mode 100755
index 0000000..edc89c3
--- /dev/null
+++ b/dotfiles/.scripts/i3barbattery
@@ -0,0 +1,34 @@
+#!/bin/sh
+# Taken from Luke Smith's rice
+# Takes battery name as an argument (e.g. BAT0)
+
+case $BLOCK_BUTTON in
+    3) notify-send "🔋 Battery module" "🔋: discharging
+🛑: not charging
+♻: stagnant charge
+🔌: charging
+⚡: charged
+❗: battery very low!
+- Text color reflects charge left" ;;
+esac
+
+capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit
+status=$(cat /sys/class/power_supply/"$1"/status)
+
+if [ "$capacity" -ge 75 ]; then
+	color="#689d6a"
+elif [ "$capacity" -ge 50 ]; then
+	color="#ffffff"
+elif [ "$capacity" -ge 25 ]; then
+	color="#ffff00"
+else
+	color="#ff0000"
+	warn="❗"
+fi
+
+[ -z $warn ] && warn=" "
+
+[ "$status" = "Charging" ] && color="#ffffff"
+
+printf "%s%s%s" "$color" "$(echo "$status" | sed -e "s/,//;s/Discharging/🔋/;s/Not Charging/🛑/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')"
+
diff --git a/dotfiles/.scripts/i3barmusic b/dotfiles/.scripts/i3barmusic
new file mode 100755
index 0000000..5647a81
--- /dev/null
+++ b/dotfiles/.scripts/i3barmusic
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+filter() {
+	sed "/^volume:/d" | tac | sed -e "s/\\&/&/g;s/\\[paused\\].*//g;s/\\[playing\\].*//g" | tr -d '\n' | sed -e "s/$/<\\/span>/g"
+	}
+
+case $BLOCK_BUTTON in
+    1) mpc toggle | filter ;;
+    2) mpc status | filter && setsid "$TERMINAL" -e ncmpcpp & ;;
+    3) mpc status | filter && notify-send "🎵 Music module" "\- Shows mpd song playing.
+- Italic when paused.
+- Left click opens ncmpcpp.
+- Middle click pauses.
+- Scroll changes track.";;  # right click, pause/unpause
+    4) mpc prev   | filter ;;  # scroll up, previous
+    5) mpc next   | filter ;;  # scroll down, next
+    *) mpc status | filter ;;
+esac; exit
diff --git a/dotfiles/.scripts/i3barweather b/dotfiles/.scripts/i3barweather
new file mode 100755
index 0000000..5084688
--- /dev/null
+++ b/dotfiles/.scripts/i3barweather
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+location="Saint Petersburg"
+
+if [[ "$location" != "" ]]
+then
+    location="~${location// /+}"
+fi
+
+forecast=$(curl -s wttr.in/$location?format=2)
+
+if [[ ${#forecast} -gt 30 ]]
+then
+    exit
+fi
+
+echo $forecast
+
diff --git a/dotfiles/.scripts/i3session b/dotfiles/.scripts/i3session
new file mode 100755
index 0000000..17f99ca
--- /dev/null
+++ b/dotfiles/.scripts/i3session
@@ -0,0 +1,35 @@
+#!/bin/sh
+# /usr/bin/i3exit
+
+# on void just sudo
+[[ $(cat /proc/1/comm) == "systemd" ]] && logind=systemctl || logind=loginctl
+
+case "$1" in
+    lock)
+        lock-color
+        ;;
+    logout)
+        swaymsg exit
+        ;;
+    switch_user)
+        dm-tool switch-to-greeter
+        ;;
+    suspend)
+        lock-color & sleep 1 && $logind suspend
+        ;;
+    hibernate)
+        lock-color & sleep 1 && $logind hibernate
+        ;;
+    reboot)
+        $logind reboot
+        ;;
+    shutdown)
+        $logind poweroff
+        ;;
+    *)
+        echo "== ! i3exit: missing or invalid argument ! =="
+        echo "Try again with: lock | logout | switch_user | suspend | hibernate | reboot | shutdown"
+        exit 2
+esac
+
+exit 0
diff --git a/dotfiles/.scripts/linkhandler b/dotfiles/.scripts/linkhandler
new file mode 100755
index 0000000..c616d04
--- /dev/null
+++ b/dotfiles/.scripts/linkhandler
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Feed script a url or file location.
+# If an image, it will view in sxiv,
+# if a video or gif, it will view in mpv
+# if a music file or pdf, it will download,
+# otherwise it opens link in browser.
+
+# If no url given. Opens browser. For using script as $BROWSER.
+[ -z "$1" ] && { "$BROWSER"; exit; }
+
+case "$1" in
+	*mkv|*webm|*mp4|*youtube.com*|*youtu.be*|*hooktube.com*|*bitchute.com*)
+		setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -quiet "$1" >/dev/null 2>&1 & ;;
+	*png|*jpg|*jpe|*jpeg|*gif)
+		curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")"  >/dev/null 2>&1 & ;;
+	*mp3|*flac|*opus|*mp3?source*)
+		setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;;
+	*)
+		if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1"
+		else setsid "$BROWSER" "$1" >/dev/null 2>&1 & fi ;;
+esac
diff --git a/dotfiles/.scripts/listsinks b/dotfiles/.scripts/listsinks
new file mode 100755
index 0000000..d76e3e2
--- /dev/null
+++ b/dotfiles/.scripts/listsinks
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+pactl list short sinks | awk '{ print $2 }'
diff --git a/dotfiles/.scripts/lmc b/dotfiles/.scripts/lmc
new file mode 100755
index 0000000..16d04db
--- /dev/null
+++ b/dotfiles/.scripts/lmc
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+case "$1" in
+	"up") pamixer --allow-boost -i "$2" || amixer sset Master 2%+ ;;
+	"down") pamixer --allow-boost -d "$2" || amixer sset Master 2%- ;;
+	"mute") pamixer --allow-boost -t || amixer sset Master toggle ;;
+	"truemute") pamixer --allow-boost -m || amixer sset Master mute ;;
+	"toggle") mpc toggle ; $newmpd ;;
+	"pause") mpc pause ; $newmpd ;;
+	"forward") mpc seek +"$2" ; $newmpd ;;
+	"back") mpc seek -"$2" ; $newmpd ;;
+	"next") mpc next ; $newmpd ;;
+	"prev") mpc prev ; $newmpd ;;
+	"replay") mpc seek 0% ; $newmpd ;;
+esac
+
+kill -44 $(pgrep -x i3blocks)
+kill -45 $(pgrep -x i3blocks)
+
+exit
diff --git a/dotfiles/.scripts/lock-color b/dotfiles/.scripts/lock-color
new file mode 100755
index 0000000..445d779
--- /dev/null
+++ b/dotfiles/.scripts/lock-color
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+#B='#00000000'  # blank
+#C='#ffffff22'  # clear ish
+#D='#b58900ff'  # default
+#T='#fcbd00dd'  # text
+#W='#880000bb'  # wrong
+#V='#fcbd00dd'  # verifying
+
+B='#00000000'  # blank
+C='#ffffff22'  # clear ish
+D='#ffffffff'  # default
+T='#dac99dff'  # text
+W='#880000bb'  # wrong
+V='#023982dd'  # verifying
+# Approximate timeout rate in milliseconds (checked every 5 seconds).
+timeout="30000"
+
+
+if [ "$(ps cax | grep sway)" ]; then
+    swaylock &
+
+    swayidle timeout 15 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' &
+
+    while [ "$(pgrep -x swaylock)" ]
+    do
+        sleep 1
+    done
+
+    pkill -n swayidle
+    exit
+fi
+# Take a screenshot:
+#scrot /tmp/screen.png
+
+#cp ~/.config/wall.png /tmp/screen.png
+# Create a blur on the shot:
+#convert /tmp/screen.png -paint 1 -swirl 360 /tmp/screen.png
+#convert /tmp/screen.png -brightness-contrast -20,-20 -paint 1 -noise 0x8 -blur 9,9 /tmp/screen.png
+
+i3lock \
+    --layoutcolor=$T \
+    --timecolor=$T \
+    --datecolor=$T \
+    --verifcolor=$T \
+    --wrongcolor=$W \
+    --keyhlcolor=$V \
+    --insidecolor=$B      \
+    --ringcolor=$T        \
+    --linecolor=$B        \
+    --separatorcolor=$D   \
+    --insidecolor=$B \
+    --insidewrongcolor=$B \
+    --insidevercolor=$B   \
+    --color=#000000 \
+    --clock \
+    --radius=150 \
+    --ring-width=5 \
+    --timestr="%H:%M:%S"  \
+    --datestr="%A %e, %b %Y" \
+    --veriftext="Verifying..."  \
+    --wrongtext="Nope!" \
+    --noinputtext="BLANK" \
+    --time-font=furacodenerdfontmono  \
+    --date-font=ibmplexsans  \
+    --timesize=45  \
+    --datesize=24  \
+
+# If still locked after $timeout milliseconds, turn off screen.
+while [ "$(pgrep -x i3lock)" ]
+do
+	if [ $timeout -lt $(xssstate -i) ]
+    then
+        xset dpms force off
+    fi
+	sleep 1
+done
+
+# --blur 7              \
+# --keylayout 2         \
+# --textsize=20
+# --modsize=10
+# --timefont=comic-sans
+# --datefont=monofur
+# etc
+
diff --git a/dotfiles/.scripts/mailcheck b/dotfiles/.scripts/mailcheck
new file mode 100755
index 0000000..bf49de9
--- /dev/null
+++ b/dotfiles/.scripts/mailcheck
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Sync mail and give notification if there is new mail.
+
+# Run only if user logged in (prevent cron errors)
+w | grep "^$USER\W" >/dev/null || exit
+
+# Checks for internet connection and set notification script.
+ping -q -c 1 1.1.1.1 > /dev/null || exit
+command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotify-send\` should be installed for pop-up mail notifications with this script."
+
+export DISPLAY=:0.0
+
+notify() {
+    notify-send "📬 Email" "$2 new mail(s) in \`$1\` account."
+    mplayer $HOME/.soundalerts/mail.mp3
+}
+
+# Run mbsync. You can feed this script different settings.
+if [ $# -eq 0 ]; then
+	mbsync -a
+else
+	mbsync "$@"
+fi
+
+# Check all accounts/mailboxes for new mail. Notify if there is new content.
+for account in "$HOME/.local/share/mail/"*
+do
+	acc="$(echo "$account" | sed "s/.*\///")"
+	newcount=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$HOME/.config/mutt/.mailsynclastrun" 2> /dev/null | wc -l)
+	[ "$newcount" -gt "0" ] && notify "$acc" "$newcount" &
+done
+notmuch new 2>/dev/null
+
+#Create a touch file that indicates the time of the last run of mailsync
+touch "$HOME/.config/mutt/.mailsynclastrun"
diff --git a/dotfiles/.scripts/mako_launch b/dotfiles/.scripts/mako_launch
new file mode 100755
index 0000000..7ee10cc
--- /dev/null
+++ b/dotfiles/.scripts/mako_launch
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Terminate already running mako instance
+killall -q mako
+
+# Wait until the processes have been shut down
+while pgrep -u $UID -x mako >/dev/null; do sleep 1; done
+
+mako --background-color "#1a1a1acc" --border-color "#000000" --default-timeout 5000 --height 300
diff --git a/dotfiles/.scripts/menudisplay b/dotfiles/.scripts/menudisplay
new file mode 100755
index 0000000..626f97c
--- /dev/null
+++ b/dotfiles/.scripts/menudisplay
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Source settings from .bemenurc
+. $HOME/.bemenurc
+
+display=$(swaymsg -t get_outputs | grep -E "name" | sed "s/^.*\"name\": \"//g;s/\",$//g;" | bemenu -p "Select output: " $BEMENU_OPTIONS)
+
+if [ -z $display ]; then
+    exit 0
+fi
+
+action=$(printf "enable\ndisable\n" | bemenu -p "Choose action: " $BEMENU_OPTIONS)
+
+swaymsg output $display $action
diff --git a/dotfiles/.scripts/menuducksearch b/dotfiles/.scripts/menuducksearch
new file mode 100755
index 0000000..6965b69
--- /dev/null
+++ b/dotfiles/.scripts/menuducksearch
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Gives a dmenu prompt to search DuckDuckGo.
+# Without input, will open DuckDuckGo.com.
+# Anything else, it search it.
+
+# Source settings from .bemenurc
+. $HOME/.bemenurc
+
+pgrep -x dmenu && exit
+
+choice=$(echo "" | bemenu -i -p "Search DuckDuckGo:" $BEMENU_OPTIONS) || exit 1
+
+if [ "$choice" = ""  ]; then
+	$BROWSER "https://duckduckgo.com"
+else
+	$BROWSER "https://duckduckgo.com/?q=$choice&t=ffab&atb=v1-1"
+fi
diff --git a/dotfiles/.scripts/menuemoji b/dotfiles/.scripts/menuemoji
new file mode 100755
index 0000000..c21039f
--- /dev/null
+++ b/dotfiles/.scripts/menuemoji
@@ -0,0 +1,16 @@
+#!/bin/sh
+# Give dmenu list of all unicode characters to copy.
+# Shows the selected character in dunst if running.
+
+# Source settings from .bemenurc
+. $HOME/.bemenurc
+
+chosen=$(grep -v "#" ~/.emoji | bemenu -i -l 25 $BEMENU_OPTIONS)
+
+if [ -z $chosen ]; then
+    exit 0
+fi
+
+c=$(echo "$chosen" | sed "s/ .*//")
+echo "$c" | tr -d '\n' | wl-copy
+notify-send "'$c' copied to clipboard."
diff --git a/dotfiles/.scripts/menugrim b/dotfiles/.scripts/menugrim
new file mode 100755
index 0000000..6575487
--- /dev/null
+++ b/dotfiles/.scripts/menugrim
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+if ! [ -d $SCROT_DIR ]; then
+	mkdir -p $SCROT_DIR
+fi
+
+# Source settings from .bemenurc
+. $HOME/.bemenurc
+
+notify_saved() {
+    notify-send "screenshot has been saved in $SCROT_DIR" ;
+}
+
+notify_copied() {
+    notify-send "screenshot has been copied to clipboard" ;
+}
+
+case "$1" in
+    --quick|-q)
+        grim $SCROT_DIR/fullscreen-"$(date '+%y%m%d-%H%M-%S').png"; notify_saved ;;
+    *)
+        case "$(printf "a selected area\ncurrent window\nfull screen\na selected area (copy)\ncurrent window (copy)\nfull screen (copy)\n" | bemenu -l 6 -i -p "Screenshot which area?" $BEMENU_OPTIONS)" in
+            "a selected area") grim -g "$(slurp)" $SCROT_DIR/selected-"$(date '+%y%m%d-%H%M-%S').png"; notify_saved ;;
+            "current window") grim -g "$(swaygetcurrentwindow)" $SCROT_DIR/window-"$(date '+%y%m%d-%H%M-%S').png"; notify_saved ;;
+            "full screen") grim $SCROT_DIR/fullscreen-"$(date '+%y%m%d-%H%M-%S').png"; notify_saved ;;
+            "a selected area (copy)") grim -g "$(slurp)" - | wl-copy; notify_copied ;;
+            "current window (copy)") grim -g "$(swaygetcurrentwindow)" - | wl-copy; notify_copied ;;
+            "full screen (copy)") grim - | wl-copy; notify_copied ;;
+            *) exit 0 ;;
+        esac
+esac
+
+
diff --git a/dotfiles/.scripts/menuoutput b/dotfiles/.scripts/menuoutput
new file mode 100755
index 0000000..e714305
--- /dev/null
+++ b/dotfiles/.scripts/menuoutput
@@ -0,0 +1,16 @@
+#!/bin/sh
+# Change audio output for all streams and set as default using dmenu
+
+# Source settings from .dmenurc
+if ! [ -f "$HOME/.dmenurc" ]; then
+	cp /usr/share/dmenu/dmenurc $HOME/.dmenurc
+fi
+. $HOME/.dmenurc
+
+output=$(listsinks | dmenu -i $DMENU_OPTIONS)
+
+[ "$output" != "" ] || exit
+
+changeoutput $output
+
+notify-send "🔉 Audio output switched" "Audio output switched to '$output'"
diff --git a/dotfiles/.scripts/menuprompt b/dotfiles/.scripts/menuprompt
new file mode 100755
index 0000000..d744bf6
--- /dev/null
+++ b/dotfiles/.scripts/menuprompt
@@ -0,0 +1,7 @@
+#!/bin/sh
+# A dmenu binary prompt script.
+# Gives a dmenu prompt labeled with $1 to perform command $2.
+# For example:
+# `./prompt "Do you want to shutdown?" "shutdown -h now"`
+
+[ "$(printf "No\\nYes" | bemenu -i -p "$1" --nb darkred --hb red --hf white -nf gray )" = "Yes" ] && $2
diff --git a/dotfiles/.scripts/menurun b/dotfiles/.scripts/menurun
new file mode 100755
index 0000000..900a4c3
--- /dev/null
+++ b/dotfiles/.scripts/menurun
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Source settings from .bemenurc
+. $HOME/.bemenurc
+
+bemenu-run $BEMENU_OPTIONS
diff --git a/dotfiles/.scripts/menusession b/dotfiles/.scripts/menusession
new file mode 100755
index 0000000..fc5260b
--- /dev/null
+++ b/dotfiles/.scripts/menusession
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# Source settings from .bemenurc
+. $HOME/.bemenurc
+
+action=$(printf "logout\nsuspend\nreboot\nshutdown\n" | bemenu -p "What to do?" $BEMENU_OPTIONS)
+
+i3session $action
diff --git a/dotfiles/.scripts/mopidy_launch b/dotfiles/.scripts/mopidy_launch
new file mode 100755
index 0000000..d6bd4cf
--- /dev/null
+++ b/dotfiles/.scripts/mopidy_launch
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+killall -q mopidy
+mopidy
diff --git a/dotfiles/.scripts/notistats b/dotfiles/.scripts/notistats
new file mode 100755
index 0000000..0da5b7b
--- /dev/null
+++ b/dotfiles/.scripts/notistats
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+body=$(echo -e "Screen brightness:\t$(xbacklight -get)";
+lscpu | grep 'CPU MHz';
+sensors | grep 'Package id 0' | sed 's/Package id 0/CPU temp/' | awk '{print $1 $2 "\t" $3}';
+sensors | grep 'fan';
+echo print\(\'BAT0 drainage:\\t{}W\'.format\($(grep 'POWER_SUPPLY_POWER_NOW' /sys/class/power_supply/BAT0/uevent | awk -F '=' '{print $2}')/1000000\)\) | python;
+echo print\(\'BAT1 drainage:\\t{}W\'.format\($(grep 'POWER_SUPPLY_POWER_NOW' /sys/class/power_supply/BAT1/uevent | awk -F '=' '{print $2}')/1000000\)\) | python)
+
+notify-send "Hardware status" "$body"
diff --git a/dotfiles/.scripts/paccheck b/dotfiles/.scripts/paccheck
new file mode 100755
index 0000000..1284134
--- /dev/null
+++ b/dotfiles/.scripts/paccheck
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+ping -q -c 1 1.1.1.1 > /dev/null || exit
+
+notify-send "⬆ Update check" "Checking for updates..."
+
+sudo pacman -Sy
+upno=$(pacman -Qu | wc -l)
+
+notify-send "⬆ Update Check" "$upno updates are available"
diff --git a/dotfiles/.scripts/qmi_setup b/dotfiles/.scripts/qmi_setup
new file mode 100755
index 0000000..62fcc82
--- /dev/null
+++ b/dotfiles/.scripts/qmi_setup
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+###
+# This script automate the setup of QMI supported wwan devices.
+#
+# Tested on following environment:
+#   * Lenovo ThinkPad X220 (4286-CTO)
+#   * Gentoo/Linux, Linux Kernel 3.9.6
+#   * NTT Docomo UIM card (Xi LTE SIM)
+#   * Sierra Wireless, Inc. Gobi 3000 wireless wan module
+#     (FRU 60Y3257, vendor and device id is 1199:9013)
+#     memo:
+#       I recommend to check if your wwan module works fine
+#       for your mobile broadband provider with Windows
+#       especially if you imported the device from other country.
+#       You may have to initialize your device for your region.
+#   * Required kernel config (other modules may be also required):
+#     - qmi_wwan (CONFIG_USB_NET_QMI_WWAN)
+#     - qcserial (CONFIG_USB_SERIAL_QUALCOMM)
+#   * Required settings:
+#     - you may have to create /etc/qmi-network.conf.
+#       My qmi-network.conf has only a line "APN=mopera.net".
+#
+
+# your wwan device name created by qmi_wwan kernel module
+# check it with "ip a" or "ifconfig -a". it may be wwan0?
+WWAN_DEV=wwp0s20f0u6
+# your cdc_wdm modem location
+CDC_WDM=/dev/cdc-wdm0
+# this script uses following qmi commands
+QMICLI=/usr/bin/qmicli
+QMI_NETWORK=/usr/bin/qmi-network
+# the places of following commands vary depending on your distribution
+IFCONFIG=/usr/bin/ifconfig
+DHCPCD=/usr/bin/dhcpcd
+SUDO=/usr/bin/sudo
+
+function helpmsg {
+    echo "usage: $0 {start|stop|restart|status}"
+    exit 1
+}
+
+function qmi_start {
+    $COMMAND_PREFIX $IFCONFIG $WWAN_DEV up
+    $COMMAND_PREFIX $QMICLI -d $CDC_WDM --dms-set-operating-mode=online
+    if [ $? -ne 0 ]; then
+	echo "your wwan device may be RFKilled?"
+	exit 1
+    fi
+    $COMMAND_PREFIX $QMI_NETWORK $CDC_WDM start
+    $COMMAND_PREFIX $DHCPCD $WWAN_DEV
+}
+
+function qmi_stop {
+    $COMMAND_PREFIX $QMI_NETWORK $CDC_WDM stop
+    $COMMAND_PREFIX kill `cat /var/run/dhcpcd-${WWAN_DEV}.pid`
+    $COMMAND_PREFIX $IFCONFIG $WWAN_DEV down
+}
+
+function qmi_strength {
+    dbm=`$COMMAND_PREFIX $QMICLI -d $CDC_WDM --nas-get-signal-strength | tr "'" " " | grep Network | head -1 | awk '{print $4}'`
+    echo -n "Signal strength is "
+    if [ $dbm -ge -73 ]; then
+	echo -n 'Excellent'
+    elif [ $dbm -ge -83 ]; then
+	echo -n 'Good'
+    elif [ $dbm -ge -93 ]; then
+	echo -n 'OK'
+    elif [ $dbm -ge -109 ]; then
+	echo -n 'Marginal'
+    else
+	echo Unknown
+    fi
+    echo " (${dbm} dBm)"
+}
+
+function qmi_status {
+    $COMMAND_PREFIX $QMI_NETWORK $CDC_WDM status
+    qmi_strength
+}
+
+# check argument number
+if [ $# -ne 1 ]
+then
+    helpmsg
+fi
+
+# check permission
+if [ `whoami` != 'root' ]
+then
+    echo "warning: root permission required. setting command prefix to 'sudo'."
+    COMMAND_PREFIX=$SUDO
+fi
+
+# run commands
+case $1 in
+    start) qmi_start ;;
+    stop) qmi_stop ;;
+    restart) qmi_stop; qmi_start ;;
+    status) qmi_status ;;
+    *) helpmsg ;;
+esac
+
+
diff --git a/dotfiles/.scripts/setbg b/dotfiles/.scripts/setbg
new file mode 100755
index 0000000..29a11d7
--- /dev/null
+++ b/dotfiles/.scripts/setbg
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+swaymsg output "*" background ~/.config/wall1.png fill
diff --git a/dotfiles/.scripts/setbglblur b/dotfiles/.scripts/setbglblur
new file mode 100755
index 0000000..8de5e6f
--- /dev/null
+++ b/dotfiles/.scripts/setbglblur
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize))
+horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth))
+
+convert $1 -resize ${horizontal}x${vertical}\> ~/.config/lockwall.png
+convert ~/.config/lockwall.png -brightness-contrast -20,-20 -paint 1 -noise 0x8 -blur 9,9 ~/.config/lockwall.png
+convert ~/.config/lockwall.png ~/.config/lock.png -gravity center -composite ~/.config/lockwall.png
diff --git a/dotfiles/.scripts/setbglsimple b/dotfiles/.scripts/setbglsimple
new file mode 100755
index 0000000..ea2c5f2
--- /dev/null
+++ b/dotfiles/.scripts/setbglsimple
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize))
+horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth))
+
+convert $1 -resize ${horizontal}x${vertical}\> ~/.config/lockwall.png
+convert ~/.config/lockwall.png ~/.config/lock.png -gravity center -composite ~/.config/lockwall.png
diff --git a/dotfiles/.scripts/swaygetcurrentwindow b/dotfiles/.scripts/swaygetcurrentwindow
new file mode 100755
index 0000000..e6403a6
--- /dev/null
+++ b/dotfiles/.scripts/swaygetcurrentwindow
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+xydata=$(swaymsg -t get_tree | grep -B 5 '"focused": true' | head -n 4 | tr -d '\n\r' | sed -e 's/[^0-9,]//g' -e 's/,/ /2' -e 's/,/x/2')
+
+echo $xydata
diff --git a/dotfiles/.scripts/swaykbd b/dotfiles/.scripts/swaykbd
new file mode 100755
index 0000000..a76f833
--- /dev/null
+++ b/dotfiles/.scripts/swaykbd
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+swaymsg -r -t get_inputs | awk '/1:1:AT_Translated_Set_2_keyboard/;/xkb_active_layout_name/' | grep -A1 '\b1:1:AT_Translated_Set_2_keyboard\b' | grep "xkb_active_layout_name" | awk -F '"' '{print $4}'
+
+swaymsg \
+  --type subscribe \
+  --monitor \
+  --raw \
+  '["input"]' | \
+  jq \
+    --raw-output \
+    --unbuffered \ '
+      select(.change == "xkb_layout") |
+        .input.xkb_active_layout_name |
+        sub(" \\(US\\)"; "")
+    '
+
+case $BLOCK_BUTTON in
+    1) echo "TO-DO" ;;
+esac;
diff --git a/dotfiles/.scripts/swayresize b/dotfiles/.scripts/swayresize
new file mode 100755
index 0000000..9ae94c0
--- /dev/null
+++ b/dotfiles/.scripts/swayresize
@@ -0,0 +1,27 @@
+#!/bin/sh
+# This script was made by `goferito` on Github.
+# Some cleanup by Luke.
+
+[ -z "$1" ] && echo "No direction provided" && exit 1
+distanceStr="2 px or 2 ppt"
+
+moveChoice() {
+  swaymsg resize "$1" "$2" "$distanceStr" | grep '"success":true' || \
+    swaymsg resize "$3" "$4" "$distanceStr"
+}
+
+case $1 in
+  up)
+    moveChoice grow up shrink down
+    ;;
+  down)
+    moveChoice shrink up grow down
+    ;;
+  left)
+    moveChoice shrink right grow left
+    ;;
+  right)
+    moveChoice grow right shrink left
+    ;;
+esac
+
diff --git a/dotfiles/.scripts/swaystart b/dotfiles/.scripts/swaystart
new file mode 100755
index 0000000..46f6f0e
--- /dev/null
+++ b/dotfiles/.scripts/swaystart
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+export SCROT_DIR=$HOME/Pictures/screenshots/
+export GDK_BACKEND=wayland
+export EGL_PLATFORM=wayland
+export CLUTTER_PLATFORM=wayland
+export SDL_VIDEODRIVER=wayland
+export QT_QPA_PLATFORM=wayland-egl
+export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
+export QT_QPA_PLATFORMTHEME="qt5ct"
+export _JAVA_AWT_WM_NONREPARENTING=1
+sway --my-next-gpu-wont-be-nvidia
diff --git a/dotfiles/.scripts/sxiv-rifle b/dotfiles/.scripts/sxiv-rifle
new file mode 100755
index 0000000..0bdd892
--- /dev/null
+++ b/dotfiles/.scripts/sxiv-rifle
@@ -0,0 +1,48 @@
+#!/bin/sh
+# Compatible with ranger 1.6.0 through 1.7.*
+#
+# This script searches image files in a directory, opens them all with sxiv and
+# sets the first argument to the first image displayed by sxiv.
+#
+# This is supposed to be used in rifle.conf as a workaround for the fact that
+# sxiv takes no file name arguments for the first image, just the number.  Copy
+# this file somewhere into your $PATH and add this at the top of rifle.conf:
+#
+#   mime ^image, has sxiv, X, flag f = path/to/this/script -- "$@"
+#
+# Implementation notes: this script is quite slow because of POSIX limitations
+# and portability concerns. First calling the shell function 'abspath' is
+# quicker than calling 'realpath' because it would fork a whole process, which
+# is slow. Second, we need to append a file list to sxiv, which can only be done
+# properly in two ways: arrays (which are not POSIX) or \0 sperated
+# strings. Unfortunately, assigning \0 to a variable is not POSIX either (will
+# not work in dash and others), so we cannot store the result of listfiles to a
+# variable.
+
+if [ $# -eq 0 ]; then
+    echo "Usage: ${0##*/} PICTURES"
+    exit
+fi
+
+[ "$1" = '--' ] && shift
+
+abspath () {
+    case "$1" in
+        /*) printf "%s\n" "$1";;
+        *)  printf "%s\n" "$PWD/$1";;
+    esac
+}
+
+listfiles () {
+    find -L "$(dirname "$target")" -maxdepth 1 -type f -iregex \
+      '.*\(jpe?g\|bmp\|png\|gif\)$' -print0 | sort -z
+}
+
+target="$(abspath "$1")"
+count="$(listfiles | grep -m 1 -ZznF "$target" | cut -d: -f1)"
+
+if [ -n "$count" ]; then
+    listfiles | xargs -0 sxiv -n "$count" --
+else
+    sxiv -- "$@" # fallback
+fi
diff --git a/dotfiles/.scripts/vifm_launch b/dotfiles/.scripts/vifm_launch
new file mode 100755
index 0000000..07b6473
--- /dev/null
+++ b/dotfiles/.scripts/vifm_launch
@@ -0,0 +1,15 @@
+#!/bin/sh
+export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}"
+
+function cleanup {
+    rm "$FIFO_UEBERZUG" 2>/dev/null
+    pkill -P $$ 2>/dev/null
+}
+
+rm "$FIFO_UEBERZUG" 2>/dev/null
+mkfifo "$FIFO_UEBERZUG"
+trap cleanup EXIT
+tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash &
+
+vifm
+cleanup
diff --git a/dotfiles/.scripts/waybar_launch b/dotfiles/.scripts/waybar_launch
new file mode 100755
index 0000000..6fc9200
--- /dev/null
+++ b/dotfiles/.scripts/waybar_launch
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Terminate already running bar instance
+killall -q waybar
+
+# Wait until the processes have been shut down
+while pgrep -u $UID -x waybar >/dev/null; do sleep 1; done
+
+waybar
diff --git a/dotfiles/.scripts/xway b/dotfiles/.scripts/xway
new file mode 100755
index 0000000..b8e5ab8
--- /dev/null
+++ b/dotfiles/.scripts/xway
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# Certain Xorg apps require certain env variable to correctly work through xwayland
+
+export GDK_BACKEND=x11
+export EGL_PLATFORM=x11
+export CLUTTER_PLATFORM=x11
+export SDL_VIDEODRIVER=x11
+
+$1
-- 
cgit v1.2.3