scripts

scripts to make my pc work
Index Commits Files Refs
commit 4720b6d94da51048e49fc5aef1fa09aafe83782f
parent 9a18bea026f9d7dad5aa42afc4c97eb69c341cc2
Author: mjkloeckner <martin.cachari@gmail.com>
Date:   Thu, 22 Dec 2022 15:50:37 -0300

updated scripts folder

Diffstat:
Dadbinput.sh | 3---
Dautostart.sh | 11-----------
Dbacklightdec | 3---
Dbacklightinc | 3---
Dbrightness.c | 27---------------------------
Dclean.sh | 25-------------------------
Aclipmenu_centered | 19+++++++++++++++++++
Dcount.c | 11-----------
Dcount.py | 7-------
Dcount.sh | 4----
Acreate-new-repo | 23+++++++++++++++++++++++
Ddbdb.sh | 18------------------
Ddisablebluetooth | 3---
Mdisablemouseaccel | 3++-
Admenu_centered | 14++++++++++++++
Ddmenu_mount_sdb | 3---
Memojisupport | 7+++++--
Agip/gip | 22++++++++++++++++++++++
Agip/names.json | 2++
Dimagestodownload.txt | 3---
Mip.sh | 11++++++-----
Mkeyboardmap | 18+++++++++++++++---
Dlaunchhtop | 3---
Mlockscreen | 15++++++++++++++-
Dmountdrive.sh | 19-------------------
Mnasa_img_downloader | 8+++++++-
Ansxiv-rifle | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Mopenbook | 24++++++++++++++++++------
Mopendir | 5-----
Apactlsetvolume | 44++++++++++++++++++++++++++++++++++++++++++++
Apactlsetvolume.old | 95+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apamixersetvolume | 29+++++++++++++++++++++++++++++
Apamixertogglemute | 40++++++++++++++++++++++++++++++++++++++++
Msetlockscreenbg | 8+++++++-
Ashortpath | 6++++++
Ashow_zsh_colors | 3+++
Astatusbar/buttons/sb-kbselect-button | 8++++++++
Astatusbar/buttons/sb-volume-button | 18++++++++++++++++++
Mstatusbar/sb-battery | 12+++++++++---
Mstatusbar/sb-clock | 3++-
Mstatusbar/sb-disk | 3++-
Mstatusbar/sb-internet | 18++++++++++++------
Dstatusbar/sb-music | 19-------------------
Dstatusbar/sb-nettraf | 30------------------------------
Dstatusbar/sb-pacpackages | 31-------------------------------
Dstatusbar/sb-pacpackages_update_status_bar | 9---------
Mstatusbar/sb-volume | 21+++++----------------
Astatusbar/sb-weather | 33+++++++++++++++++++++++++++++++++
Astatusbar/sb-weather~ | 33+++++++++++++++++++++++++++++++++
Astatusbar/wthr | 134+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mswitchkblayout | 8+++++---
Mtakescreenshot | 13+++++++++----
Atmux_status.sh | 19+++++++++++++++++++
Aunix | 26++++++++++++++++++++++++++
Dxinitrc | 1-
Dxrandrbrightdef | 1-
Dxrandrbrightnessup | 1-
57 files changed, 737 insertions(+), 294 deletions(-)
diff --git a/adbinput.sh b/adbinput.sh
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-# adb shell input swipe <start_x> <start_y> <end_x> <end_y> duration_ms>
diff --git a/autostart.sh b/autostart.sh
@@ -1,11 +0,0 @@
-# set proper resolution
-xrandr -s 1366x768
-
-# set wallpaper
-nitrogen --restore
-
-# start compositor
-picom &
-
-setxkbmap -option caps:swapescape
-setxkbmap -option altwin:swap_lalt:lwin
diff --git a/backlightdec b/backlightdec
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-$( xbacklight -dec 2 ) & $(xbacklight -get > /home/mk/.backlight)
diff --git a/backlightinc b/backlightinc
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-$( xbacklight -inc 2 ) & $(xbacklight -get > /home/mk/.backlight)
diff --git a/brightness.c b/brightness.c
@@ -1,27 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#define BUFSIZE 10
-
-int main(int argc, char **argv)
-{
-    FILE *fp;
-    char scurr[BUFSIZE];
-    long new, curr, incr, min = 0;
-
-    /* An argument with an integer increment must be supplied */
-    if (argc != 2 || !(incr = strtol(argv[1], NULL, 10))) return 1;
-
-    /* Retrieve the current brightness and increment it in the brightness file */
-    if ((fp = fopen("/sys/class/backlight/intel_backlight/brightness", "r+")) 
-        && fgets(scurr, BUFSIZE, fp)) {
-        curr = strtol(scurr, NULL, 10);
-        rewind(fp);
-        new = curr + incr;
-        if (new < min) new = min;
-        fprintf(fp, "%ld\n", new);
-        fclose(fp);
-    } else return 2;
-
-    return 0;
-}
-
diff --git a/clean.sh b/clean.sh
@@ -1,25 +0,0 @@
-#!/bin/bash
-
-# Removes every a.out from every subfolder where the 
-# script is executed;
-
-# Set the filename;
-file='a.out'
-
-# The path where 'file' is gonna be looked for;
-subfolders=./**/$file
-currentdir=./$file
-
-# First checks  if the file exist in the current directory
-# or in any sub-folder, if exist removes it from everywhere;
-if [ -e $currentdir ] || [ -e $subfolders ];
-then
-        rm -v -f ./**/"$file" 
-        rm -v -f "$file"
-        echo "everithing cleaned succesfully"
-
-# if doesn't exist then does nothing;
-else
-        echo "everything seems clean"
-        echo "there is nothing to do"
-fi
diff --git a/clipmenu_centered b/clipmenu_centered
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Prints a list of books in dmenu and opens the chosen one with pdfviewer
+# The arguments receive are redirected to dmenu
+
+# by github.com/klewer-martin
+
+col_gray1="#000000"
+col_gray3="#cccccc"
+col_darkmagenta="#8B008B"
+col_gray4="#eeeeee"
+
+dmenufont='DejaVuSansMono Nerd Font:style=Regular:size=8'
+# dmenucmds="-i -l 30 -h 14 -z 750 -bw 2 -c $@"
+
+dmenucmds="-i -l 30 -h 14 -z 750 -bw 2 -c $@"
+
+clipmenu $dmenucmds -nb $col_gray1 -nf $col_gray3 -sb $col_darkmagenta \
+    -sf $col_gray4 -fn "$dmenufont"
diff --git a/count.c b/count.c
@@ -1,11 +0,0 @@
-#include <stdio.h>
-
-int main (void)
-{
-    unsigned long x;
-
-    for(x = 0; x < 1000000; x++)
-        printf("%ld\n", x);
-
-    return 0;
-}
diff --git a/count.py b/count.py
@@ -1,7 +0,0 @@
-#!/usr/bin/python
-
-x = 0
-
-while x < 1000000:
-    print(x)
-    x = x + 1
diff --git a/count.sh b/count.sh
@@ -1,4 +0,0 @@
-#/usr/bin/sh
-
-x=0
-while [ "$x" -lt 500000 ]; do echo $x; x=$((x+1));done
diff --git a/create-new-repo b/create-new-repo
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+repos_dir="/var/www/git"
+
+while true; do
+    printf "new repository name: "
+    read -r repo_name;
+    repo_name=$(echo -n $repo_name | sed 's/ /-/g'):
+
+    case $repo_name in
+        *[\/\!\&\(\)\{\}\[\]@\#$%^*_+?]* ) \
+          echo 'name containing invalid character' ;;
+        * ) break;
+    esac
+done
+
+echo "creating new repository: \"$repo_name\""
+
+mkdir -p "$repos_dir"/"$repo_name"/"$repo_name".git
+
+ln -sf "$repos_dir"/"$repo_name"/"$repo_name".git /home/git
+
+cp "$repos_dir"/dotfiles/dotfiles.git/hooks/post-receive
diff --git a/dbdb.sh b/dbdb.sh
@@ -1,18 +0,0 @@
-#!/bin/sh
-# dmenu-based directory browser
-# to run from terminal:
-#    source /path/to/dbdb.sh
-# or bind it to shortcut:
-#   echo bind \'\"\\C-o\":\"source /path/to/dbdb.sh\\n\"\' >> ~/.bashrc
-
-chosen="placeholder"
-
-while [ ! -z "$chosen" ]; do
-    DIRs=$( ls -a1p | grep -P '^\w[^\$/]+/$' | awk -vRS="\n" -vORS="\t" '1')
-    DOTDs=$( ls -a1p | grep -P '^\.[^\$/]+/$' | awk -vRS="\n" -vORS="\t" '1')
-    FILEs=$( ls -a1p | grep -P '^\w[^\$/]+$' | awk -vRS="\n" -vORS=" \t" '1')
-    DOTFs=$( ls -a1p | grep -P '^\.[^\$/]+$' | awk -vRS="\n" -vORS=" \t" '1')
-    clear && printf "\e[1;7;33m $(pwd) \e[0m\n$FILEs\n\e[0;38;5;238m$DOTFs\e[0m\n"
-    chosen=`( ( echo -e "$DIRs$DOTDs" | awk -vRS="\t" -vORS="\n" '1' ) | dmenu -i -l 10)`
-    cd "$chosen"
-done
diff --git a/disablebluetooth b/disablebluetooth
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-systemctl stop bluetooth
diff --git a/disablemouseaccel b/disablemouseaccel
@@ -3,7 +3,8 @@
 
 xinput --set-prop 10 'libinput Accel Profile Enabled' 0, 1
 
