diff --git a/.gitignore b/.gitignore index b96f3cc..0f260e2 100644 --- a/.gitignore +++ b/.gitignore @@ -129,3 +129,5 @@ signond/ torbrowser/ Mumble/ vlc/ +lxqt/ +rofi/ diff --git a/bashrc b/bashrc index d9e6c8e..9eed99f 100644 --- a/bashrc +++ b/bashrc @@ -9,6 +9,8 @@ PROMPT_COMMAND="echo" # Line jump after every command # General configs PATH="$HOME/.config/scripts${PATH:+:${PATH}}" # Enables custom scripts dir +PATH="$HOME/.config/scripts/menu${PATH:+:${PATH}}" +PATH="$HOME/.config/scripts/status${PATH:+:${PATH}}" bind "set completion-ignore-case on" # Case insensitive TAB complete shopt -s cdspell # Autocorrect directory name shopt -s autocd # cd into dir by typing the name @@ -22,6 +24,7 @@ export \ XDG_CONFIG_HOME="$HOME/.config" \ PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store" \ GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0" \ + MINETEST_USER_PATH="$XDG_DATA_HOME/minetest" \ VIMINIT="source $XDG_CONFIG_HOME/vim/vimrc" \ XSERVERRC="$XDG_CONFIG_HOME/X11/xserverrc" \ XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" \ diff --git a/dunst/dunstrc b/dunst/dunstrc index 51d1d0a..0d598b2 100644 --- a/dunst/dunstrc +++ b/dunst/dunstrc @@ -5,7 +5,7 @@ width = (200, 300) height = 200 origin = top-right - offset = 36x48 + offset = 16x32 scale = 0 notification_limit = 0 diff --git a/scripts/dmenu-scripts b/scripts/dmenu-scripts deleted file mode 100755 index 2dd98ec..0000000 --- a/scripts/dmenu-scripts +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -$(ls ~/.config/scripts/ | dmenu -i -p "Script:") diff --git a/scripts/iwctl-disconnect b/scripts/iwctl-disconnect deleted file mode 100755 index fec195a..0000000 --- a/scripts/iwctl-disconnect +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# Depends on script that grabs network name - -# Executes and notifies command success -iwctl station wlan0 disconnect "$iwdstat" && notify-send "直 Wireless Network" "Disconnected" || "直 Wireless Network" "Operation unsuccessful" diff --git a/scripts/iwctl-dmenu-connect b/scripts/iwctl-dmenu-connect deleted file mode 100755 index e4047d6..0000000 --- a/scripts/iwctl-dmenu-connect +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# 'iwd' connect helper using dmenu - -# Possibly very convoluted way of fetching SSIDs -network=$(iwctl station wlan0 get-networks | cut -d " " -f 7-21 | tail +5 | awk '{if(NF>0) {print $0}}' | awk -F " " '{print $1}' | dmenu -p "Connect:") -[ -z "$network" ] && exit # Exit if empty SSID - -# Attempt connection -iwctl station wlan0 connect --dont-ask "$network" -sleep 2 # Bit of grace time -# Exit with notification if $network is shown on status -iwctl station wlan0 show | grep "network" | awk '{print $3}' | grep -q "$network" && notify-send "󰖩 Wireless Network" "Connected to $network" && exit - -# Try connecting with passphrase -pass=$(dmenu -p "Passphrase:" -P < /dev/null) -# Test for empty password, exit if true -[ -z "$pass" ] && notify-send "󰖩 Wireless Network" "Invalid password: Empty" && exit -# Attempt conection with provided pass, notify and exit on success -iwctl --passphrase="$pass" station wlan0 connect --dont-ask "$network" -sleep 2 # Bit of grace time -# Exit with notification if $network is shown on status -iwctl station wlan0 show | grep "network" | awk '{print $3}' | grep -q "$network" && notify-send "󰖩 Wireless Network" "Connected to $network" && exit - -# Notify unsuccessful operation -notify-send "󰖩 Wireless Network" "Operation unsuccessful" diff --git a/scripts/iwctl-scan b/scripts/iwctl-scan deleted file mode 100755 index 71c0116..0000000 --- a/scripts/iwctl-scan +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# Shortcut for scanning networks - -# Attempt to scan networks, notify operation success -iwctl station wlan0 scan && notify-send "󰖩 Wireless Network" "Scanning..." || notify-send "󰖩 Wireless Network" "Operation unsuccessful" diff --git a/scripts/iwdstat b/scripts/iwdstat deleted file mode 100755 index a298bc3..0000000 --- a/scripts/iwdstat +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# Depends on 'iwd' -# Get current network SSID - -# Get SSID name and format properly -ssid=$(iwctl station wlan0 show | grep network | cut -d " " -f 19-23 | awk -F " " '{print $1}') - -# If $ssid variable is empty, display "Disconnected" -# Display network SSID otherwise -[ -z "$ssid" ] && echo "Disconnected" || echo "$ssid" diff --git a/scripts/menu/menu b/scripts/menu/menu new file mode 100755 index 0000000..3d0ad79 --- /dev/null +++ b/scripts/menu/menu @@ -0,0 +1,63 @@ +#!/bin/sh +# Script for using either bemenu or dmenu +# with preconfigured options + +# Simple configuration +MENU="bemenu" +col_main="#83a598" +col_second="#121212" + +# If given 'pass' as arg, +# format accordingly +PROMPT="$1" +MODE="$2" + +[ "$MODE" = "pass" ] && + BPASS="-x" && + DPASS="-P" + +# bemenu opts +BEMENU_OPTS=" \ + -c \ + -i \ + -l 10 \ + -M 5 \ + -W 0.3 \ + -B 2 \ + --cw 2 \ + --tb $col_main \ + --tf $col_second \ + --nb $col_second \ + --nf $col_main \ + --hb $col_main \ + --hf $col_second \ + --ab $col_second \ + --af $col_main \ + --bdr $col_main \ + -p $PROMPT \ + $BPASS \ +" +# If chosen bemenu, use this args +[ "$MENU" = "bemenu" ] && + OPTS="$BEMENU_OPTS" && + RUN="-run" + +# dmenu opts +DMENU_OPTS=" \ + -i \ + -l 10 \ + -nb $col_second \ + -nf $col_main \ + -sb $col_main \ + -sf $col_second \ + -p $PROMPT \ + $DPASS \ +" +# If chosen dmenu, use this args +[ "$MENU" = "dmenu" ] && + RUN="_run" + +[ -e "/usr/bin/bemenu" ] && [ "$MODE" = "run" ] && $MENU$RUN $OPTS +[ -e "/usr/bin/bemenu" ] && [ "$MODE" = "pass" ] && < /dev/null | $MENU $OPTS +[ -e "/usr/bin/bemenu" ] && [ "$MODE" = "empty" ] && < /dev/null | $MENU $OPTS +[ -e "/usr/bin/dmenu" ] && [ -z "$MODE" ] && $MENU $OPTS diff --git a/scripts/dmenu-addbookmark b/scripts/menu/menu-addbookmark similarity index 82% rename from scripts/dmenu-addbookmark rename to scripts/menu/menu-addbookmark index 93909a0..5b77b3f 100755 --- a/scripts/dmenu-addbookmark +++ b/scripts/menu/menu-addbookmark @@ -7,7 +7,8 @@ bookmark="$(xsel -ob)" if grep -q "$bookmark" "$HOME/Documents/bookmarks" ; then notify-send "󰃀 Bookmarks" "Already bookmarked" else - name="$(dmenu -p 'Bookmark name:' < /dev/null)" + name="$(menu 'Bookmark name:' empty)" + [ -z "$name" ] && exit entry="$name-$bookmark" echo "$entry" >> "$HOME/Documents/bookmarks" notify-send "󰃀 Bookmarks" "Added '$entry'" diff --git a/scripts/dmenu-bookmarks b/scripts/menu/menu-bookmarks similarity index 89% rename from scripts/dmenu-bookmarks rename to scripts/menu/menu-bookmarks index abf90f6..c41f44e 100755 --- a/scripts/dmenu-bookmarks +++ b/scripts/menu/menu-bookmarks @@ -2,7 +2,7 @@ # Open URLs from bookmarks file # Print site names, then get URL based on the name. Exit if empty -name=$(cut -d '-' -f 1 $HOME/Documents/bookmarks | grep -v '^#' | sed '/^\s*$/d' | dmenu -i -p "Site:") +name=$(cut -d '-' -f 1 $HOME/Documents/bookmarks | grep -v '^#' | sed '/^\s*$/d' | menu "Site:") [ -z "$name" ] && exit grep "$name" $HOME/Documents/bookmarks | cut -d '-' -f 2- | xsel -ib && notify-send "󰃀 Bookmarks" "'$name' copied to clipboard" diff --git a/scripts/dmenu-emoji b/scripts/menu/menu-emoji similarity index 75% rename from scripts/dmenu-emoji rename to scripts/menu/menu-emoji index c037cb5..3a91840 100755 --- a/scripts/dmenu-emoji +++ b/scripts/menu/menu-emoji @@ -3,8 +3,8 @@ # Custom version of Luke Smith's # famous "get a menu of emojis to copy" script. -# Get user selection via dmenu from emoji file. -chosen=$(cut -d ';' -f1 ~/.local/share/chars/* | dmenu -p "Emoji: " | sed "s/ .*//") +# Get user selection via menu from emoji file. +chosen=$(cut -d ';' -f1 ~/.local/share/chars/* | menu "Emoji:" | sed "s/ .*//") # Exit if none chosen. [ -z "$chosen" ] && exit diff --git a/scripts/dmenu-input b/scripts/menu/menu-input similarity index 80% rename from scripts/dmenu-input rename to scripts/menu/menu-input index 20be87c..78d32e0 100755 --- a/scripts/dmenu-input +++ b/scripts/menu/menu-input @@ -2,7 +2,7 @@ # Set default input device # Get proper name from sources -input=$(pactl list short sources | cut -f 2 | grep input | dmenu -i -p "Input:") +input=$(pactl list short sources | cut -f 2 | grep input | menu "Input:") # Set audio device, notify command success pactl set-default-source "$input" && notify-send "󰕾 Default Input" "Set to '$input'" || notify-send "󰕾 Default Input" "Didn't change" diff --git a/scripts/dmenu-mount b/scripts/menu/menu-mount similarity index 94% rename from scripts/dmenu-mount rename to scripts/menu/menu-mount index 53d268a..14d144d 100755 --- a/scripts/dmenu-mount +++ b/scripts/menu/menu-mount @@ -4,7 +4,7 @@ # disk identification method # Get LABEL of disk and device name -disk=$(blkid | grep -wv primary | cut -d '=' -f 2 | cut -d '"' -f2 | dmenu -p "Mount: ") +disk=$(blkid | grep -wv primary | cut -d '=' -f 2 | cut -d '"' -f2 | menu "Mount:") device=$(blkid | grep "$disk" | cut -d ':' -f 1 | cut -d '/' -f 3) # Attempt to mount $device and notify success of command diff --git a/scripts/dmenu-otp b/scripts/menu/menu-otp similarity index 87% rename from scripts/dmenu-otp rename to scripts/menu/menu-otp index 5bd5531..2ca077e 100755 --- a/scripts/dmenu-otp +++ b/scripts/menu/menu-otp @@ -2,7 +2,7 @@ # OTP script for 'pass' # Ask for password name in vault -password=$(find $XDG_DATA_HOME/password-store/ -type f -name '*.gpg' | sed 's/.*\/\(.*\)\.gpg$/\1/' | dmenu -i -p "OTP:") +password=$(find $XDG_DATA_HOME/password-store/ -type f -name '*.gpg' | sed 's/.*\/\(.*\)\.gpg$/\1/' | menu "OTP:") # Exit if none chosen [ -z "$password" ] && exit diff --git a/scripts/dmenu-output b/scripts/menu/menu-output similarity index 82% rename from scripts/dmenu-output rename to scripts/menu/menu-output index 9310d2a..c45776b 100755 --- a/scripts/dmenu-output +++ b/scripts/menu/menu-output @@ -2,7 +2,7 @@ # Set default output device # Get proper name from sinks -output=$(pactl list short sinks | cut -f 2 | dmenu -i -p "Output:") +output=$(pactl list short sinks | cut -f 2 | menu "Output:") # Set audio device, notify command success pactl set-default-sink "$output" && notify-send "󰕾 Default Output" "Set to '$output'" || notify-send "󰕾 Default Output" "Didn't change" diff --git a/scripts/dmenu-pass b/scripts/menu/menu-pass similarity index 86% rename from scripts/dmenu-pass rename to scripts/menu/menu-pass index cf15c40..f065ea0 100755 --- a/scripts/dmenu-pass +++ b/scripts/menu/menu-pass @@ -3,7 +3,7 @@ # Ask for password name in vault password=$(find $XDG_DATA_HOME/password-store/ -type f -name '*.gpg' | - sed 's/.*\/\(.*\)\.gpg$/\1/' | dmenu -i -p "Password:") + sed 's/.*\/\(.*\)\.gpg$/\1/' | menu "Password:") # Exit if none chosen [ -z "$password" ] && exit diff --git a/scripts/dmenu-power b/scripts/menu/menu-power similarity index 70% rename from scripts/dmenu-power rename to scripts/menu/menu-power index 6f8ca5b..05e43eb 100755 --- a/scripts/dmenu-power +++ b/scripts/menu/menu-power @@ -1,7 +1,7 @@ #!/bin/sh # Prompt for power options using dmenu -option=$(printf "Shutdown\nRestart" | dmenu -i -p "Power:") +option=$(printf "Shutdown\nRestart" | menu "Power:") case "$option" in "Shutdown") sudo poweroff ;; diff --git a/scripts/menu/menu-scripts b/scripts/menu/menu-scripts new file mode 100755 index 0000000..00c72cf --- /dev/null +++ b/scripts/menu/menu-scripts @@ -0,0 +1,3 @@ +#!/bin/sh + +$(ls ~/.config/scripts/ | menu "Script:") diff --git a/scripts/dmenu-snippets b/scripts/menu/menu-snippets similarity index 75% rename from scripts/dmenu-snippets rename to scripts/menu/menu-snippets index c600459..d27ccf1 100755 --- a/scripts/dmenu-snippets +++ b/scripts/menu/menu-snippets @@ -3,8 +3,8 @@ # Snippets directory snippets=~/.config/snippets -# Select using dmenu, copy if successful -snippet=$(ls "$snippets" | dmenu -p "Snippet:") +# Select using menu, copy if successful +snippet=$(ls "$snippets" | menu "Snippet:") # Exit if empty [ -z "$snippet" ] && exit diff --git a/scripts/dmenu-unmount b/scripts/menu/menu-unmount similarity index 94% rename from scripts/dmenu-unmount rename to scripts/menu/menu-unmount index 87d1fc1..26c3041 100755 --- a/scripts/dmenu-unmount +++ b/scripts/menu/menu-unmount @@ -4,7 +4,7 @@ # disk identification method # Get LABEL of disk and device name -disk=$(blkid | grep -wv primary | cut -d '=' -f 2 | cut -d '"' -f2 | dmenu -p "Unmount: ") +disk=$(blkid | grep -wv primary | cut -d '=' -f 2 | cut -d '"' -f2 | menu "Unmount:") device=$(blkid | grep "$disk" | cut -d ':' -f 1 | cut -d '/' -f 3) # Attempt to unmount $device and notify success of command diff --git a/scripts/batstat b/scripts/status/batstat similarity index 100% rename from scripts/batstat rename to scripts/status/batstat diff --git a/scripts/cpustat b/scripts/status/cpustat similarity index 100% rename from scripts/cpustat rename to scripts/status/cpustat diff --git a/scripts/layoutstat b/scripts/status/layoutstat similarity index 100% rename from scripts/layoutstat rename to scripts/status/layoutstat diff --git a/scripts/memorystat b/scripts/status/memorystat similarity index 100% rename from scripts/memorystat rename to scripts/status/memorystat diff --git a/scripts/micstat b/scripts/status/micstat similarity index 95% rename from scripts/micstat rename to scripts/status/micstat index d58edb9..7c9251d 100755 --- a/scripts/micstat +++ b/scripts/status/micstat @@ -26,7 +26,6 @@ case 1 in $((vol >= 20)) ) bar="━━────────" ;; $((vol >= 10)) ) bar="━─────────" ;; $((vol >= 0)) ) bar="──────────" ;; - $((vol = 0)) ) bar="──────────" ;; esac # Print and notify diff --git a/scripts/netstat b/scripts/status/netstat similarity index 96% rename from scripts/netstat rename to scripts/status/netstat index 2fb947a..1076991 100755 --- a/scripts/netstat +++ b/scripts/status/netstat @@ -20,7 +20,6 @@ int() { # Type of interface & status $((strength >= 20)) ) bar="━━────────" ;; $((strength >= 10)) ) bar="━─────────" ;; $((strength >= 0)) ) bar="──────────" ;; - $((strength = 0)) ) bar="──────────" ;; esac echo "󰖩 $bar" return 0 diff --git a/scripts/nettraf b/scripts/status/nettraf similarity index 100% rename from scripts/nettraf rename to scripts/status/nettraf diff --git a/scripts/netstat-dow b/scripts/status/nettraf-dow similarity index 100% rename from scripts/netstat-dow rename to scripts/status/nettraf-dow diff --git a/scripts/netstat-up b/scripts/status/nettraf-up similarity index 100% rename from scripts/netstat-up rename to scripts/status/nettraf-up diff --git a/scripts/volstat b/scripts/status/volstat similarity index 95% rename from scripts/volstat rename to scripts/status/volstat index 57d8329..73b20c6 100755 --- a/scripts/volstat +++ b/scripts/status/volstat @@ -26,7 +26,6 @@ case 1 in $((vol >= 20)) ) bar="━━────────" ;; $((vol >= 10)) ) bar="━─────────" ;; $((vol >= 0)) ) bar="──────────" ;; - $((vol = 0)) ) bar="──────────" ;; esac # Print and notify