From 321f370263e076b5ddd7081cc7d598aed7ef7d07 Mon Sep 17 00:00:00 2001 From: Crony Akatsuki Date: Sun, 17 Jul 2022 11:03:13 +0200 Subject: [PATCH] Using a config made dmenu. --- dmenu-configs | 4 +++- dmenu-dict | 6 ++++-- dmenu-dl-manager | 4 +++- dmenu-file-handler | 3 ++- dmenu-games | 8 +++++--- dmenu-kill | 6 ++++-- dmenu-pass | 4 +++- dmenu-playerctl | 4 +++- dmenu-power-menu | 4 +++- dmenu-programs | 4 +++- dmenu-pulse-port-man | 4 +++- dmenu-retro | 7 +++++-- dmenu-runner | 4 +++- dmenu-ryzenadj | 2 +- dmenu-ryzenadj-prof-manager | 3 ++- dmenu-screenshot | 4 +++- dmenu-usb-man | 10 ++++++---- dmenu-wifi | 6 ++++-- dmenu-wiki | 4 +++- 19 files changed, 63 insertions(+), 28 deletions(-) diff --git a/dmenu-configs b/dmenu-configs index 2ad0d0f..a4d5efc 100755 --- a/dmenu-configs +++ b/dmenu-configs @@ -2,6 +2,8 @@ # a script to quickly open up one of my many configs +source $HOME/.config/dmenu/config + editor="$TERMINAL -e $EDITOR" declare -a configs=( @@ -28,7 +30,7 @@ declare -a configs=( "qtile - $HOME/.config/qtile/config.py" ) -choice=$(printf '%s\n' "${configs[@]}" | dmenu -l 10 -p 'Edit config:') +choice=$(printf '%s\n' "${configs[@]}" | $DMENU -l 10 -p 'Edit config:') [ -z "$choice" ] && exit diff --git a/dmenu-dict b/dmenu-dict index c908d44..7079d26 100755 --- a/dmenu-dict +++ b/dmenu-dict @@ -1,5 +1,7 @@ #!/bin/sh -word="$(printf '\n' | dmenu -p "Enter Word")" +source $HOME/.config/dmenu/config -dym -c $word | dmenu -p "Select spelling" | xclip -selection clipboard +word="$(printf '\n' | $DMENU -p "Enter Word")" + +dym -c $word | $DMENU -p "Select spelling" | xclip -selection clipboard diff --git a/dmenu-dl-manager b/dmenu-dl-manager index 8ca45ca..e96a517 100755 --- a/dmenu-dl-manager +++ b/dmenu-dl-manager @@ -2,9 +2,11 @@ # script to download a file from that has it's link in clipboard +source $HOME/.config/dmenu/config + # a functions that list all everything in a directory and gives back the chosen one choice (){ - (ls -1 -a | dmenu -l 30 -p "Choose where to download") + (ls -1 -a | $DMENU -l 30 -p "Choose where to download") } # first choice diff --git a/dmenu-file-handler b/dmenu-file-handler index d77afed..eee156e 100755 --- a/dmenu-file-handler +++ b/dmenu-file-handler @@ -4,13 +4,14 @@ # and it will list all your files and open them # in your prefered program with xdg-open +source $HOME/.config/dmenu/config # cd into the given directory cd $1 # a functions that list all everything in a directory and gives back the chosen one choice (){ - (ls -1 -a | dmenu -l 30 -p "Choose your file!") + (ls -1 -a | $DMENU -l 30 -p "Choose your file!") } # first choice diff --git a/dmenu-games b/dmenu-games index efaf1e9..34811a2 100755 --- a/dmenu-games +++ b/dmenu-games @@ -2,8 +2,10 @@ # dmenu script to open up my games +source $HOME/.config/dmenu/config + get_category () { - category=$( game-run list | dmenu -p "Choose game category:") + category=$( game-run list | $DMENU -p "Choose game category:") [ -z "$category" ] && exit 0 } @@ -14,9 +16,9 @@ while [ -z "$game" ] do if [ -z "$1" ]; then - game=$(game-run list $category | sed '/-18+/d' | dmenu -p "Choose game to run:") + game=$(game-run list $category | sed '/-18+/d' | $DMENU -p "Choose game to run:") elif [ "$1" = "-a" ]; then - game=$(game-run list $category | dmenu -p "Choose game to run:") + game=$(game-run list $category | $DMENU -p "Choose game to run:") else printf '%s\n' "Option $1 doesn't exit!!" exit 1 diff --git a/dmenu-kill b/dmenu-kill index 7b5e6f8..cb22fea 100755 --- a/dmenu-kill +++ b/dmenu-kill @@ -2,11 +2,13 @@ # kill those pesky proceses -selected=$(ps --user "$USER" -F | dmenu -p "Select procces to kill:" -l 5 | awk '{print $2" "$11}') +source $HOME/.config/dmenu/config + +selected=$(ps --user "$USER" -F | $DMENU -p "Select procces to kill:" -l 5 | awk '{print $2" "$11}') [ -n "$selected" ] || exit -answer=$(printf "yes\\nno" | dmenu -p "Are you sure?") +answer=$(printf "yes\\nno" | $DMENU -p "Are you sure?") [ $answer = "yes" ] || exit diff --git a/dmenu-pass b/dmenu-pass index b8e2f1b..98617d7 100755 --- a/dmenu-pass +++ b/dmenu-pass @@ -3,4 +3,6 @@ # This script is the SUDO_ASKPASS variable, meaning that it will be used as a # password prompt if needed. -dmenu -P -p "$1" <&- && echo +source $HOME/.config/dmenu/config + +$DMENU -P -p "$1" <&- && echo diff --git a/dmenu-playerctl b/dmenu-playerctl index ce40791..5372f37 100755 --- a/dmenu-playerctl +++ b/dmenu-playerctl @@ -3,6 +3,8 @@ # script to run a menu prompt when having more than 2 players since # playerctl is bad at managing more than one player at the same time +source $HOME/.config/dmenu/config + command="$@" instances=$(playerctl -l | wc -l) @@ -11,6 +13,6 @@ if [ "$instances" = "0" ]; then elif [ "$instances" -lt "2" ]; then playerctl $command else - choice=$(playerctl -l | dmenu -p 'Manage:') + choice=$(playerctl -l | $DMENU -p 'Manage:') playerctl -p $choice $command fi diff --git a/dmenu-power-menu b/dmenu-power-menu index dd2791a..62e6d36 100755 --- a/dmenu-power-menu +++ b/dmenu-power-menu @@ -2,7 +2,9 @@ # simple power menu script -case "$(printf "shutdown\\nreboot" | dmenu -p "Choose your poison")" in +source $HOME/.config/dmenu/config + +case "$(printf "shutdown\\nreboot" | $DMENU -p "Choose your poison")" in "shutdown") sudo poweroff ;; "reboot") sudo reboot ;; esac diff --git a/dmenu-programs b/dmenu-programs index 88a20d7..d0d6946 100755 --- a/dmenu-programs +++ b/dmenu-programs @@ -2,6 +2,8 @@ # dmenu script to run one of my most runned programs +source $HOME/.config/dmenu/config + declare -a software=( "bitwarden-desktop" "megasync" @@ -9,7 +11,7 @@ declare -a software=( "discord" ) -choice=$(printf "%s\n" "${software[@]}" | dmenu -p "Choose software to run") +choice=$(printf "%s\n" "${software[@]}" | $DMENU -p "Choose software to run") [ -n $choice ] || exit diff --git a/dmenu-pulse-port-man b/dmenu-pulse-port-man index 9cfee9c..ddf2bde 100755 --- a/dmenu-pulse-port-man +++ b/dmenu-pulse-port-man @@ -1,5 +1,7 @@ #!/bin/sh +source $HOME/.config/dmenu/config + notAvailable=$(pactl list sinks | grep 'analog-output-headphones' | grep 'not available') [ ! -z "$notAvailable" ] && quick-notify "Port Master" "Only one port available" && exit @@ -7,7 +9,7 @@ notAvailable=$(pactl list sinks | grep 'analog-output-headphones' | grep 'not av current=$(pactl list sinks | grep 'Active Port' | awk '{ print $3 }') [ "$current" = "analog-output-speaker" ] && current="Speakers" || current="Headphones" -case "$(printf "Speakers\\nHeadphones" | dmenu -p "Current: $current ")" in +case "$(printf "Speakers\\nHeadphones" | $DMENU -p "Current: $current ")" in "Speakers") pactl set-sink-port 0 analog-output-speaker ;; "Headphones") pactl set-sink-port 0 analog-output-headphones ;; esac diff --git a/dmenu-retro b/dmenu-retro index f8411e9..fed92fe 100755 --- a/dmenu-retro +++ b/dmenu-retro @@ -3,8 +3,11 @@ # script to run roms from different systems in their respective emulators # a functions that list all everything in a directory and gives back the chosen one + +source $HOME/.config/dmenu/config + choice (){ - (ls -1 | dmenu -l 30 -p "Choose your $system rom!") + (ls -1 | $DMENU -l 30 -p "Choose your $system rom!") } run_rom (){ @@ -41,7 +44,7 @@ declare -a systems=( ) -case "$(printf '%s\n' "${systems[@]}" | dmenu -l 10 -p "Chose retro console:")" in +case "$(printf '%s\n' "${systems[@]}" | $DMENU -l 10 -p "Chose retro console:")" in "Nintendo - Nintendo Entertainment System (1983-2003)") emulator="fceux" system="NES" diff --git a/dmenu-runner b/dmenu-runner index 2be76b7..03cb3a6 100755 --- a/dmenu-runner +++ b/dmenu-runner @@ -1,5 +1,7 @@ #!/bin/sh -choice=$(dmenu_path | grep dmenu- | dmenu -p "Choose script to run:") +source $HOME/.config/dmenu/config + +choice=$(dmenu_path | grep dmenu- | $DMENU -p "Choose script to run:") $choice diff --git a/dmenu-ryzenadj b/dmenu-ryzenadj index bca6d6a..abf3505 100755 --- a/dmenu-ryzenadj +++ b/dmenu-ryzenadj @@ -18,5 +18,5 @@ case "$(printf "normal mode\\nlight gaming\\nheavy gaming\\nheavy programs\\nhea "light gaming") sudo ryzenadj --slow-time=30 --vrmmax-current=35000 --tctl-temp=65 --stapm-limit=10000 --stapm-time=300 --fast-limit=12000 --slow-limit=11000 --max-performance; break ;; "heavy gaming") sudo ryzenadj --slow-time=60 --vrmmax-current=60000 --tctl-temp=70 --stapm-limit=20000 --stapm-time=1000 --fast-limit=25000 --slow-limit=21000 --max-performance; break ;; "heavy programs") sudo ryzenadj --slow-time=60 --vrmmax-current=60000 --tctl-temp=75 --stapm-limit=25000 --stapm-time=1000 --fast-limit=30000 --slow-limit=27000 --max-performance; break ;; - "heavy gaming pro") sudo ryzenadj --slow-time=60 --vrmmax-current=70000 --tctl-temp=85 --stapm-limit=35000 --stapm-time=1000 --fast-limit=50000 --slow-limit=48000 --max-performance; break ;; + "heavy gaming pro") sudo ryzenadj --slow-time=60 --vrmmax-current=70000 --tctl-temp=85 --stapm-limit=35000 --stapm-time=1000 --fast-limit=35000 --slow-limit=35000 --max-performance; break ;; esac diff --git a/dmenu-ryzenadj-prof-manager b/dmenu-ryzenadj-prof-manager index 6233661..9ebf98c 100755 --- a/dmenu-ryzenadj-prof-manager +++ b/dmenu-ryzenadj-prof-manager @@ -2,11 +2,12 @@ # A script to run my game specifiy ryzenadj scripts +source $HOME/.config/dmenu/config # cd into the given directory cd $1 -profile=$(ls -1 -A | dmenu -l 30 -p "Choose your file!") +profile=$(ls -1 -A | $DMENU -l 5 -p "Choose your file!") [ -n "$profile" ] || exit diff --git a/dmenu-screenshot b/dmenu-screenshot index 0d2464a..aa9394b 100755 --- a/dmenu-screenshot +++ b/dmenu-screenshot @@ -3,10 +3,12 @@ # It lets you choose the kind of screenshot to take, including # copying the image or even highlighting an area to copy. +source $HOME/.config/dmenu/config + dir="$HOME/Pictures/screenshots" [ ! -d "$dir" ] && mkdir $dir -p -case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -p "Screenshot which area?")" in +case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | $DMENU -l 6 -p "Screenshot which area?")" in "a selected area") sleep 0.5; maim -s $dir/pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;; "current window") sleep 0.5; maim -i "$(xdotool getactivewindow)" $dir/pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;; "full screen") sleep 0.5; maim $dir/pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;; diff --git a/dmenu-usb-man b/dmenu-usb-man index 7c34331..1686298 100755 --- a/dmenu-usb-man +++ b/dmenu-usb-man @@ -2,6 +2,8 @@ # a simple dmenu usb managment script +source $HOME/.config/dmenu/config + driveCount(){ count="$(printf '%s\n' "$1" | wc -l)" } @@ -10,11 +12,11 @@ mount(){ mountable="$(lsblk -lp | awk '/^\/dev\/sd.*part $/ { print $1 " ("$4")" }')" if [ "$mountable" = "" ]; then - quick-notify "Dmenu Usb Manager" "No drives to mount" + quick-notify "$DMENU Usb Manager" "No drives to mount" exit fi - chosen="$(printf '%s' "$mountable" | dmenu -p "Drive to mount?")" + chosen="$(printf '%s' "$mountable" | $DMENU -p "Drive to mount?")" if [ -n "$chosen" ];then udisksctl mount -b "${chosen%% *}" @@ -34,7 +36,7 @@ unmount(){ exit fi - chosen="$(printf "$mounted" | dmenu -p "Drive to unmount?")" + chosen="$(printf "$mounted" | $DMENU -p "Drive to unmount?")" if [ -n "$chosen" ];then udisksctl unmount -b "${chosen%% *}" @@ -45,7 +47,7 @@ unmount(){ fi } -case $(printf "mount\\nunmount" | dmenu -p "Chose your usb action") in +case $(printf "mount\\nunmount" | $DMENU -p "Chose your usb action") in "mount") mount ;; "unmount") unmount ;; esac diff --git a/dmenu-wifi b/dmenu-wifi index e1a21a9..5675cbd 100755 --- a/dmenu-wifi +++ b/dmenu-wifi @@ -1,5 +1,7 @@ #!/usr/bin/env bash +source $HOME/.config/dmenu/config + quick-notify "Getting list of available Wi-Fi networks..." # Get a list of available wifi connections and morph it into a nice-looking list wifi_list=$(nmcli --fields "SECURITY,SSID" device wifi list --rescan yes | sed 1d | sed 's/ */ /g' | sed -E "s/WPA*.?\S/ /g" | sed "s/^--/ /g" | sed "s/ //g" | sed "/--/d") @@ -12,7 +14,7 @@ elif [[ "$connected" =~ "disabled" ]]; then fi # Use dmenu to select wifi network -chosen_network=$(printf '%s\n%s' "$toggle" "$wifi_list" | uniq -u | dmenu -p "Wi-Fi SSID: " ) +chosen_network=$(printf '%s\n%s' "$toggle" "$wifi_list" | uniq -u | $DMENU -p "Wi-Fi SSID: " ) # Get name of connection chosen_id=$(printf '%s\n' "${chosen_network:3}" | xargs) @@ -31,7 +33,7 @@ else nmcli connection up id "$chosen_id" | grep "successfully" && quick-notify "Connection Established" "$success_message" else if [[ "$chosen_network" =~ "" ]]; then - wifi_password=$(dmenu -p "Password: " ) + wifi_password=$($DMENU -P -p "Password: " ) fi nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && quick-notify "Connection Established" "$success_message" fi diff --git a/dmenu-wiki b/dmenu-wiki index 05912d8..788502e 100755 --- a/dmenu-wiki +++ b/dmenu-wiki @@ -2,6 +2,8 @@ # Search offline copy of the arch wiki +source $HOME/.config/dmenu/config + dir="/usr/share/doc/arch-wiki/html/en/" docs="$(find $dir -iname "*.html")" @@ -11,7 +13,7 @@ main () { cut -d '/' -f8- | \ sed -e 's/_/ /g' -e 's/.html//g' | \ sort | \ - dmenu -i -l 20 -p "Arch Wiki Docs:") + $DMENU -i -l 20 -p "Arch Wiki Docs:") if [ "$choice" ]; then article=$(printf '%s\n' "${dir}${choice}.html" | sed 's/ /_/g')