-xinput --set-prop 'Logitech Wireless Mouse' 'libinput Accel Profile Enabled' 0, 1
+xinput --set-prop 'Logitech Wireless Mouse' \
+    'libinput Accel Profile Enabled' 0, 1
 
 xinput --set-prop 'DLLA6AE:00 06CB:75DD Touchpad' 'libinput Tapping Enabled' 1
 
diff --git a/dmenu_centered b/dmenu_centered
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+col_gray1="#000000"
+col_gray3="#cccccc"
+col_darkmagenta="#8B008B"
+col_gray4="#eeeeee"
+
+dmenufont='Victor Mono:style=SemiBold:size=9';
+# dmenufont="DejaVuSansMono Nerd Font:style=Regular:size=8"
+# dmenuargs="-h 16 -b -l 10 -c"
+dmenuargs="-i -h 16 -b -F $@"
+
+dmenu_run_history -fn "$dmenufont" -nb $col_gray1 -nf $col_gray3 \
+    -sb $col_darkmagenta -sf $col_gray4 $dmenuargs -p "Run:"
diff --git a/dmenu_mount_sdb b/dmenu_mount_sdb
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-sudo prompt.sh "Do you want to mount /dev/sdb1 into /run/mount/usb ?" "mount_sdb"
diff --git a/emojisupport b/emojisupport
@@ -5,7 +5,8 @@ echo "Setting up Noto Emoji font..."
 # 1 - install  noto-fonts-emoji package
 pacman -S noto-fonts-emoji --needed
 # pacman -S powerline-fonts --needed
-echo "Recommended system font: inconsolata regular (ttf-inconsolata or powerline-fonts)"
+echo "Recommended system font: inconsolata regular (ttf-inconsolata or \
+    powerline-fonts)"
 # 2 - add font config to /etc/fonts/conf.d/01-notosans.conf
 echo "<?xml version="1.0"?>
 <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
@@ -44,6 +45,8 @@ echo "<?xml version="1.0"?>
 " > /etc/fonts/local.conf
 # 3 - update font cache via fc-cache
 fc-cache
-echo "Noto Emoji Font installed! You may need to restart applications like chrome. If chrome displays no symbols or no letters, your default font contains emojis."
+echo "Noto Emoji Font installed! You may need to restart applications like \
+    chrome. If chrome displays no symbols or no letters, your default font \
+    contains emojis."
 echo "consider inconsolata regular"
 
