From 332b24720dd48574981fa49bd12b84519f21aa01 Mon Sep 17 00:00:00 2001 From: qvalentin Date: Sun, 19 Dec 2021 14:57:13 +0100 Subject: [PATCH] (scripts) minor changes --- .scripts/changebg | 10 +++++-- .scripts/dmenu-with-suggestions | 51 +++++++++++++++++++++++++++++++++ .scripts/toggleAudio | 2 ++ .scripts/zathuraSynctexVsCode | 5 ++++ 4 files changed, 66 insertions(+), 2 deletions(-) create mode 100755 .scripts/dmenu-with-suggestions create mode 100755 .scripts/zathuraSynctexVsCode diff --git a/.scripts/changebg b/.scripts/changebg index d75fe66..0ff1d13 100755 --- a/.scripts/changebg +++ b/.scripts/changebg @@ -37,13 +37,19 @@ fi echo $PATH_TO_IMG # overwrite .Xresources file cat ~/.cache/wal/colors.Xresources > ~/.Xresources -echo "\nXcursor.theme: Breeze" >> ~./Xresources +echo "Xcursor.theme: Breeze" >> ~/.Xresources +#echo "*.alpha: 0.20" >> ~/.Xresources # merge it into xrdb xrdb -merge ~/.Xresources -#emacsclient -e '(my-load-xresources)' +cat >> ~/.cache/wal/colors-rofi-dark.rasi<< EOF +element-text, element-icon { + background-color: inherit; + text-color: inherit; +} +EOF xmobar_change killall xmobar diff --git a/.scripts/dmenu-with-suggestions b/.scripts/dmenu-with-suggestions new file mode 100755 index 0000000..678e73d --- /dev/null +++ b/.scripts/dmenu-with-suggestions @@ -0,0 +1,51 @@ +#!/bin/sh + +. "${HOME}/.cache/wal/colors.sh" +cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"} +if [ -d "$cachedir" ]; then + cache=$cachedir/dmenu_run + historyfile=$cachedir/dmenu_history +else # if no xdg dir, fall back to dotfiles in ~ + cache=$HOME/.dmenu_cache + historyfile=$HOME/.dmenu_history +fi + +IFS=: +if stest -dqr -n "$cache" $PATH; then + stest -flx $PATH | sort -u > "$cache" +fi +unset IFS + +awk -v histfile=$historyfile ' + BEGIN { + while( (getline < histfile) > 0 ) { + sub("^[0-9]+\t","") + print + x[$0]=1 + } + } !x[$0]++ ' "$cache" \ + | dmenu -nb "$color0" -nf "$color15" -sb "$color1" -sf "$color15" "$@" \ + | awk -v histfile=$historyfile ' + BEGIN { + FS=OFS="\t" + while ( (getline < histfile) > 0 ) { + count=$1 + sub("^[0-9]+\t","") + fname=$0 + history[fname]=count + } + close(histfile) + } + + { + history[$0]++ + print + } + + END { + if(!NR) exit + for (f in history) + print history[f],f | "sort -t '\t' -k1rn >" histfile + } + ' \ + | while read cmd; do ${SHELL:-"/bin/sh"} -c "$cmd" & done diff --git a/.scripts/toggleAudio b/.scripts/toggleAudio index a0ac61f..79c2bd4 100755 --- a/.scripts/toggleAudio +++ b/.scripts/toggleAudio @@ -11,3 +11,5 @@ if [ "$current" = $headphone ]; then else pactl set-default-sink $headphone fi + +pkill xmobar && xmobar& diff --git a/.scripts/zathuraSynctexVsCode b/.scripts/zathuraSynctexVsCode new file mode 100755 index 0000000..31116c1 --- /dev/null +++ b/.scripts/zathuraSynctexVsCode @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +zathura $@ + +vscodium --reuse-window