From 8364d66ca59e580c9be397e90b657aa873486059 Mon Sep 17 00:00:00 2001 From: cronyakatsuki Date: Fri, 22 Apr 2022 12:48:51 +0200 Subject: [PATCH] Updated scripts. --- dmenu-configs | 3 +++ dmenu-games | 14 ++++---------- dmenu-gpu | 43 ------------------------------------------- dmenu-pass | 6 ++++++ dmenu-power-menu | 4 ++-- dmenu-usb-man | 6 ++++-- dmenu-wifi | 6 +++--- 7 files changed, 22 insertions(+), 60 deletions(-) delete mode 100755 dmenu-gpu create mode 100755 dmenu-pass diff --git a/dmenu-configs b/dmenu-configs index b0d2e3f..2ad0d0f 100755 --- a/dmenu-configs +++ b/dmenu-configs @@ -10,6 +10,8 @@ declare -a configs=( "bspwm - $HOME/.config/bspwm/bspwmrc" "bspwm autostart - $HOME/Bin/bspwm/autorun.sh" "dunst - $HOME/.config/dunst/dunstrc" + "game-run - $HOME/.config/game-run/config.ini" + "kitty - $HOME/.config/kitty/kitty.conf" "lf - $HOME/.config/lf/lfrc" "sxhkd - $HOME/.config/sxhkd/sxhkdrc" "neovim - $HOME/.config/nvim/init.lua" @@ -23,6 +25,7 @@ declare -a configs=( "zshenv - $HOME/.zshenv" "zshrc - $HOME/.zshenv" "xinitrc - $HOME/.xinitrc" + "qtile - $HOME/.config/qtile/config.py" ) choice=$(printf '%s\n' "${configs[@]}" | dmenu -l 10 -p 'Edit config:') diff --git a/dmenu-games b/dmenu-games index 4ff9121..fb2dcbc 100755 --- a/dmenu-games +++ b/dmenu-games @@ -1,13 +1,7 @@ -#!/bin/bash +#!/bin/sh -# dmenu script to open up my games or game launcher's +# dmenu script to open up my games -declare -a Games=( - "Heroic (Launcher)" - "Lutris (Launcher)" -) +choice=$(game-run | dmenu -p "Choose game to run:") -case "$(printf "%s\n" "${Games[@]}" | dmenu -p "Choose your game")" in - "Heroic (Launcher)") heroic ;; - "Lutris (Launcher)") lutris ;; -esac +game-run "$choice" diff --git a/dmenu-gpu b/dmenu-gpu deleted file mode 100755 index 313941f..0000000 --- a/dmenu-gpu +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -# a simple "gui" for envycontrol - -already_in() -{ - quick-notify "Gpu Manager" "Already in $new_mode mode" -} - -switch() -{ - if sudo envycontrol.py --switch $new_mode; then - quick-notify "Gpu Manager" "Switched to $new_mode mode" - else - quick-notify "Gpu Manager" "Failed to switch to $new_mode mode" - fi -} - -case "$(printf "integrated\\nhybrid\\nnvidia" | dmenu -p "Choose gpu mode")" in - "integrated") new_mode="integrated";; - "nvidia") new_mode="nvidia";; - "hybrid") new_mode="hybrid";; -esac - -current_mode=$(envycontrol.py --status | awk '{ print $5 }') - -if [ $current_mode = "integrated" ]; then - case $new_mode in - "integrated") already_in;; - "nvidia") quick-notify "Gpu Manager" "You need to first reboot into hybrid mode";; - "hybrid") switch;; - esac -elif [ $current_mode = "hybrid" ]; then - case $new_mode in - "hybrid") already_in;; - *) switch;; - esac -elif [ $current_mode = "nvidia" ]; then - case $new_mode in - "nvidia") already_in;; - *) switch;; - esac -fi diff --git a/dmenu-pass b/dmenu-pass new file mode 100755 index 0000000..b8e2f1b --- /dev/null +++ b/dmenu-pass @@ -0,0 +1,6 @@ +#!/bin/sh + +# This script is the SUDO_ASKPASS variable, meaning that it will be used as a +# password prompt if needed. + +dmenu -P -p "$1" <&- && echo diff --git a/dmenu-power-menu b/dmenu-power-menu index 2279baa..dd2791a 100755 --- a/dmenu-power-menu +++ b/dmenu-power-menu @@ -3,6 +3,6 @@ # simple power menu script case "$(printf "shutdown\\nreboot" | dmenu -p "Choose your poison")" in - "shutdown") systemctl poweroff ;; - "reboot") systemctl reboot ;; + "shutdown") sudo poweroff ;; + "reboot") sudo reboot ;; esac diff --git a/dmenu-usb-man b/dmenu-usb-man index 70386eb..7c34331 100755 --- a/dmenu-usb-man +++ b/dmenu-usb-man @@ -3,7 +3,7 @@ # a simple dmenu usb managment script driveCount(){ - count="$(echo "$1" | wc -l)" + count="$(printf '%s\n' "$1" | wc -l)" } mount(){ @@ -18,6 +18,7 @@ mount(){ if [ -n "$chosen" ];then udisksctl mount -b "${chosen%% *}" + quick-notify "Dmenu Usb Manager" "Drive ${chosen%% *} mounted" else quick-notify "Dmenu Usb Manager" "No drives chosen to mount" exit @@ -33,10 +34,11 @@ unmount(){ exit fi - chosen="$(printf '%s' "$mounted" | dmenu -p "Drive to unmount?")" + chosen="$(printf "$mounted" | dmenu -p "Drive to unmount?")" if [ -n "$chosen" ];then udisksctl unmount -b "${chosen%% *}" + quick-notify "Dmenu Usb Manager" "Drive ${chosen%% *} unmounted" else quick-notify "Dmenu Usb Manager" "No drives chosen to unmount" exit diff --git a/dmenu-wifi b/dmenu-wifi index 0524014..e1a21a9 100755 --- a/dmenu-wifi +++ b/dmenu-wifi @@ -12,9 +12,9 @@ elif [[ "$connected" =~ "disabled" ]]; then fi # Use dmenu to select wifi network -chosen_network=$(echo -e "$toggle\n$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=$(echo "${chosen_network:3}" | xargs) +chosen_id=$(printf '%s\n' "${chosen_network:3}" | xargs) if [ "$chosen_network" = "" ]; then exit @@ -27,7 +27,7 @@ else success_message="You are now connected to the Wi-Fi network \"$chosen_id\"." # Get saved connections saved_connections=$(nmcli -g NAME connection) - if [[ $(echo "$saved_connections" | grep -w "$chosen_id") = "$chosen_id" ]]; then + if [[ $(printf '%s\n' "$saved_connections" | grep -w "$chosen_id") = "$chosen_id" ]]; then nmcli connection up id "$chosen_id" | grep "successfully" && quick-notify "Connection Established" "$success_message" else if [[ "$chosen_network" =~ "" ]]; then