diff --git a/gip/gip b/gip/gip
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# gets information about a public ip address
+# usage: gip <PUBLIC IP>
+
+if [ "$#" -eq 1 ]; then
+    if expr "$@": '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
+        for i in 1 2 3 4; do
+            if [ $(echo "$@" | cut -d. -f$i) -gt 255 ]; then
+              echo "\"$@\" not an ip adress"
+              exit 1
+            fi
+        done
+        curl --silent https://ipinfo.io/$@ | sed -e 's/"\|,\|  \|}//g' -e '1d' -e '/readme/d'
+    else
+        echo "usage: gip <PUBLIC IP>"
+        exit 1
+    fi
+else
+    echo "usage: gip <PUBLIC IP>"
+    exit 1
+fi
diff --git a/gip/names.json b/gip/names.json
@@ -0,0 +1 @@
+{"BD": "Bangladesh", "BE": "Belgium", "BF": "Burkina Faso", "BG": "Bulgaria", "BA": "Bosnia and Herzegovina", "BB": "Barbados", "WF": "Wallis and Futuna", "BL": "Saint Barthelemy", "BM": "Bermuda", "BN": "Brunei", "BO": "Bolivia", "BH": "Bahrain", "BI": "Burundi", "BJ": "Benin", "BT": "Bhutan", "JM": "Jamaica", "BV": "Bouvet Island", "BW": "Botswana", "WS": "Samoa", "BQ": "Bonaire, Saint Eustatius and Saba ", "BR": "Brazil", "BS": "Bahamas", "JE": "Jersey", "BY": "Belarus", "BZ": "Belize", "RU": "Russia", "RW": "Rwanda", "RS": "Serbia", "TL": "East Timor", "RE": "Reunion", "TM": "Turkmenistan", "TJ": "Tajikistan", "RO": "Romania", "TK": "Tokelau", "GW": "Guinea-Bissau", "GU": "Guam", "GT": "Guatemala", "GS": "South Georgia and the South Sandwich Islands", "GR": "Greece", "GQ": "Equatorial Guinea", "GP": "Guadeloupe", "JP": "Japan", "GY": "Guyana", "GG": "Guernsey", "GF": "French Guiana", "GE": "Georgia", "GD": "Grenada", "GB": "United Kingdom", "GA": "Gabon", "SV": "El Salvador", "GN": "Guinea", "GM": "Gambia", "GL": "Greenland", "GI": "Gibraltar", "GH": "Ghana", "OM": "Oman", "TN": "Tunisia", "JO": "Jordan", "HR": "Croatia", "HT": "Haiti", "HU": "Hungary", "HK": "Hong Kong", "HN": "Honduras", "HM": "Heard Island and McDonald Islands", "VE": "Venezuela", "PR": "Puerto Rico", "PS": "Palestinian Territory", "PW": "Palau", "PT": "Portugal", "SJ": "Svalbard and Jan Mayen", "PY": "Paraguay", "IQ": "Iraq", "PA": "Panama", "PF": "French Polynesia", "PG": "Papua New Guinea", "PE": "Peru", "PK": "Pakistan", "PH": "Philippines", "PN": "Pitcairn", "PL": "Poland", "PM": "Saint Pierre and Miquelon", "ZM": "Zambia", "EH": "Western Sahara", "EE": "Estonia", "EG": "Egypt", "ZA": "South Africa", "EC": "Ecuador", "IT": "Italy", "VN": "Vietnam", "SB": "Solomon Islands", "ET": "Ethiopia", "SO": "Somalia", "ZW": "Zimbabwe", "SA": "Saudi Arabia", "ES": "Spain", "ER": "Eritrea", "ME": "Montenegro", "MD": "Moldova", "MG": "Madagascar", "MF": "Saint Martin", "MA": "Morocco", "MC": "Monaco", "UZ": "Uzbekistan", "MM": "Myanmar", "ML": "Mali", "MO": "Macao", "MN": "Mongolia", "MH": "Marshall Islands", "MK": "Macedonia", "MU": "Mauritius", "MT": "Malta", "MW": "Malawi", "MV": "Maldives", "MQ": "Martinique", "MP": "Northern Mariana Islands", "MS": "Montserrat", "MR": "Mauritania", "IM": "Isle of Man", "UG": "Uganda", "TZ": "Tanzania", "MY": "Malaysia", "MX": "Mexico", "IL": "Israel", "FR": "France", "IO": "British Indian Ocean Territory", "SH": "Saint Helena", "FI": "Finland", "FJ": "Fiji", "FK": "Falkland Islands", "FM": "Micronesia", "FO": "Faroe Islands", "NI": "Nicaragua", "NL": "Netherlands", "NO": "Norway", "NA": "Namibia", "VU": "Vanuatu", "NC": "New Caledonia", "NE": "Niger", "NF": "Norfolk Island", "NG": "Nigeria", "NZ": "New Zealand", "NP": "Nepal", "NR": "Nauru", "NU": "Niue", "CK": "Cook Islands", "XK": "Kosovo", "CI": "Ivory Coast", "CH": "Switzerland", "CO": "Colombia", "CN": "China", "CM": "Cameroon", "CL": "Chile", "CC": "Cocos Islands", "CA": "Canada", "CG": "Republic of the Congo", "CF": "Central African Republic", "CD": "Democratic Republic of the Congo", "CZ": "Czech Republic", "CY": "Cyprus", "CX": "Christmas Island", "CR": "Costa Rica", "CW": "Curacao", "CV": "Cape Verde", "CU": "Cuba", "SZ": "Swaziland", "SY": "Syria", "SX": "Sint Maarten", "KG": "Kyrgyzstan", "KE": "Kenya", "SS": "South Sudan", "SR": "Suriname", "KI": "Kiribati", "KH": "Cambodia", "KN": "Saint Kitts and Nevis", "KM": "Comoros", "ST": "Sao Tome and Principe", "SK": "Slovakia", "KR": "South Korea", "SI": "Slovenia", "KP": "North Korea", "KW": "Kuwait", "SN": "Senegal", "SM": "San Marino", "SL": "Sierra Leone", "SC": "Seychelles", "KZ": "Kazakhstan", "KY": "Cayman Islands", "SG": "Singapore", "SE": "Sweden", "SD": "Sudan", "DO": "Dominican Republic", "DM": "Dominica", "DJ": "Djibouti", "DK": "Denmark", "VG": "British Virgin Islands", "DE": "Germany", "YE": "Yemen", "DZ": "Algeria", "US": "United States", "UY": "Uruguay", "YT": "Mayotte", "UM": "United States Minor Outlying Islands", "LB": "Lebanon", "LC": "Saint Lucia", "LA": "Laos", "TV": "Tuvalu", "TW": "Taiwan", "TT": "Trinidad and Tobago", "TR": "Turkey", "LK": "Sri Lanka", "LI": "Liechtenstein", "LV": "Latvia", "TO": "Tonga", "LT": "Lithuania", "LU": "Luxembourg", "LR": "Liberia", "LS": "Lesotho", "TH": "Thailand", "TF": "French Southern Territories", "TG": "Togo", "TD": "Chad", "TC": "Turks and Caicos Islands", "LY": "Libya", "VA": "Vatican", "VC": "Saint Vincent and the Grenadines", "AE": "United Arab Emirates", "AD": "Andorra", "AG": "Antigua and Barbuda", "AF": "Afghanistan", "AI": "Anguilla", "VI": "U.S. Virgin Islands", "IS": "Iceland", "IR": "Iran", "AM": "Armenia", "AL": "Albania", "AO": "Angola", "AQ": "Antarctica", "AS": "American Samoa", "AR": "Argentina", "AU": "Australia", "AT": "Austria", "AW": "Aruba", "IN": "India", "AX": "Aland Islands", "AZ": "Azerbaijan", "IE": "Ireland", "ID": "Indonesia", "UA": "Ukraine", "QA": "Qatar", "MZ": "Mozambique"}
+\ No newline at end of file
diff --git a/imagestodownload.txt b/imagestodownload.txt
@@ -1,3 +0,0 @@
-https://www.nasa.gov/sites/default/files/thumbnails/image/iss065e002848.jpg
-https://www.nasa.gov/sites/default/files/thumbnails/image/iss065e005888.jpg
-https://www.nasa.gov/sites/default/files/thumbnails/image/iss065e005888.jpg
diff --git a/ip.sh b/ip.sh
@@ -1,14 +1,15 @@
 #!/bin/sh
 
-# Prints your local ip address, if you are connected both via wireless & ethernet then the ethernet ip is printed
-
-# by github.com/klewer-martin
+# Prints your local ip address. If you are connected both via wireless & \
+# ethernet then the ethernet ip is printed by github.com/mjkloeckner
 
 estatus="$(cat /sys/class/net/e*/operstate)"
 
 if [ "$estatus" = "down" ]; 
-    then ip=$(ip -o a | awk '/: w.*.inet .*/ { print $4 }' | sed 's/\// /' | awk '{ print $1 }');
-    else ip=$(ip -o a | awk '/: e.*.inet .*/ { print $4 }' | sed 's/\// /' | awk '{ print $1 }');
+    then ip=$(ip -o a | awk '/: w.*.inet .*/ { print $4 }' | sed 's/\// /' | \
+        awk '{ print $1 }');
+    else ip=$(ip -o a | awk '/: e.*.inet .*/ { print $4 }' | sed 's/\// /' | \
+        awk '{ print $1 }');
 fi;
 
 echo $ip
diff --git a/keyboardmap b/keyboardmap
@@ -2,10 +2,22 @@
 
 # swaps escape with caps-lock and lalt with lsuper
 
-setxkbmap -option caps:swapescape
+# setxkbmap -option caps:swapescape
 
-setxkbmap -option altwin:swap_lalt_lwin
+# setxkbmap -option altwin:swap_lalt_lwin
 
-setxkbmap -option altwin:swap_alt_win
+# setxkbmap -option altwin:swap_alt_win
+
+# make CapsLock behave like Ctrl:
+# setxkbmap -option ctrl:nocaps
+
+
+
+setxkbmap -option altwin:swap_lalt_lwin,altwin:swap_alt_win,ctrl:nocaps
+
+# make short-pressed Ctrl behave like Escape:
+xcape -e 'Control_L=Escape'
+
+# xcape -e 'Caps_Lock=Escape' -t 100
 
 # setxkbmap -option caps:super ; xcape -e 'Super_L=Escape'
diff --git a/launchhtop b/launchhtop
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-terminator -e htop
diff --git a/lockscreen b/lockscreen
@@ -1,9 +1,22 @@
 #!/bin/bash
 
+pactlsetvolume -d 1
+pactlsetvolume -i 1
+
 # Pauses notifications so it wont show during lockscreen
 dunstctl set-paused true
 
-i3lock -c 00000000 -n --wrong-text="" --lock-text="" --lockfailed-text="" --verif-text="" --verif-text="" --noinput-text="" -i $HOME/.cache/i3lock/current/dimblur.png -M --ring-color=8B008B --keyhl-color=ff00ff --verif-color=0000FF --indicator
+# xset dpms force off
+
+# sleep 5;
+
+i3lock -b -c 00000000 -n --wrong-text="" --lock-text="" --lockfailed-text="" \
+    --verif-text="" --verif-text="" --noinput-text="" \
+    -i $HOME/.cache/betterlockscreen/current/wall_dimblur.png \
+    -M --ring-color=8B008B --keyhl-color=ff00ff --verif-color=0000FF \
+    --indicator --pass-media-keys --radius 100.0 --pointer default
 
 # Re-enables notifications when the device is unlocked
 dunstctl set-paused false
