commit f9412cac5bb970004de6fa6e79aec68131de9304
parent 3f1f552b4744b23083c828266da88e91eedc413b
Author: Tomas Nemec <nemi@skaut.cz>
Date: Thu, 16 Dec 2021 08:33:52 +0100
update
Diffstat:
4 files changed, 78 insertions(+), 28 deletions(-)
diff --git a/cht b/cht
@@ -1,10 +1,44 @@
#!/bin/zsh
# Change colorscheme
-# usage: cht <light|dark>
-theme="$1"
-themes=(light dark)
-curr_theme=${THEME:-$CONFIG/theme}
+local themes=(light dark)
+local curr_theme=${THEME:-$CONFIG/theme}
+local p_bg=0
+local scheme=''
+local theme=''
+
+function usage() {
+ cat <<EOF
+Change colorscheme for environment
+
+USAGE:
+ cht [FLAGS]
+
+FLAGS:
+ -b from background
+ -c from scheme (wal theme list)
+ -t theme <light|dark>
+EOF
+}
+
+local opt
+while getopts hbt:c: opt; do
+ case $opt in
+ b)
+ p_bg=1
+ ;;
+ t)
+ theme=$OPTARG
+ ;;
+ c)
+ scheme=$OPTARG
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
+ esac
+done
if [[ -z "$theme" ]]; then
theme="$(cat $curr_theme)"
@@ -13,22 +47,32 @@ fi
if (($themes[(Ie)$theme])); then
echo "$theme" > $curr_theme
- img="$(cat $HOME/.fehbg | sed -n '2p' | cut -d ' ' -f 4)"
- img="${img[2,-2]}" # remove quotes
- if [[ ! -e "$img" ]]; then
- echo "Image not found inside $HOME/.fehbg!" >&2
- exit 1
- fi
+ if [[ $p_bg -eq 1 ]]; then
+ img="$(cat $HOME/.fehbg | sed -n '2p' | cut -d ' ' -f 4)"
+ img="${img[2,-2]}" # remove quotes
+ if [[ ! -e "$img" ]]; then
+ echo "Image not found inside $HOME/.fehbg!" >&2
+ exit 1
+ fi
- # Generate colors from wallpaper
- if [[ "$theme" == "dark" ]]; then
- wal -n -i "$img" -o walset.zsh
+ # Generate colors from wallpaper
+ if [[ "$theme" == 'dark' ]]; then
+ wal -n -i "$img" -o walset.zsh
+ else
+ wal -n -i "$img" -o walset.zsh -l
+ fi
else
- wal -n -i "$img" -o walset.zsh -l
+ if [[ -n "$scheme" ]]; then
+ # Generate colors from scheme
+ if [[ "$theme" == 'dark' ]]; then
+ wal --theme $scheme -o walset.zsh
+ else
+ wal --theme $scheme -o walset.zsh -l
+ fi
+ fi
fi
else
echo "'$theme' is not a valid theme"
- echo "USAGE: cht <light|dark>"
+ usage
exit 1
fi
-
diff --git a/pulseaudio-control b/pulseaudio-control
@@ -98,9 +98,9 @@ function getNicknameFromProp() {
}
# Saves the status of the sink passed by parameter into a variable named
-# `isMuted`.
+# `IS_MUTED`.
function getIsMuted() {
- isMuted=$(pactl list sinks | grep -E "^Sink #$1\$" -A 15 | awk '/Mute: / {print $2}')
+ IS_MUTED=$(pactl list sinks | grep -E "^Sink #$1\$" -A 15 | awk '/Mute: / {print $2}')
}
@@ -172,7 +172,7 @@ function volMute() {
fi
if [ "$1" = "toggle" ]; then
getIsMuted "$curSink"
- if [ "$isMuted" = "yes" ]; then
+ if [ "$IS_MUTED" = "yes" ]; then
pactl set-sink-mute "$curSink" "no"
else
pactl set-sink-mute "$curSink" "yes"
@@ -266,7 +266,7 @@ function showOSD() {
fi
getCurVol "$curSink"
getIsMuted "$curSink"
- qdbus org.kde.kded /modules/kosd showVolume "$VOL_LEVEL" "$isMuted"
+ qdbus org.kde.kded /modules/kosd showVolume "$VOL_LEVEL" "$IS_MUTED"
}
@@ -322,7 +322,7 @@ function output() {
getNickname "$curSink"
# Showing the formatted message
- if [ "$isMuted" = "yes" ]; then
+ if [ "$IS_MUTED" = "yes" ]; then
# shellcheck disable=SC2034
VOL_ICON=$ICON_MUTED
echo "${COLOR_MUTED}$(eval echo "$FORMAT")${END_COLOR}"
@@ -336,7 +336,7 @@ function usage() {
echo "\
Usage: $0 [OPTION...] ACTION
-Options: [defaults]
+Options:
--autosync | --no-autosync
Whether to maintain same volume for all programs.
Default: $AUTOSYNC
@@ -362,6 +362,7 @@ Options: [defaults]
* \$VOL_LEVEL
* \$ICON_SINK
* \$SINK_NICKNAME
+ * \$IS_MUTED (yes/no)
Default: $FORMAT
--icons-volume <icon>[,<icon>...]
Icons for volume, from lower to higher.
@@ -453,7 +454,7 @@ while [[ "$1" = --* ]]; do
ICON_SINK="$val"
;;
--icons-volume)
- IFS=, read -r -a ICONS_VOLUME <<< "$val"
+ IFS=, read -r -a ICONS_VOLUME <<< "${val//[[:space:]]/}"
;;
--volume-max)
VOLUME_MAX="$val"
@@ -462,7 +463,7 @@ while [[ "$1" = --* ]]; do
VOLUME_STEP="$val"
;;
--sink-blacklist)
- IFS=, read -r -a SINK_BLACKLIST <<< "$val"
+ IFS=, read -r -a SINK_BLACKLIST <<< "${val//[[:space:]]/}"
;;
--sink-nicknames-from)
SINK_NICKNAMES_PROP="$val"
diff --git a/sfopen b/sfopen
@@ -4,13 +4,14 @@ url="$1"
[[ -z $url ]] && exit
if [[ $url =~ 'youtube' ]]; then
- setsid -f mpv --ytdl=format=best "$url"
+ setsid -f $BROWSER --new-window "$url"
+ # setsid -f mpv --ytdl=format=best "$url"
elif [[ $url =~ 'odysee' ]]; then
setsid -f mpv "$url"
elif [[ $url =~ 'reddit' ]]; then
- $BROWSER --new-window "$url"
+ setsid -f $BROWSER --new-window "$url"
elif [[ $url =~ 'https' ]]; then
- $BROWSER --new-window "$url"
+ setsid -f $BROWSER --new-window "$url"
else
xdg-open "$url"
fi
diff --git a/walset.zsh b/walset.zsh
@@ -1,6 +1,10 @@
#!/usr/bin/env zsh
-# Update neovim colorschemes
+theme=`cat $THEME`
+
for sname in $(nvr --serverlist); do
nvr --servername "$sname" -cc "lua require('tms.u.reload').colors()" --nostart -s &
done
+
+# Glab-cli
+sed -i "s/glamour_style.*/glamour_style: $theme/" $CONFIG/glab-cli/config.yml