updated some scripts and uploaded some new ones

Former-commit-id: 6c9faff508
Former-commit-id: 17d19dad6bdde82ff8c2bcc983f87a49bb4a5e6f
Former-commit-id: 4f66d0d17a4bb9ceb3eedf158bae309fa71fb8b1
This commit is contained in:
elena 2017-12-07 09:45:55 +02:00
parent 97061a15ce
commit 9a2fdf5c79
32 changed files with 299 additions and 188 deletions

View file

@ -1,4 +1,6 @@
#!/bin/bash
URL='https://www.accuweather.com/en/us/buffalo-ny/14202/weather-forecast/349726'
TEMP="$(wget -q -O- "$URL" | awk -F\' '/acm_RecentLocationsCarousel\.push/{print $12"°F" }'| head -1)"
echo "$TEMP"
#TEMP="$(wget -q -O- "$URL" | awk -F\' '/acm_RecentLocationsCarousel\.push/{print $12"°F" }'| head -1)"
TEMP="$(wget -q -O- "$URL" | grep temp_f | awk '{print $3}' | cut -d "'" -f 2)"
echo "$TEMP°F"

View file

@ -8,20 +8,28 @@ STATE="$(echo $INFO | grep "state" | awk '{print $2}')"
# Note: I cut off the percentage sign so i can later compare POWER as an int
POWER="$(echo $INFO | grep "percentage" | awk '{print $2}' | head -c -2)"
# TODO!
# With icons
# if [[ "$STATE" = "discharging" ]]; then
# if [ "$POWER" -ge "85" ]; then
# echo " $POWER%"
# elif [ "$POWER" -ge "60" ]; then
# echo " $POWER%"
# elif [ "$POWER" -ge "35" ]; then
# echo " $POWER%"
# elif [ "$POWER" -ge "10" ]; then
# echo " $POWER%"
# else
# echo " $POWER%"
# fi
# else
# # State = fully charged or charging
# echo " $POWER%"
# fi
# Without icons
if [[ "$STATE" = "discharging" ]]; then
if [ "$POWER" -ge "85" ]; then
echo "$POWER%"
elif [ "$POWER" -ge "60" ]; then
echo "$POWER%"
elif [ "$POWER" -ge "35" ]; then
echo "$POWER%"
elif [ "$POWER" -ge "10" ]; then
echo "$POWER%"
else
echo "$POWER%"
fi
echo "bat* $POWER%"
else
# State = fully charged or charging
echo "$POWER%"
echo "bat $POWER%"
fi

View file

@ -11,8 +11,17 @@ CPU="$[100-$(vmstat 1 2|tail -1|awk '{printf "%d", $15}')]"
# fi
# Lazy whitespace padding
# With icon
# if [ "$CPU" -ge "10" ]; then
# echo " $CPU%"
# else
# echo " $CPU%"
# fi
# Just text
if [ "$CPU" -ge "10" ]; then
echo "$CPU%"
echo "cpu $CPU%"
else
echo "$CPU%"
fi
echo "cpu $CPU%"
fi

View file

@ -1,4 +1,6 @@
#df -h | awk '$NF=="/"{printf "Disk Usage: %d/%dGB (%s)\n", $3,$2,$5}'
# show only free space
df -h | awk '$NF=="/"{printf " %dGB\n", ($2-$3)}'
#df -k -h . | awk '$NF=="/"{printf " %dGB\n", ($2-$3)}'
df -k -h /dev/sda1 | tail -1 | awk '{printf " %sB\n", $4}'

View file

@ -1 +1 @@
neofetch --disable gpu memory terminal icons theme shell packages model kernel cpu wm --source ~/Themes/ascii_heart_small
neofetch --backend w3m --source "$(cat ~/.wally/cat .wally/path_to_wallpaper)" --crop_offset northeast --crop_mode fill --disable gpu cpu memory icons theme wm model --block_range 1 7 --color_blocks on --size 190px

View file

@ -1 +0,0 @@
redshift -O 3000

View file

@ -1,9 +0,0 @@
#NEEDS WORK!
redshift -p > /home/elena/redtemp
CURRENT="$(cat /home/elena/redtemp | grep "temp" | awk '{print $3;}')"
DAY = "5500K"
if [ "$CURRENT" == "$DAY" ]
then echo "REDSHIFT OFF"
else echo "REDSHIFT ON"
fi