+
+pkill -RTMIN+8 dwmblocks
diff --git a/mountdrive.sh b/mountdrive.sh
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-col_gray1="#000000"
-col_gray3="#bbbbbb"
-col_gray4="#eeeeee"
-col_darkmagenta="#8B008B"
-
-prompt='Which drive do you want to mount?'
-
-rmedia=$(ls /dev/sd* | sed '/sda/d')
-dmenuargs="-i -l 10 -h 14 -z 750 -bw 2 -c $@ -nb $col_gray1 -nf $col_gray3 -sb $col_darkmagenta -sf $col_gray4"
-
-[[ -z $rmedia ]] && notify-send "No removable media found" -t 2000 && exit 1
-
-name=$(ls /dev/sd* | sed '/sda/d' | sed -n '/sd../p' | dmenu $dmenuargs)
-
-[[ -z $name ]] && exit 1 
-
-echo $name | dmenu $dmenuargs
diff --git a/nasa_img_downloader b/nasa_img_downloader
@@ -1,5 +1,11 @@
 #!/bin/sh
 
+# downloads a list of images given as input
+
 [ -z "$1" ] && exit 1
 
-while read line; do url="$line"; imgname=$(echo "$url" | cut -d "/" -f 12); curl -# $url > $imgname; echo "\nDownloading: $imgname"; done < $1
+while read line; do
+    url="$line"; 
+    imgname=$(echo "$url" | cut -d "/" -f 12); curl -# $url > $imgname;
+    echo "\nDownloading: $imgname";
+done < $1
diff --git a/nsxiv-rifle b/nsxiv-rifle
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+TMPDIR="${TMPDIR:-/tmp}"
+tmp="$TMPDIR/nsxiv_rifle_$$"
+
+is_img_extension() {
+    grep -iE '\.(jpe?g|png|gif|svg|webp|tiff|heif|avif|ico|bmp)$'
+}
+
+listfiles() {
+    find -L "$1" -maxdepth 1 -type f -print |
+        is_img_extension | sort | tee "$tmp"
+}
+
+open_img() {
+    file="$1"; shift;
+    # only go through listfiles() if the file has a valid img extension
+    if echo "$file" | is_img_extension >/dev/null 2>&1; then
+        trap 'rm -f $tmp' EXIT
+        count="$(listfiles "///${file%/*}" | grep -nF "$file")"
+    fi
+    if [ -n "$count" ]; then
+        nsxiv -i -n "${count%%:*}" "$@" -- < "$tmp"
+    else
+        # fallback incase file didn't have a valid extension, or we couldn't
+        # find it inside the list
+        nsxiv "$@" -- "$file"
+    fi
+}
+
+uri2path() {
+    python3 - "$@" <<'___HEREDOC'
+from urllib.parse import unquote, urlparse
+from sys import argv
+for arg in argv[1:]:
+    print(unquote(urlparse(arg).path))
+___HEREDOC
+}
+
+[ "$1" = '--' ] && shift
+case "$1" in
+    "") echo "Usage: ${0##*/} PICTURES" >&2; exit 1 ;;
+    /*) open_img "$1" ;;
+    "~"/*) open_img "$HOME/${1#"~"/}" ;;
+    file:///*) open_img "$(uri2path "$1")" ;;
+    trash:///*)
+        trash_dir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash/files"
+        open_img "${trash_dir}$(uri2path "$1")" -N "nsxiv_trash"
+        ;;
+    *) open_img "$PWD/$1" ;;
+esac
diff --git a/openbook b/openbook
@@ -1,19 +1,31 @@
 #!/bin/sh
 
-# Prints a list of books in dmenu and opens the chosen one with pdfviewer
-# The arguments receive are redirected to dmenu
+# Prints a list of books in dmenu and opens the chosen one with the default pdfviewer
+# The arguments received are passthrough to dmenu
+# by github.com/mjkloeckner
 
-# by github.com/klewer-martin
+col_gray1="#000000"
+col_gray3="#cccccc"
+col_darkmagenta="#8B008B"
+col_gray4="#eeeeee"
 
 dir=$HOME/dox/books
 pdfviewer=zathura
-dmenucmds="-i -l 30 -h 14 -z 750 -bw 2 -c $@"
 
-bookname=$(ls $dir | dmenu $dmenucmds)
+dmenufont='DejaVuSansMono Nerd Font:style=Regular:size=8'
+# dmenufont='Victor Mono:style=SemiBold:size=8';
+# dmenucmds="-i -l 30 -h 14 -z 750 -bw 2 -c $@"
+
+dmenucmds="-i -l 35 -h 10 -z 850 -bw 2 -c $@"
+
+bookname=$(ls $dir | dmenu $dmenucmds -nb $col_gray1 -nf $col_gray3 \
+    -sb $col_darkmagenta -sf $col_gray4 -fn "$dmenufont")
 
 [ -z "$bookname" ] && exit
 
 [ $(file "$dir/$bookname" | cut -d ":" -f 2) = "directory" ] &&
-    dir=$dir/$bookname && bookname=$(ls "$dir" | dmenu $dmenucmds)
+    dir=$dir/$bookname && bookname=$(ls "$dir" | dmenu $dmenucmds \
+    -nb $col_gray1 -nf $col_gray3 -sb $col_darkmagenta -sf $col_gray4 \
+    -fn "$dmenufont" )
 
 [ -n "$bookname" ] && $pdfviewer "$dir/$bookname"
diff --git a/opendir b/opendir
@@ -1,10 +1,5 @@
 #!/bin/sh
 
-# Prints a list of books in dmenu and opens the chosen one with pdfviewer
-# The arguments receive are redirected to dmenu
-
-# by github.com/klewer-martin
-
 dmenucmds="-i -l 10 -h 14 -z 750 -bw 2 -c $@"
 dirname=$(fd -a | dmenu $dmenucmds)
 
diff --git a/pactlsetvolume b/pactlsetvolume
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# amount=$(echo "$1" | cut -d " " -f 2)
+amount=$2
+curr=$(pamixer --get-volume)
+
+send_notification() {
+    dunstify -r 13123 -h "int:value:$1" "$2 Volume ($1%)" -t 2000
+}
+
+get_icon() {
+    if [ "$curr" -gt "50" ]; then
+        icon="πŸ”Š"
+    elif [ "$curr" -eq "0" ]; then
+        icon="πŸ”‡"
+    elif [ "$curr" -lt "25" ]; then
+        icon="πŸ”ˆ"
+    else
+        icon="πŸ”‰"
+    fi
+}
+
+if [ $amount == "0" ]; then
+    pactl set-sink-mute @DEFAULT_SINK@ toggle;
+    if [ "$(pamixer --get-mute)" == "false" ]; then
+        get_icon $icon
+        send_notification $curr $icon
+    else
+        send_notification "0" "πŸ”‡"
+    fi
+    exit
+fi
+
+# min=$((0 + $amount))
+# max=$((100 - $amount))
+
+# (($curr<=$max)) && $(pactl set-sink-volume @DEFAULT_SINK@ +$amount%)
+
+pamixer $1 $2
+# curr=$(pamixer --get-volume)
+# [ $curr -ne $min ] && [ $curr -ne $max ] && curr=$(($curr + $amount))
+
+get_icon
+# send_notification $curr $icon
diff --git a/pactlsetvolume.old b/pactlsetvolume.old
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+amount_to_increase=$1
+current_volume=$(pamixer --get-volume)
+is_muted=$(pamixer --get-mute)
+
+send_notification() {
+    dunstify -r 13123 -h "int:value:$1" "$2 Volume ($1%)" -t 2000;
+}
+
+get_icon() {
+    if [ "$current_volume" -gt "50" ]; then
+        icon="πŸ”Š"
+    elif [ "$current_volume" -eq "0" ]; then
+        icon="πŸ”‡"
+    elif [ "$current_volume" -lt "25" ]; then
+        icon="πŸ”ˆ"
+    else
+        icon="πŸ”‰"
+    fi
+}
+
+set_volume() {
+    max_volume=$((100 - $amount_to_increase))
+
+    (($current_volume<=$max_volume)) && $(pactl set-sink-volume @DEFAULT_SINK@ +$amount_to_increase%)
+
+    current_volume=$(pamixer --get-volume)
+
+    # Avoid delay between notification and dwmblocks update
+    pkill -RTMIN+1 dwmblocks;
+}
+
+if [[ "$is_muted" == "true" ]]; then
+    if [[ $amount_to_increase == "0" ]]; then
+        # It's muted and we want to unmute
+        get_icon $icon
+        send_notification $current_volume $icon
+        pactl set-sink-mute @DEFAULT_SINK@ toggle;
+        # pkill -RTMIN+1 dwmblocks; # Avoid delay between notification and dwmblocks update
+    else
+        # It's muted and we want to raise/lower the volume
+        # pkill -RTMIN+1 dwmblocks;
+        # send_notification "0" "πŸ”‡"
+        set_volume
+        get_icon
+        send_notification $current_volume "πŸ”‡"
+        # pkill -RTMIN+1 dwmblocks; # Avoid delay between notification and dwmblocks update
+    fi
+else
+    if [[ $amount_to_increase == "0" ]]; then
+        # It's not muted and we want to mute
+        get_icon $icon
+        send_notification $current_volume "πŸ”‡"
+        pactl set-sink-mute @DEFAULT_SINK@ toggle;
+        # pkill -RTMIN+1 dwmblocks; # Avoid delay between notification and dwmblocks update
+    else
+        # It's not muted and we want to raise/lower the volume
+        # send_notification "0" "πŸ”‡"
+        set_volume
+        get_icon
+        send_notification $current_volume $icon
+    fi
+fi
+
+pkill -RTMIN+1 dwmblocks; # Avoid delay between notification and dwmblocks update
+exit
+
+# if [[ $amount_to_increase == "0" ]]; then
+#     if [[ "$is_muted" == "true" ]]; then
+#         get_icon $icon
+#         # Avoid delay between notification and dwmblocks update
+#         pkill -RTMIN+1 dwmblocks;
+#         send_notification $current_volume $icon
+#         pactl set-sink-mute @DEFAULT_SINK@ toggle;
+#     else 
+#         # Avoid delay between notification and dwmblocks update
+#         pkill -RTMIN+1 dwmblocks;
+#         send_notification "0" "πŸ”‡"
+#         pactl set-sink-mute @DEFAULT_SINK@ toggle;
+#     fi
+#     exit
+# fi
+
+# max_volume=$((100 - $amount_to_increase))
+
+# (($current_volume<=$max_volume)) && $(pactl set-sink-volume @DEFAULT_SINK@ +$amount_to_increase%)
+
+# current_volume=$(pamixer --get-volume)
+
+# # Avoid delay between notification and dwmblocks update
+# pkill -RTMIN+1 dwmblocks;
+
+# get_icon
+# send_notification $current_volume $icon
diff --git a/pamixersetvolume b/pamixersetvolume
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# amount=$(echo "$1" | cut -d " " -f 2)
+# amount=$2
+
+send_notification() {
+    dunstify -r 13123 "$2 Volume $1%" -t 1750
+}
+
+get_icon() {
+    if [ "$mute" == "true" ] | [ "$curr" -eq "0" ]; then
+        icon="πŸ”‡"
+        break;
+    elif [ "$curr" -gt "50" ]; then
+        icon="πŸ”Š"
+    elif [ "$curr" -lt "25" ]; then
+        icon="πŸ”ˆ"
+    else
+        icon="πŸ”‰"
+    fi
+}
+
+pamixer $1 $2 && kill -35 $(pidof dwmblocks)
+
+curr=$(pamixer --get-volume)
+mute=$(pamixer --get-mute)
+
+get_icon
+send_notification $curr $icon
diff --git a/pamixertogglemute b/pamixertogglemute
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# amount=$(echo "$1" | cut -d " " -f 2)
+send_notification() {
+    # dunstify -r 13123 -h "int:value:$1" "$2 Volume ($1%)" -t 2000
+    dunstify -r 13123 "$2 Volume $1%" -t 1750
+}
+
+get_icon() {
+    if [ "$curr" -gt "50" ]; then
+        icon="πŸ”Š"
+    elif [ "$curr" -eq "0" ]; then
+        icon="πŸ”‡"
+    elif [ "$curr" -lt "25" ]; then
+        icon="πŸ”ˆ"
+    else
+        icon="πŸ”‰"
+    fi
+}
+
+pactl set-sink-mute @DEFAULT_SINK@ toggle;
+
+if [ "$(pamixer --get-mute)" == "false" ]; then
+    curr=$(pamixer --get-volume)
+    get_icon $icon
+    send_notification $curr $icon
+else
+    send_notification "0" "πŸ”‡"
+fi
+
+kill -35 $(pidof dwmblocks)
+
+# min=$((0 + $amount))
+# max=$((100 - $amount))
+
+# (($curr<=$max)) && $(pactl set-sink-volume @DEFAULT_SINK@ +$amount%)
+
+# [ $curr -ne $min ] && [ $curr -ne $max ] && curr=$(($curr + $amount))
+
+# send_notification $curr $icon
diff --git a/setlockscreenbg b/setlockscreenbg
@@ -1,3 +1,9 @@
 #!/bin/sh
 
-betterlockscreen -u $(grep file $HOME/.config/nitrogen/bg-saved.cfg | cut -c6-)
+# Sets the same image used for the wallpaper as the lockscreen background
+
+imgname=$(grep file $HOME/.config/nitrogen/bg-saved.cfg | cut -c6-)
+
+echo $imgname
+
+betterlockscreen -u "$imgname"
diff --git a/shortpath b/shortpath
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# shortens a path given from stdin
+# usage: ./shortpath <long_path_to_be_shorten>
+
+awk -F '/' '{if(NF > 4){print "…/"$(NF-2)"/"$(NF-1)"/"$(NF)}else{print}}' < /dev/stdin
diff --git a/show_zsh_colors b/show_zsh_colors
@@ -0,0 +1,3 @@
+#!/bin/zsh
+
+for code in {000..255}; do print -P -- "$code: %F{$code}Color%f"; done
diff --git a/statusbar/buttons/sb-kbselect-button b/statusbar/buttons/sb-kbselect-button
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+case "$1" in
+    1) switchkblayout;;
+    # 2) pactl set-sink-volume @DEFAULT_SINK@ +1; pkill -RTMIN+1 dwmblocks;;
+    # 3) ;;
+    # 4) ;;
+esac
diff --git a/statusbar/buttons/sb-volume-button b/statusbar/buttons/sb-volume-button
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+send_notification() {
+    dunstify -r 199 -h "int:value:$1" "$2 Volume ($1%)" -t 2000;
+    # dunstify "Signal $1 received"
+}
+
+case "$1" in
+    1) pactl set-sink-mute @DEFAULT_SINK@ toggle; pkill -RTMIN+1 dwmblocks;;
+    # 2) pactl set-sink-volume @DEFAULT_SINK@ +1; pkill -RTMIN+1 dwmblocks;;
+    3) pavucontrol -t 3;;
+    # 4) pactlsetvolume -i 1;;
+    # 5) pactlsetvolume -d 1;;
+    # 4) if [ "$curr" -lt "100" ]; then pactl set-sink-volume @DEFAULT_SINK@ +1%; pkill -RTMIN+1 dwmblocks fi;;
+    # 5) pactl set-sink-volume @DEFAULT_SINK@ -1%; pkill -RTMIN+1 dwmblocks;;
+    4) pamixer -i 1 & kill -35 $(pidof dwmblocks); exit;;
+    5) pamixer -d 1 & kill -35 $(pidof dwmblocks); exit;;
+esac
diff --git a/statusbar/sb-battery b/statusbar/sb-battery
@@ -16,13 +16,19 @@ case $BLOCK_BUTTON in
     6) "$TERMINAL" -e "$EDITOR" "$0" ;;
 esac
 
+if [ ! -e /sys/class/power_supply/BAT?* ]; then
+    status="πŸ”Œ " && printf "%s%s" "$status" "AC" && exit 0;
+fi
+
 # Loop through all attached batteries and format the info
 for battery in /sys/class/power_supply/BAT?*; do
     # If non-first battery, print a space separator.
     [ -n "${capacity+x}" ] && printf " "
     # Sets up the status and capacity
     case "$(cat "$battery/status")" in
-        "Full") status="πŸ”Œ" ;;
+        "Full") status="πŸ”Œ";;
+            # printf "%s %s" "$status" "AC";
+            # exit 0;;
         "Discharging") status="πŸ”‹" ;;
         "Charging") status="⚑" ;;
         "Not charging") status="πŸ›‘" ;;
@@ -30,8 +36,8 @@ for battery in /sys/class/power_supply/BAT?*; do
     esac
     capacity=$(cat "$battery/capacity")
     # Will make a warn variable if discharging and low
-    [ "$status" = "πŸ”‹" ] && [ "$capacity" -le 20 ] && status="❗" &&  color="^c#FF0000^"
+    [ "$status" = "πŸ”‹" ] && [ "$capacity" -le 20 ] && status="❗"
 
     # Prints the info
-    printf "%s%s%*d%%^d^" "$status" "$color" "3" "$capacity";
+    printf "%s%*d%%" "$status" "3" "$capacity";
 done && exit 0
diff --git a/statusbar/sb-clock b/statusbar/sb-clock
@@ -27,4 +27,5 @@ esac
 #esac
 
 #date "+ %a %b %d %Y $icon: %I:%M%p"
-date "+πŸ“… %a %d/%m/%Y  $icon %R"
+# date "+πŸ“… %a %d/%m/%Y  $icon %R"
+date "+πŸ“… %a %d %b %Y  $icon %R"
diff --git a/statusbar/sb-disk b/statusbar/sb-disk
@@ -20,4 +20,5 @@ case "$location" in
     *) icon="πŸ’Ύ";;
 esac
 
-printf "%s %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
+# printf "%s %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
+printf "%s %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ { print $4 }')"
diff --git a/statusbar/sb-internet b/statusbar/sb-internet
@@ -7,12 +7,16 @@
 estatus="$(cat /sys/class/net/e*/operstate)"
 wstatus="$(cat /sys/class/net/w*/operstate)"
 
