Using a config made dmenu.

This commit is contained in:
Crony Akatsuki 2022-07-17 11:03:13 +02:00
parent 587f300ac7
commit 321f370263
19 changed files with 63 additions and 28 deletions

View File

@ -2,6 +2,8 @@
# a script to quickly open up one of my many configs # a script to quickly open up one of my many configs
source $HOME/.config/dmenu/config
editor="$TERMINAL -e $EDITOR" editor="$TERMINAL -e $EDITOR"
declare -a configs=( declare -a configs=(
@ -28,7 +30,7 @@ declare -a configs=(
"qtile - $HOME/.config/qtile/config.py" "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 [ -z "$choice" ] && exit

View File

@ -1,5 +1,7 @@
#!/bin/sh #!/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

View File

@ -2,9 +2,11 @@
# script to download a file from that has it's link in clipboard # 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 # a functions that list all everything in a directory and gives back the chosen one
choice (){ 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 # first choice

View File

@ -4,13 +4,14 @@
# and it will list all your files and open them # and it will list all your files and open them
# in your prefered program with xdg-open # in your prefered program with xdg-open
source $HOME/.config/dmenu/config
# cd into the given directory # cd into the given directory
cd $1 cd $1
# a functions that list all everything in a directory and gives back the chosen one # a functions that list all everything in a directory and gives back the chosen one
choice (){ choice (){
(ls -1 -a | dmenu -l 30 -p "Choose your file!") (ls -1 -a | $DMENU -l 30 -p "Choose your file!")
} }
# first choice # first choice

View File

@ -2,8 +2,10 @@
# dmenu script to open up my games # dmenu script to open up my games
source $HOME/.config/dmenu/config
get_category () { get_category () {
category=$( game-run list | dmenu -p "Choose game category:") category=$( game-run list | $DMENU -p "Choose game category:")
[ -z "$category" ] && exit 0 [ -z "$category" ] && exit 0
} }
@ -14,9 +16,9 @@ while [ -z "$game" ]
do do
if [ -z "$1" ]; then 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 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 else
printf '%s\n' "Option $1 doesn't exit!!" printf '%s\n' "Option $1 doesn't exit!!"
exit 1 exit 1

View File

@ -2,11 +2,13 @@
# kill those pesky proceses # 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 [ -n "$selected" ] || exit
answer=$(printf "yes\\nno" | dmenu -p "Are you sure?") answer=$(printf "yes\\nno" | $DMENU -p "Are you sure?")
[ $answer = "yes" ] || exit [ $answer = "yes" ] || exit

View File

@ -3,4 +3,6 @@
# This script is the SUDO_ASKPASS variable, meaning that it will be used as a # This script is the SUDO_ASKPASS variable, meaning that it will be used as a
# password prompt if needed. # password prompt if needed.
dmenu -P -p "$1" <&- && echo source $HOME/.config/dmenu/config
$DMENU -P -p "$1" <&- && echo

View File

@ -3,6 +3,8 @@
# script to run a menu prompt when having more than 2 players since # 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 # playerctl is bad at managing more than one player at the same time
source $HOME/.config/dmenu/config
command="$@" command="$@"
instances=$(playerctl -l | wc -l) instances=$(playerctl -l | wc -l)
@ -11,6 +13,6 @@ if [ "$instances" = "0" ]; then
elif [ "$instances" -lt "2" ]; then elif [ "$instances" -lt "2" ]; then
playerctl $command playerctl $command
else else
choice=$(playerctl -l | dmenu -p 'Manage:') choice=$(playerctl -l | $DMENU -p 'Manage:')
playerctl -p $choice $command playerctl -p $choice $command
fi fi

View File

@ -2,7 +2,9 @@
# simple power menu script # 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 ;; "shutdown") sudo poweroff ;;
"reboot") sudo reboot ;; "reboot") sudo reboot ;;
esac esac

View File

@ -2,6 +2,8 @@
# dmenu script to run one of my most runned programs # dmenu script to run one of my most runned programs
source $HOME/.config/dmenu/config
declare -a software=( declare -a software=(
"bitwarden-desktop" "bitwarden-desktop"
"megasync" "megasync"
@ -9,7 +11,7 @@ declare -a software=(
"discord" "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 [ -n $choice ] || exit

View File

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
source $HOME/.config/dmenu/config
notAvailable=$(pactl list sinks | grep 'analog-output-headphones' | grep 'not available') notAvailable=$(pactl list sinks | grep 'analog-output-headphones' | grep 'not available')
[ ! -z "$notAvailable" ] && quick-notify "Port Master" "Only one port available" && exit [ ! -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=$(pactl list sinks | grep 'Active Port' | awk '{ print $3 }')
[ "$current" = "analog-output-speaker" ] && current="Speakers" || current="Headphones" [ "$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 ;; "Speakers") pactl set-sink-port 0 analog-output-speaker ;;
"Headphones") pactl set-sink-port 0 analog-output-headphones ;; "Headphones") pactl set-sink-port 0 analog-output-headphones ;;
esac esac

View File

@ -3,8 +3,11 @@
# script to run roms from different systems in their respective emulators # 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 # a functions that list all everything in a directory and gives back the chosen one
source $HOME/.config/dmenu/config
choice (){ choice (){
(ls -1 | dmenu -l 30 -p "Choose your $system rom!") (ls -1 | $DMENU -l 30 -p "Choose your $system rom!")
} }
run_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)") "Nintendo - Nintendo Entertainment System (1983-2003)")
emulator="fceux" emulator="fceux"
system="NES" system="NES"

View File

@ -1,5 +1,7 @@
#!/bin/sh #!/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 $choice

View File

@ -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 ;; "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 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 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 esac

View File

@ -2,11 +2,12 @@
# A script to run my game specifiy ryzenadj scripts # A script to run my game specifiy ryzenadj scripts
source $HOME/.config/dmenu/config
# cd into the given directory # cd into the given directory
cd $1 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 [ -n "$profile" ] || exit

View File

@ -3,10 +3,12 @@
# It lets you choose the kind of screenshot to take, including # It lets you choose the kind of screenshot to take, including
# copying the image or even highlighting an area to copy. # copying the image or even highlighting an area to copy.
source $HOME/.config/dmenu/config
dir="$HOME/Pictures/screenshots" dir="$HOME/Pictures/screenshots"
[ ! -d "$dir" ] && mkdir $dir -p [ ! -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" ;; "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" ;; "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" ;; "full screen") sleep 0.5; maim $dir/pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;;

View File

@ -2,6 +2,8 @@
# a simple dmenu usb managment script # a simple dmenu usb managment script
source $HOME/.config/dmenu/config
driveCount(){ driveCount(){
count="$(printf '%s\n' "$1" | wc -l)" count="$(printf '%s\n' "$1" | wc -l)"
} }
@ -10,11 +12,11 @@ mount(){
mountable="$(lsblk -lp | awk '/^\/dev\/sd.*part $/ { print $1 " ("$4")" }')" mountable="$(lsblk -lp | awk '/^\/dev\/sd.*part $/ { print $1 " ("$4")" }')"
if [ "$mountable" = "" ]; then if [ "$mountable" = "" ]; then
quick-notify "Dmenu Usb Manager" "No drives to mount" quick-notify "$DMENU Usb Manager" "No drives to mount"
exit exit
fi fi
chosen="$(printf '%s' "$mountable" | dmenu -p "Drive to mount?")" chosen="$(printf '%s' "$mountable" | $DMENU -p "Drive to mount?")"
if [ -n "$chosen" ];then if [ -n "$chosen" ];then
udisksctl mount -b "${chosen%% *}" udisksctl mount -b "${chosen%% *}"
@ -34,7 +36,7 @@ unmount(){
exit exit
fi fi
chosen="$(printf "$mounted" | dmenu -p "Drive to unmount?")" chosen="$(printf "$mounted" | $DMENU -p "Drive to unmount?")"
if [ -n "$chosen" ];then if [ -n "$chosen" ];then
udisksctl unmount -b "${chosen%% *}" udisksctl unmount -b "${chosen%% *}"
@ -45,7 +47,7 @@ unmount(){
fi 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 ;; "mount") mount ;;
"unmount") unmount ;; "unmount") unmount ;;
esac esac

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source $HOME/.config/dmenu/config
quick-notify "Getting list of available Wi-Fi networks..." quick-notify "Getting list of available Wi-Fi networks..."
# Get a list of available wifi connections and morph it into a nice-looking list # 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") 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 fi
# Use dmenu to select wifi network # 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 # Get name of connection
chosen_id=$(printf '%s\n' "${chosen_network:3}" | xargs) 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" nmcli connection up id "$chosen_id" | grep "successfully" && quick-notify "Connection Established" "$success_message"
else else
if [[ "$chosen_network" =~ "" ]]; then if [[ "$chosen_network" =~ "" ]]; then
wifi_password=$(dmenu -p "Password: " ) wifi_password=$($DMENU -P -p "Password: " )
fi fi
nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && quick-notify "Connection Established" "$success_message" nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && quick-notify "Connection Established" "$success_message"
fi fi

View File

@ -2,6 +2,8 @@
# Search offline copy of the arch wiki # Search offline copy of the arch wiki
source $HOME/.config/dmenu/config
dir="/usr/share/doc/arch-wiki/html/en/" dir="/usr/share/doc/arch-wiki/html/en/"
docs="$(find $dir -iname "*.html")" docs="$(find $dir -iname "*.html")"
@ -11,7 +13,7 @@ main () {
cut -d '/' -f8- | \ cut -d '/' -f8- | \
sed -e 's/_/ /g' -e 's/.html//g' | \ sed -e 's/_/ /g' -e 's/.html//g' | \
sort | \ sort | \
dmenu -i -l 20 -p "Arch Wiki Docs:") $DMENU -i -l 20 -p "Arch Wiki Docs:")
if [ "$choice" ]; then if [ "$choice" ]; then
article=$(printf '%s\n' "${dir}${choice}.html" | sed 's/ /_/g') article=$(printf '%s\n' "${dir}${choice}.html" | sed 's/ /_/g')