9
Scripts/flux_indicator.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
REDSHIFT="$(ps cax | grep redshift)"
if [ ${#REDSHIFT} -eq "0" ]; then
#echo "redshift is not running."
# run redshift
echo "  "
else
echo "  "
fi

View file

@ -1,4 +1,35 @@
# Focuses the first window with some string in its title
#!/bin/bash
# Focus specific window
# Default (no options): focus window that has a specific string in its title
# Focus by pid (-i): focus window that has a specific pid
# Focus by priority (-p): focuses the window with the highest priority, if it exists, else it focuses the next one etc.
# Use: focus.sh mystring
WINDOWID="$(wmctrl -l | grep -v "wmctrl" | grep -m 1 "$1" | awk '{print $1}')"
wmctrl -i -a $WINDOWID
# focus.sh -i pid
# focus.sh -p str1 str2 str3
if [[ "$1" = "-i" ]]; then
# focus by pid
PID="$(echo $2)"
wmctrl -i -a $(wmctrl -lp | grep -v "$0" | grep $PID | awk '{print $1}')
elif [[ "$1" = "-p" ]]; then
for var in "${@:2}"
do
WINDOWID="$(wmctrl -l | grep -v "$0" | grep -m 1 "$var" | awk '{print $1}')"
if [ ${#WINDOWID} -ne "0" ]; then
wmctrl -i -a $WINDOWID
break
fi
done
else
# focus by string in window title
WINDOWID="$(wmctrl -l | grep -v "$0" | grep -m 1 "$1" | awk '{print $1}')"
wmctrl -i -a $WINDOWID
fi
# if [[ $(ls -A) ]]; then
# echo "there are files"
# else
# echo "no files found"
# fi

View file

@ -1 +1,3 @@
rofi -show combi -combi-modi "window,run" -lines 12 -width 100 -padding 80 -fullscreen -font "Hurmit Nerd Font 30" -separator-style "none"
# rofi -show combi -combi-modi "window,run" -lines 8 -width 100 -padding 150 -font "mononoki Nerd Font Regular 35" -separator-style "none"
rofi -show combi -combi-modi "window,run" -lines 10 -width 50 -padding 80 -font "proggycleanttce Nerd Font Regular 12" -separator-style "none" -no-show-match

View file

@ -1,3 +1,3 @@
#!/bin/bash
# For testing purposes
notify-send 'Hello world!' 'This is an example notification.' --icon=dialog-information

17
Scripts/inet_noipaddr.sh Executable file
View file

@ -0,0 +1,17 @@
# needs work! not thoroughly tested...
# Replace with your own interface names here
WIRELESS_IF="wlp3s0"
WIRED_IF="enp2s0f0"
WIFI="$(ifconfig | grep -A 1 $WIRELESS_IF | grep "inet" | awk '{print $2}')"
ETHER="$(ifconfig | grep -A 1 $WIRED_IF | grep "inet" | awk '{print $2}')"
if [ ${#ETHER} -eq "0" ]; then
if [ ${#WIFI} -eq "0" ]; then
echo ""
else
echo ""
fi
else
echo ""
fi

View file

@ -1,9 +1,28 @@
KEYS="$(xset -q | grep Caps | awk '{print $4 " " $8;}')"
CAPS="$(echo $KEYS | awk '{if ($1 == "off") {print ""} else {print ""}}')"
NUM="$(echo $KEYS | awk '{if ($2 == "off") {print ""} else {print ""}}')"
#!/bin/bash
#XSET_OUTPUT="$(xset -q)"
#KEYS="$(echo $XSET_OUTPUT | grep Caps | awk '{print $4 " " $8;}')"
#CAPS="$(echo $KEYS | awk '{if ($1 == "off") {print ""} else {print ""}}')"
#NUM="$(echo $KEYS | awk '{if ($2 == "off") {print ""} else {print ""}}')"
#echo " "$CAPS $NUM $LANG
echo " "$CAPS $NUM
# if [ $LANG_CODE -gt "1000" ]; then
# # greek is around 1000-1003, and i only have gr and en so this is enough
# LANG="gr"
# else
# # english
# LANG="en"
# fi
#LANG_CODE="$(xset -q | grep LED | awk '{print $10}')"
LANG="$(xset -q | grep LED | awk '{if ($10 >= 1000) {print "gr"} else {print "en"}}')"
echo "$LANG "
# 
# C N
#    both off
#    num on

View file

@ -1 +0,0 @@
chromium-browser --new-window https://mail.google.com/mail/u/0/#inbox https://outlook.live.com/owa/ https://webmail.uth.gr/login.php https://mail.yahoo.com/

82
Scripts/music-notify.sh Executable file
View file

@ -0,0 +1,82 @@
#!/bin/bash
# Prints media info from mpd, youtube
# Priority:
# 1. Prints the title of the mpd song playing, while scrolling (WORK IN PROGRESS)
# 2. Prints the title of the first open YouTube window, while scrolling (sexy!)
# NOTE: It works if the tab is in focus, so seperate the youtube tab from
# the rest of the browser so you don't have to keep it in focus and the script will work.
# Note: on tint2, set interval=0 and continuous output=2 or larger
# (in general continuous output should be larger than sleep time)
while :
do
# Seach for mpd info, youtube and pandora windows
MPDSTATE="$(mpc | head -2 | tail -1 | awk '{print $1}')"
#NCMPCPP="$(ps cax | grep ncmpcpp)"
YOUTUBE="$(wmctrl -l | grep -v "wmctrl" | grep -m 1 "YouTube")"
PANDORA="$(wmctrl -l | grep -v "wmctrl" | grep -m 1 "Pandora Radio")"
# Grab youtube window title
# Depending on your browser, uncomment the correct INPUT line (and comment the others)
# Vivaldi
if [[ "$MPDSTATE" != "[playing]" ]]; then
# Grab youtube window title
# Depending on your browser, uncomment the correct INPUT line (and comment the others)
# Vivaldi
#INPUT="$(echo $YOUTUBE | awk -v skipstart=3 -v skipend=2 '{delim = ""; for (i=skipstart+1;i<=NF-skipend;i++) {printf delim "%s", $i; delim = OFS};}')"
# Mozilla
INPUT="$(echo $YOUTUBE | awk -v skipstart=3 -v skipend=3 '{delim = ""; for (i=skipstart+1;i<=NF-skipend;i++) {printf delim "%s", $i; delim = OFS};}')"
# Chromium/Mozilla
# INPUT="$(echo $YOUTUBE | awk -v skipstart=3 -v skipend=4 '{delim = ""; for (i=skipstart+1;i<=NF-skipend;i++) {printf delim "%s", $i; delim = OFS};}')"
else
INPUT="$(mpc | head -1)"
fi
# If the song has changed, start from the beginning and send a notification
if [[ "$INPUT" != "$OLD_INPUT" ]]; then
i=1
# Uncomment this to enable notifying every time the song changes
# if [ ${#INPUT} -ne "0" ]; then
# notify-send " Now playing:" "$INPUT"
# fi
fi
# Save old input for the next check
OLD_INPUT="$(echo $INPUT)"
# Optional: remove multibyte characters
# (they dont show up properly while scrolling due to "cut -c" being identical to "cut -b")
INPUT="$(echo $INPUT | tr -dc '[:print:]')"
INPUT_LENGTH="$(echo ${#INPUT})"
# If no youtube window is found
#if [ ${#YOUTUBE} -eq "0" ] && [ ${#NCMPCPP} -eq "0" ]; then
if [ ${#YOUTUBE} -eq "0" ] && [[ "$MPDSTATE" != "[playing]" ]]; then
#echo "  "
echo "  "
#echo "  "
#echo "  "
#echo " "
else
if [[ "$MPDSTATE" != "[playing]" ]]; then
echo "  "
else
echo "  "
fi
fi
# For fat bars/panels, I add this newline so the previous output is not visible
echo ""
sleep 1
done
# general method to exlude fields
# awk -v skipstart=1 -v skipend=1 '{delim = ""; for (i=skipstart+1;i<=NF-skipend;i++) {printf delim "%s", $i; delim = OFS}; printf "\n"}'

View file

@ -18,7 +18,7 @@
# (where 12 is the offset (zero-based) and 5 is the length)
# Limit for scrolling text
LIMIT=30
LIMIT=26
#SEPERATOR=" --- "
#SEPERATOR=" -- "
#SEPERATOR=" ~~~ "
@ -51,17 +51,23 @@ do
# Grab youtube window title
# Depending on your browser, uncomment the correct INPUT line (and comment the others)
# Vivaldi
INPUT="$(echo $YOUTUBE | awk -v skipstart=3 -v skipend=2 '{delim = ""; for (i=skipstart+1;i<=NF-skipend;i++) {printf delim "%s", $i; delim = OFS};}')"
#INPUT="$(echo $YOUTUBE | awk -v skipstart=3 -v skipend=2 '{delim = ""; for (i=skipstart+1;i<=NF-skipend;i++) {printf delim "%s", $i; delim = OFS};}')"
# Chromium
# Mozilla
INPUT="$(echo $YOUTUBE | awk -v skipstart=3 -v skipend=3 '{delim = ""; for (i=skipstart+1;i<=NF-skipend;i++) {printf delim "%s", $i; delim = OFS};}')"
# Chromium/Mozilla
# INPUT="$(echo $YOUTUBE | awk -v skipstart=3 -v skipend=4 '{delim = ""; for (i=skipstart+1;i<=NF-skipend;i++) {printf delim "%s", $i; delim = OFS};}')"
else
INPUT="$(mpc | head -1)"
fi
# If the song has changed, start from the beginning
# If the song has changed, start from the beginning and send a notification
if [[ "$INPUT" != "$OLD_INPUT" ]]; then
i=1
if [ ${#INPUT} -ne "0" ]; then
notify-send " Now playing:" "$INPUT"
fi
fi
# Save old input for the next check
@ -91,7 +97,7 @@ do
#echo -e -n "$INPUT"
#Justify - left
#SPACES=$(($LIMIT-$INPUT_LENGTH+1))
#SPACES=$(($LIMIT-$INPUT_LENGTH+1+1))
#echo -n "$INPUT" | awk -v spaces=$SPACES '{printf "%s%*.s\n", $0, spaces, " "}'
#Justify - center
@ -100,7 +106,7 @@ do
else
LOOPTAIL="$(echo $INPUT | cut -c -$LIMIT)"
FULLSTRING="$(echo "$INPUT$SEPERATOR$LOOPTAIL")"
FULLSTRING="$(echo "$INPUT""$SEPERATOR""$LOOPTAIL")"
#FULLSTRING="$(echo $INPUT | sed "s/$/$SEPERATOR/" | sed "s/$/$LOOPTAIL/" )"

View file

@ -1 +0,0 @@
redshift -O 6500

View file

@ -1 +0,0 @@
chromium-browser www.pandora.com

View file

@ -1,12 +0,0 @@
#!/bin/bash
declare -a color
declare -a XCOLOR_OLD
declare -a XCOLOR_NEW
# Create array with old colors
for (( i = 0; i < 8; i++ )); do
color[$i]="$(echo color$i)"
XCOLOR_OLD[$i]="$(cat ~/.Xresources | grep -m 1 ${color[$i]} | awk '{print $2}')"
echo ${XCOLOR_OLD[$i]}
done

1
Scripts/pytyle_restart Executable file
View file

@ -0,0 +1 @@
killall pytyle && sleep 1 && pytyle &

View file

@ -1,46 +0,0 @@
# Scrolling text
LIMIT=12
SEPERATOR=" ~~~ "
SEPERATOR_LENGTH="$(echo ${#SEPERATOR})"
i=1
while :
do
# Get input and create the full string that will be used
INPUT="$@"
INPUT_LENGTH="$(echo ${#INPUT})"
LOOPTAIL="$(echo $INPUT | cut -c -$LIMIT)"
FULLSTRING="$(echo "$INPUT$SEPERATOR$LOOPTAIL")"
if [ $INPUT_LENGTH -le $LIMIT ]; then
# Song has a smaller title than the limit, so no need to scroll.
echo -n "  "
#echo -e -n "$INPUT"
#Justify - left
#SPACES=$(($LIMIT-$INPUT_LENGTH+1))
#echo -n "$INPUT" | awk -v spaces=$SPACES '{printf "%s%*.s\n", $0, spaces, " "}'
#Justify - center
SPACES_AFTER=$(($LIMIT-$(((${#INPUT}+$LIMIT)/2))))
printf "%*s\n" $(((${#INPUT}+$LIMIT)/2 + 1)) "$INPUT" | awk -v spaces=$SPACES_AFTER '{printf "%s%*.s\n", $0, spaces, " "}'
else
LOOPTAIL="$(echo $INPUT | cut -c -$LIMIT)"
FULLSTRING="$(echo "$INPUT$SEPERATOR$LOOPTAIL")"
echo -n "  "
# Show only LIMIT characters, from i to i+LIMIT. Output scrolls due to incrementing i
echo -n $FULLSTRING | cut -c $i-$(($LIMIT+$i))
#echo -n $FULLSTRING | awk -v charlimit="$LIMIT" -v start="$i" '{print substr($0,start,charlimit)}'
# If we have shown the full string, start over
if [ $i -eq $(($INPUT_LENGTH+$SEPERATOR_LENGTH)) ]; then
i=0
fi
i=$(($i+1))
fi
sleep 1
done

View file

@ -1,73 +0,0 @@
#!/bin/bash
# Run as follows: ./scrolling_title.sh mystring
# It will look for "mystring" in all active windows and display the window title that includes this string.
# Case sensitive!
# Limit for scrolling text
LIMIT=30
#SEPERATOR=" --- "
#SEPERATOR=" -- "
#SEPERATOR=" ~~~ "
SEPERATOR=" ~~ "
#SEPERATOR=" <> "
SEPERATOR_LENGTH="$(echo ${#SEPERATOR})"
i=1
while :
do
# For debugging purposes
# printf "|%02d|" $i
INPUT="$(wmctrl -l | grep -v "wmctrl" | grep -m 1 $1 | awk -v skipstart=3 -v skipend=0 '{delim = ""; for (i=skipstart+1;i<=NF-skipend;i++) {printf delim "%s", $i; delim = OFS};}')"
# If the output has changed, start from the beginning
if [[ "$INPUT" != "$OLD_INPUT" ]]; then
i=1
fi
# Save old input for the next check
OLD_INPUT="$(echo $INPUT)"
# Optional: remove multibyte characters
# (they dont show up properly while scrolling due to "cut -c" being identical to "cut -b")
INPUT="$(echo $INPUT | tr -dc '[:print:]')"
INPUT_LENGTH="$(echo ${#INPUT})"
if [ $INPUT_LENGTH -le $LIMIT ]; then
# Song has a smaller title than the limit, so no need to scroll.
echo -n "  "
#echo -e -n "$INPUT"
#Justify - left
#SPACES=$(($LIMIT-$INPUT_LENGTH+1))
#echo -n "$INPUT" | awk -v spaces=$SPACES '{printf "%s%*.s\n", $0, spaces, " "}'
#Justify - center
SPACES_AFTER=$(($LIMIT-$(((${#INPUT}+$LIMIT)/2))))
printf "%*s\n" $(((${#INPUT}+$LIMIT)/2 + 1)) "$INPUT" | awk -v spaces=$SPACES_AFTER '{printf "%s%*.s\n", $0, spaces, " "}'
else
LOOPTAIL="$(echo $INPUT | cut -c -$LIMIT)"
FULLSTRING="$(echo "$INPUT$SEPERATOR$LOOPTAIL")"
echo -n "  "
# Show only LIMIT characters, from i to i+LIMIT. Output scrolls due to incrementing i
echo -n $FULLSTRING | cut -c $i-$(($LIMIT+$i))
#echo -n $FULLSTRING | awk -v charlimit="$LIMIT" -v start="$i" '{print substr($0,start,charlimit)}'
# If we have shown the full string, start over
if [ $i -eq $(($INPUT_LENGTH+$SEPERATOR_LENGTH)) ]; then
i=0
fi
i=$(($i+1))
fi
# For fat bars/panels, I add this newline so the previous output is not visible
echo ""
sleep 1
done

View file

@ -1 +0,0 @@
chromium-browser https://web.skype.com/en/

View file

@ -1,3 +1,8 @@
#
TEMP="$(sensors | grep "Package" | awk '{print $4}' | cut -c 2-3,6-8)"
echo "$TEMP"
# With icon
# echo " $TEMP"
# Just text
echo "temp $TEMP"

10
Scripts/toggle_compositor.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
# Run compton only if it is not already running.
COMPTON="$(ps cax | grep compton)"
if [ ${#COMPTON} -eq "0" ]; then
#echo "compton is not running."
# run compton
compton -f -c &
else
killall compton
fi

10
Scripts/toggle_flux.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
TEMP=3000
REDSHIFT="$(ps cax | grep redshift)"
if [ ${#REDSHIFT} -eq "0" ]; then
#echo "redshift is not running."
# run redshift
redshift -l 0:0 -t $TEMP:$TEMP -r &
else
killall redshift
fi

9
Scripts/volume-notify.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
VOL="$(pactl list sinks | grep "Volume: " | awk '{print $5}' | head -1)"
MUTE="$(pactl list sinks | grep -i "mute" | head -1 | awk '{print $2}')"
if [[ "$MUTE" != "no" ]]; then
notify-send " Volume is muted"
else
notify-send " Volume is at $VOL"
fi

View file

@ -10,7 +10,25 @@ VOL="$(pactl list sinks | grep "Volume: " | awk '{print $5}' | head -1)"
MUTE="$(pactl list sinks | grep -i "mute" | head -1 | awk '{print $2}')"
if [[ "$MUTE" != "no" ]]; then
echo "  "
# Icon only
# echo "  "
# Text only
echo "vol off"
else
echo "$VOL "
# Text only
echo "vol $VOL"
# Icon only (simple)
# echo "  "
#Icon only (gradual)
# VOL="$(echo ${VOL%?})"
# if [ "$VOL" -ge "85" ]; then
# echo "  "
# elif [ "$VOL" -ge "20" ]; then
# echo "  "
# else
# echo "  "
# fi
fi

View file

@ -1,3 +1,7 @@
# Opens oomox to let you create your gtk theme
echo "> Opening oomox-gui so you can create your gtk theme. "
echo "> Name of the theme should be 'wally'. Close oomox when you have exported the theme."
oomox-gui
# Copies the gtk theme created by oomox to /usr/share/icons
# so that it can be used by lightdm greeter
echo -n "> Replacing gtk theme and icons... "
@ -6,6 +10,14 @@ rm -rf /usr/share/icons/wally
cp -r ~/.themes/oomox-wally /usr/share/themes/wally
cp -r ~/.icons/oomox-wally-flat /usr/share/icons/wally
echo "Done!"
echo "> Starting lightdm-gtk-greeter-settings..."
lightdm-gtk-greeter-settings
# Requires that you have setup your lightdm to have ~/.wally/login as wallpaper
echo -n "> Setting login wallpaper... "
PAPE="$(cat ~/.wally/path_to_wallpaper)"
cp $PAPE ~/.wally/login
echo "Done!"
# echo "> Starting lightdm-gtk-greeter-settings..."
# lightdm-gtk-greeter-settings
# Create firefox icon
# cp ~/.icons/oomox-wally-flat/apps/scalable/browser.svg ~/.icons/oomox-wally-flat/apps/scalable/firefox.svg
echo "> All done :)"

View file

@ -1,7 +1,7 @@
#!/bin/bash
# needs work
CITY="Volos"
CITY="Moscow"
# glyphs (TODO)
#  day cloud
@ -54,10 +54,10 @@ TEMP="$(curl -s -A "Mozilla/5.0" wttr.in/$CITY | grep -m 1 '°C'| awk '{print $(
# City+degrees
#echo " $CITY $TEMP°C"
echo " $CITY $TEMP°C"
# Degrees only
#echo "$TEMP°C"
# Leaf + degrees
echo "$TEMP°C"
#echo "  $TEMP°C"

2
Scripts/weather_details.sh Executable file
View file

@ -0,0 +1,2 @@
curl -s wttr.in/volos | head -7
sleep 1d

2
Scripts/weather_forecast.sh Executable file
View file

@ -0,0 +1,2 @@
curl -s wttr.in/volos | tail -33 | head -30
sleep 1d