-if [ "$estatus" = "down" ]; 
-    then if [ "$wstatus" = "down" ]
-        then ip="Disconnected"; icon="🌐"
-        else ip=$(ip -o a | awk '/: w.*.inet .*/ { print $4 }' | sed 's/\// /' | awk '{ print $1 }'); icon="πŸ“‘"
+if [ "$estatus" = "down" ]; then
+    if [ "$wstatus" = "down" ]; then
+        ip="Disconnected"; icon="🌐"
+    else
+        ip=$(ip -o a | awk '/: w.*.inet .*/ { print $4 }' | sed 's/\// /' | awk '{ print $1 }')
+        icon="πŸ“‘"
     fi;
-    else ip=$(ip -o a | awk '/: e.*.inet .*/ { print $4 }' | sed 's/\// /' | awk '{ print $1 }'); icon="🌐"
+else
+    ip=$(ip -o a | awk '/: e.*.inet .*/ { print $4 }' | sed 's/\// /' | awk '{ print $1 }')
+    icon="🌐"
 fi;
 
 case $icon in
@@ -31,4 +35,6 @@ case $speed in
         color="^c#00FF00^";;
 esac
 
-printf "%s%s %s^d^\n" "$icon" "$color" "$ip"
+[ -z $ip ] && printf "%s %s\n" "$icon" "Connecting" && exit
+
+printf "%s %s" "$icon" "$ip"
diff --git a/statusbar/sb-music b/statusbar/sb-music
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-filter() { mpc | sed "/^volume:/d;s/\\&/&amp;/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d" | paste -sd ' ' -;}
-
-pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 &
-
-case $BLOCK_BUTTON in
-    1) mpc status | filter ; setsid -f "$TERMINAL" -e ncmpcpp ;;  # right click, pause/unpause
-    2) mpc toggle | filter ;;  # right click, pause/unpause
-    3) mpc status | filter ; notify-send "🎡 Music module" "\- Shows mpd song playing.
-- ⏸ 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
-    6) mpc status | filter ; "$TERMINAL" -e "$EDITOR" "$0" ;;
-    *) mpc status | filter ;;
-esac
diff --git a/statusbar/sb-nettraf b/statusbar/sb-nettraf
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-# Module showing network traffic. Shows how much data has been received (RX) or
-# transmitted (TX) since the previous time this script ran. So if run every
-# second, gives network traffic per second.
-
-case $BLOCK_BUTTON in
-    1) setsid -f "$TERMINAL" -e bmon ;;
-    3) notify-send "🌐 Network traffic module" "πŸ”»: Traffic received
-πŸ”Ί: Traffic transmitted" ;;
-    6) "$TERMINAL" -e "$EDITOR" "$0" ;;
-esac
-
-update() {
-    sum=0
-    for arg; do
-        read -r i < "$arg"
-        sum=$(( sum + i ))
-    done
-    cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/}
-    [ -f "$cache" ] && read -r old < "$cache" || old=0
-    printf %d\\n "$sum" > "$cache"
-    printf %d\\n $(( sum - old ))
-}
-
-rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
-tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
-
-#printf "πŸ”»%4sB πŸ”Ί%4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx)
-printf "πŸ”»%4sB\\n" $(numfmt --to=iec $rx)
diff --git a/statusbar/sb-pacpackages b/statusbar/sb-pacpackages
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-# Displays number of upgradeable packages.
-# For this to work, have a `pacman -Sy` command run in the background as a
-# cronjob every so often as root. This script will then read those packages.
-# When clicked, it will run an upgrade via pacman.
-#
-# Add the following text as a file in /usr/share/libalpm/hooks/statusbar.hook:
-#
-# [Trigger]
-# Operation = Upgrade
-# Type = Package
-# Target = *
-#
-# [Action]
-# Description = Updating statusbar...
-# When = PostTransaction
-# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3.
-
-# case $BLOCK_BUTTON in
-#     1) setsid -f "$TERMINAL" -e sb-popupgrade ;;
-#     2) notify-send "$(/usr/bin/pacman -Qu)" ;;
-#     3) notify-send "🎁 Upgrade module" "πŸ“¦: number of upgradable packages
-# - Left click to upgrade packages
-# - Middle click to show upgradable packages" ;;
-#     6) "$TERMINAL" -e "$EDITOR" "$0" ;;
-# esac
-
-# pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/πŸ“¦: /;s/^πŸ“¦0$//g"
-packages_to_update=$(checkupdates | wc -l)
-sed "s/^/πŸ“¦: /;s/^πŸ“¦0$//g"
diff --git a/statusbar/sb-pacpackages_update_status_bar b/statusbar/sb-pacpackages_update_status_bar
@@ -1,9 +0,0 @@
-[Trigger]
-Operation = Upgrade
-Type = Package
-Target = *
-
-[Action]
-Description = Updating statusbar...
-When = PostTransaction
-Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3.
diff --git a/statusbar/sb-volume b/statusbar/sb-volume
@@ -13,26 +13,17 @@
 #     6) "$TERMINAL" -e "$EDITOR" "$0" ;;
 # esac
 
-case $BLOCK_BUTTON in
-    1) pamixer -t ;;
-    2) setsid -f "$TERMINAL" -e pulsemixer ;;
-    # 4) pamixer --allow-boost -i 1 ;;
-    4) pamixer -i 1 ; pkill -RTMIN+10 dwmblocks; sleep .5;;
-    5) pamixer -d 1 ; pkill -RTMIN+10 dwmblocks;;
-    3) notify-send "πŸ“’ Volume module" "\- Shows volume πŸ”Š, πŸ”‡ if muted.
-- Middle click to mute.
-- Scroll to change." ;;
-    6) "$TERMINAL" -e "$EDITOR" "$0" ;;
-esac
-
-[ $(pamixer --get-mute) = true ] && echo "πŸ”‡  ^c#FF2a2a^0%^d^" && exit
+# [ $(pamixer --get-mute) = true ] && echo "πŸ”‡  ^c#FF2a2a^0%^d^" && exit
+# [ $(pamixer --get-mute) = true ] && echo "πŸ”‡  0%" && exit
 
 # [ $(awk -F "[][]" '/Left:/ { print $4 }' <(amixer sget Master)) == "off" ] && echo "πŸ”‡  0%" && exit
 
 vol="$(pamixer --get-volume)"
 # vol="$(awk -F "[][]" '/Left:/ { $2 - substr($2, 2, lenghth($2) - 1); print $2 }' <(amixer sget Master))"
 
-if [ "$vol" -gt "50" ]; then
+[ $(pamixer --get-mute) = true ] && printf "πŸ”‡%3d%s" $vol "%" && exit
+
+if [ "$vol" -gt "49" ]; then
     icon="πŸ”Š"
 elif [ "$vol" -eq "0" ]; then
     icon="πŸ”‡"
@@ -43,5 +34,3 @@ else
 fi
 
 printf "%s%3d%s" "$icon" "$vol" "%"
-# echo "$icon: $vol%"
-# echo "VOL: $vol%"
diff --git a/statusbar/sb-weather b/statusbar/sb-weather
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+nc -dzw2 google.com 443 2> /dev/null
+
+if [[ $? -ne 0 ]]; then
+    printf "☠️ Service down\n" ;
+    exit;
+fi
+
+# $(nc -dzw2 google.com 443 &> /dev/null) || printf "☠️ Service down\n"  && exit 0
+
+curr_time=$(date +"%H%M")
+raw=$(curl -s wttr.in/1876\?format="%d|%S|%t|%C|%c|%m\n" | tr --delete " " | cut -d "|" -f 1,2,3,4,5,6)
+
+echo $raw | grep -i unknown -q && printf "☠️ Service down" && exit
+
+for i in {0..5}; do
+    data[$i]=$(echo -n $raw | cut -d "|" -f $((i + 1)))
+done
+
+data[2]=$(echo -n ${data[2]} | cut -d "," -f 1)
+
+dusk=$(echo -n ${data[0]} | cut -d ":" -f 1,2 | tr --delete ":")
+sunrise=$(echo -n ${data[1]} | cut -d ":" -f 1,2 | tr --delete ":")
+temp=$(echo -n ${data[2]})
+condition=${data[3]}
+day=${data[4]}
+moon=${data[5]}
+temp=$(echo -n ${data[2]} | tr --delete '+')
+
+[[ $curr_time -lt $dusk && $curr_time -gt $sunrise ]] &&
+    printf "%s %s %s" $day $condition $temp ||
+    printf "%s %s %s" $moon $condition $temp
diff --git a/statusbar/sb-weather~ b/statusbar/sb-weather~
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+nc -dzw2 google.com 443 2> /dev/null
+
+if [[ $? -ne 0 ]]; then
+    printf "☠️ Service down\n" ;
+    exit;
+fi
+
+# $(nc -dzw2 google.com 443 &> /dev/null) || printf "☠️ Service down\n"  && exit 0
+
+curr_time=$(date +"%H%M")
+raw=$(curl -s wttr.in/1876\?format="%d|%S|%t|%C|%c|%m\n" | tr --delete " " | cut -d "|" -f 1,2,3,4,5,6)
+
+echo $raw | grep -i unknown && printf "☠️ Service down\n" ;& exit
+
+for i in {0..5}; do
+    data[$i]=$(echo -n $raw | cut -d "|" -f $((i + 1)))
+done
+
+data[2]=$(echo -n ${data[2]} | cut -d "," -f 1)
+
+dusk=$(echo -n ${data[0]} | cut -d ":" -f 1,2 | tr --delete ":")
+sunrise=$(echo -n ${data[1]} | cut -d ":" -f 1,2 | tr --delete ":")
+temp=$(echo -n ${data[2]})
+condition=${data[3]}
+day=${data[4]}
+moon=${data[5]}
+temp=$(echo -n ${data[2]} | tr --delete '+')
+
+[[ $curr_time -lt $dusk && $curr_time -gt $sunrise ]] &&
+    printf "%s %s %s" $day $condition $temp ||
+    printf "%s %s %s" $moon $condition $temp
diff --git a/statusbar/wthr b/statusbar/wthr
@@ -0,0 +1,134 @@
+#!/usr/bin/python3
+
+import requests
+import json
+import pathlib
+from datetime import datetime
+
+# TODO: support other units
+
+icons_day = {
+    "clear_sky": "β˜€οΈ",
+    "few_clouds": "🌀️",
+    "scattered_clouds": "🌀",
+    "broken_clouds": "☁",
+    "overcast_clouds": "☁",
+    "shower_rain": "🌧",
+    "very_heavy_rain": "🌧",
+    "rain": "🌧",
+    "light_rain": "🌧️",
+    "thunderstorm": "β›ˆ",
+    "snow": "❄",
+    "mist": "🌫"
+}
+
+moon_phase = {
+    (0.00, 0.124):  "πŸŒ‘",
+    (0.124, 0.249): "πŸŒ’",
+    (0.250, 0.374): "πŸŒ“",
+    (0.375, 0.49):  "πŸŒ”",
+    (0.50, 0.674):  "πŸŒ•",
+    (0.675, 0.749): "πŸŒ–",
+    (0.750, 0.824): "πŸŒ—",
+    (0.825, 0.99):  "🌘",
+    (0.99, 1):      "πŸŒ‘"
+}
+
+lat = -34.71
+lon = -58.27
+api_key = "5d30773002dbb7a5aaa846b1656965b2"
+units = "metric"
+exclude = "minutely,hourly,alert"
+cache_file_name = "/home/mk/.cache/wthr.json"
+
+# update time in minutes
+update_time = 5
+
+url = "https://api.openweathermap.org/data/2.5/onecall"
+params = {'lat': lat, 'lon': lon, 'appid': api_key, 'units': units, 'exclude': exclude}
+
+curr_time = datetime.now().timestamp()
+cache_file = pathlib.Path(cache_file_name)
+
+def cache_update():
+    pass
+
+def cache_fetch():
+    pass
+
+if cache_file.exists() != True:
+    # file doesn't exist, creates one
+    pathlib.Path(cache_file_name).touch()
+    print("cache file created")
+
+    try:
+        res = requests.get(url, params)
+    except (requests.ConnectionError, res):
+        print("☠️ Service down")
+        quit()
+
+    wthr_dict = json.loads(res.text)
+    with open(cache_file_name,'w') as cache_file:
+        json.dump(wthr_dict, cache_file, indent=4)
+else:
+    # get file modified time
+    mtime = cache_file.stat().st_mtime
+    if (curr_time - mtime) > (update_time * 60):
+        try:
+            res = requests.get(url, params)
+        except (requests.ConnectionError, res):
+            print("☠️ Service down")
+            quit()
+
+        wthr_dict = json.loads(res.text)
+        with open(cache_file_name,'w') as cache_file:
+            json.dump(wthr_dict, cache_file, indent=4)
+    else:
+        try:
+            with open(cache_file_name,'r') as cache_file:
+                wthr_dict = json.loads(cache_file.read())
+        except ValueError:
+            # file not JSON
+            try:
+                res = requests.get(url, params)
+            except (requests.ConnectionError, res):
+                print("☠️ Service down")
+                quit()
+
+            wthr_dict = json.loads(res.text)
+            with open(cache_file_name,'w') as cache_file:
+                json.dump(wthr_dict, cache_file, indent=4)
+
+# print(json.dumps(wthr_dict, indent=4, sort_keys=True))
+
+desc = wthr_dict['current']['weather'][0]['description']
+main = wthr_dict['current']['weather'][0]['main']
+# temp = int(wthr_dict['current']['feels_like'])
+temp = int(wthr_dict['current']['temp'])
+icon = icons_day[desc.replace(' ', '_')]
+moon_curr = wthr_dict['daily'][0]['moon_phase']
+curr_time_int = int(datetime.now().strftime('%H%M'))
+sunrise = int(wthr_dict['current']['sunrise'])
+sunset = int(wthr_dict['current']['sunset'])
+
+sunrise = int(datetime.fromtimestamp(sunrise).strftime('%H%M'))
+sunset = int(datetime.fromtimestamp(sunset).strftime('%H%M'))
+
+for range, moon_icon in moon_phase.items():
+    if range[0] <= moon_curr <= range[1]:
+        moon_curr = moon_icon
+        break
+
+night = (0000, sunrise, sunset + 100, 2359)
+sunset = (sunset, sunset + 50)
+dusk = (sunset[1], sunset[1] + 50)
+day = (sunrise, sunset)
+
+if (dusk[0] <= curr_time_int <= dusk[1]) and main == 'Clear':
+    icon = "πŸŒ†"
+elif (sunset[0] <= curr_time_int <= sunset[1]) and (main == 'Clear'):
+    icon = "πŸŒ‡"
+elif ((night[0] <= curr_time_int <= night[1]) or (night[2] <= curr_time_int <= night[3])):
+    icon = moon_curr
+
+print("{} {}Β° {}".format(icon, temp, main))
diff --git a/switchkblayout b/switchkblayout
@@ -1,12 +1,14 @@
 #!/bin/sh
 
+# switchs keyboard layout and updates dwmblocks
+
 kb="$(setxkbmap -query | grep -oP 'layout:\s*\K\w+')" || exit 1
 
 case $kb in
     # us) setxkbmap es && dunstctl close-all && dunstify -t 2000 -h "string:bgcolor:#111111" "Switched keyboard layout to ES";;
     # es) setxkbmap us && dunstctl close-all && dunstify -t 2000 -h "string:bgcolor:#111111" "Switched keyboard layout to US";;
-    us) setxkbmap es && dunstify -r 1 -t 2000 -h "string:bgcolor:#111111" "Switched keyboard layout to ES πŸ‡¦πŸ‡·";;
-    es) setxkbmap us && dunstify -r 1 -t 2000 -h "string:bgcolor:#111111" "Switched keyboard layout to US πŸ‡ΊπŸ‡Έ";;
+    us) setxkbmap -option altwin:swap_lalt_lwin,altwin:swap_alt_win,ctrl:nocaps es && dunstify -r 1 -t 2000 -h "string:bgcolor:#111111" "Switched keyboard layout to ES πŸ‡¦πŸ‡·";;
+    es) setxkbmap -option altwin:swap_lalt_lwin,altwin:swap_alt_win,ctrl:nocaps us && dunstify -r 1 -t 2000 -h "string:bgcolor:#111111" "Switched keyboard layout to US πŸ‡ΊπŸ‡Έ";;
 esac
 
-pkill -RTMIN+30 dwmblocks
+pkill -RTMIN+4 dwmblocks
diff --git a/takescreenshot b/takescreenshot
@@ -1,12 +1,17 @@
 #!/bin/sh
 
-# Takes a screenshot of the screen and then saves it on the corresponding folder
+# Takes a screenshot of the screen and sends a notification with a preview
 
 FOLDER=~/pictures/screenshots
 FILENAME=$FOLDER/$(date "+%H-%M-%S_%d-%m-%Y_scrot.png")
 
-scrot $FILENAME
+scrot -q 100 $FILENAME
 
-ACTION=$(dunstify -r 1 -t 5000 -h "string:bgcolor:#111111" "Saving screenshot ..." -h "string:bgcolor:#111111" "Click to open" --action=3,Open)
+convert -brightness-contrast 10x10 $FILENAME -resize 512x512 \
+    /tmp/takescreenshot_icon.png
 
-[ $ACTION -eq 3 ] && xdg-open $FILENAME;
+ACTION=$(dunstify -r 1 -t 5000 -h "string:bgcolor:#111111" \
+    "Saving screenshot to $FOLDER" -h "string:bgcolor:#111111" \
+    "Right click to open" --action=3,Open -i /tmp/takescreenshot_icon.png)
+
+[ $ACTION -eq 3 ] && mimeopen $FILENAME;
diff --git a/tmux_status.sh b/tmux_status.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+data=$(gitmux -cfg ~/.config/tmux/gitmux.conf $@)
+
+if [ -z "$data" ]; then
+    printf "%-56s" "";
+    exit;
+fi
+
+str=$(echo -n $data | sed -e 's/#\[[^][]*\]//g')
+
+count=$(echo -n $str | wc -m)
+
+# 70 are fixed
+# padding=$((70 + desired_padding - count))
+
+padding=170
+
+printf "%-${padding}s" "$data"
diff --git a/unix b/unix
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# original artwork by http://www.sanderfocus.nl/#/portfolio/tech-heroes
+# converted to shell by #nixers @ irc.unix.chat
+
+cat << 'eof'
+                     ,_ ,_==β–„β–‚
+                  ,  β–‚β–ƒβ–„β–„β–…β–…β–…β–‚β–…ΒΎ.            /    /
+                   β–„β–†<Β΄  "Β»β–“β–“β–“%\       / /   / /
+                 ,β–…7"     Β΄>β–“β–“β–“%   /  / > / >/%
+                 ▐ΒΆβ–“       ,Β»β–“β–“ΒΎΒ΄  /> %/%// /  /
+                  ▓▃▅▅▅▃,,▄▅▅▅Æ\// ///>// />/   /
+                 V║«¼.;→ ║<«.,`=// />//%/% / /
+               //β• <Β΄ -Β²,)(β–“~"-╝/ΒΎ/ %/>/ />
+           / / / ▐% -./β–„β–ƒβ–„β–…▐, /7//;//% / /
+           / ////`β–Œ▐ %zWv xXβ–“β–‡β–Œ//&;% / /
+       / / / %//%/ΒΎΒ½Β΄β–Œβ–ƒβ–„β–„β–„β–„β–ƒβ–ƒ▐ΒΆ\/& /
+         </ /</%//`β–“!%β–“%β•£[38;5;255;β•£WY<Y)y&/`\
+     / / %/%//</%//\i7; β• N>)VY>7;  \_    UNIX IS VERY SIMPLE IT JUST NEEDS A
+  /   /</ //<///<_/%\β–“  V%W%Β£)XY  _/%β€Ύ\_,   GENIUS TO UNDERSTAND ITS SIMPLICITY
+   / / //%/_,=--^/%/%%\ΒΎ%ΒΆ%%}    /%%%%%%;\,
+    %/< /_/ %%%%%;X%%\%%;,     _/%%%;,     \
+   / / %%%%%%;,    \%%l%%;// _/%;, dmr
+ /    %%%;,         <;\-=-/ /
+     ;,                l
+eof
diff --git a/xinitrc b/xinitrc
@@ -1 +0,0 @@
-#!/bin/sh
diff --git a/xrandrbrightdef b/xrandrbrightdef
@@ -1 +0,0 @@
-xrandr --output eDP-1 --brightness 1.0
diff --git a/xrandrbrightnessup b/xrandrbrightnessup
@@ -1 +0,0 @@
-xrandr --output eDP-1 --brightness 1.0