From 19ee4a7871df1606748cf4142d2423b7773b027b Mon Sep 17 00:00:00 2001 From: cronyakatsuki Date: Mon, 21 Mar 2022 18:05:05 +0100 Subject: [PATCH] Update. --- dmenugames | 12 +++++++--- dmenugpu | 41 +++++++++++++++++++++++++++++++++ dmenukill | 13 +++++++++++ dmenulinkhandler | 2 +- dmenupass | 6 ----- dmenuprograms | 16 +++++++++++++ dmenurepos | 5 ---- dmenuryzenadj | 21 +++++++++-------- dmenuryzenadj-prof-manager | 14 ++++++++++++ dmenuusbman | 47 ++++++++++++++++++++++++++++++++++++++ 10 files changed, 152 insertions(+), 25 deletions(-) create mode 100755 dmenugpu create mode 100755 dmenukill delete mode 100755 dmenupass create mode 100755 dmenuprograms delete mode 100755 dmenurepos create mode 100755 dmenuryzenadj-prof-manager create mode 100755 dmenuusbman diff --git a/dmenugames b/dmenugames index ffd852a..d5de6c5 100755 --- a/dmenugames +++ b/dmenugames @@ -1,5 +1,11 @@ -#!/bin/sh +#!/bin/bash -# A script that uses my other project to list games and allows me to run them +declare -a Games=( + "Heroic (Launcher)" + "Lutris (Launcher)" +) -game_run | dmenu -l 20 -p "Choose what game to launch" | xargs -I {} game_run {} +case "$(printf "%s\n" "${Games[@]}" | dmenu -p "Choose your game")" in + "Heroic (Launcher)") heroic ;; + "Lutris (Launcher)") lutris ;; +esac diff --git a/dmenugpu b/dmenugpu new file mode 100755 index 0000000..9459d39 --- /dev/null +++ b/dmenugpu @@ -0,0 +1,41 @@ +#!/bin/sh + +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/dmenukill b/dmenukill new file mode 100755 index 0000000..ff04a04 --- /dev/null +++ b/dmenukill @@ -0,0 +1,13 @@ +#!/bin/sh + +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 = "yes" ] || exit + +kill -9 "${selected%% *}" + +quick-notify "Killed Procces" "$selected" diff --git a/dmenulinkhandler b/dmenulinkhandler index ca372b2..da5e5e3 100755 --- a/dmenulinkhandler +++ b/dmenulinkhandler @@ -7,5 +7,5 @@ case "$(printf "mpv\\nbrowser\\ncopy url\\nw3m" | dmenu -p "Open link with what mpv) "$VIDEO" "$1" ;; browser) "$BROWSER" "$1" > /dev/null;; "copy url") echo "$1" | xclip -selection clipboard ;; - w3m) w3m "$1";; + w3m) readable "$1" | w3m -T text/html ;; esac diff --git a/dmenupass b/dmenupass deleted file mode 100755 index fa58159..0000000 --- a/dmenupass +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# This script is the SUDO_ASKPASS variable, meaning that it will be used as a -# password prompt if needed. - -dmenu -p "$1" <&- && echo diff --git a/dmenuprograms b/dmenuprograms new file mode 100755 index 0000000..91de4ac --- /dev/null +++ b/dmenuprograms @@ -0,0 +1,16 @@ +#!/bin/bash + +declare -a software=( +"bitwarden-desktop" +"obs" +"godot" +"megasync" +"spotify" +"discord" +) + +choice=$(printf "%s\n" "${software[@]}" | dmenu -p "Choose software to run") + +[ -n $choice ] || exit + +$choice diff --git a/dmenurepos b/dmenurepos deleted file mode 100755 index c21acef..0000000 --- a/dmenurepos +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# A script to list directory in a give path and them after chosing one opening them in alacritty. - -find "$1" -xdev -maxdepth 1 -type d | dmenu -l 5 | xargs -I {} alacritty --working-directory {} diff --git a/dmenuryzenadj b/dmenuryzenadj index 3bbdda5..56cb195 100755 --- a/dmenuryzenadj +++ b/dmenuryzenadj @@ -1,17 +1,18 @@ #!/bin/sh -current_temp=$(sudo ryzenadj -i | grep 'tctl-temp' | awk '{ print $6 }') -slow_time=$(sudo ryzenadj -i | grep 'slow-time' | awk '{ print $4 }') +current_temp=$(sudo /bin/ryzenadj -i | grep 'tctl-temp' | awk '{ print $6 }') +slow_time=$(sudo /bin/ryzenadj -i | grep 'slow-time' | awk '{ print $4 }') -[ "$current_temp" = "70.000" ] & [ "$slow_time" = "60.000" ] && current_mode="heavy gaming" || current_mode="fluff mode" [ "$current_temp" = "60.000" ] && current_mode="normal mode" [ "$current_temp" = "65.000" ] && current_mode="light gaming" -[ "$current_temp" = "75.000" ] && current_mode="super heavy programs" +[ "$current_temp" = "70.000" ] && current_mode="heavy gaming" +[ "$current_temp" = "75.000" ] && current_mode="heavy programs" +[ "$current_temp" = "85.000" ] && current_mode="heavy gaming pro" -case "$(printf "normal mode\\nfluff mode\\nlight gaming\\nheavy gaming\\nsuper heavy programs" | dmenu -p "Current: $current_mode")" in - "normal mode") sudo ryzenadj --slow-time=30 --vrmmax-current=30000 --max-gfxclk=900 --max-fclk-frequency=1200 --tctl-temp=60 --stapm-limit=10000 --stapm-time=300 --fast-limit=12000 --slow-limit=11000; break ;; - "fluff mode") sudo ryzenadj --slow-time=30 --vrmmax-current=30000 --max-gfxclk=550 --max-fclk-frequency=1200 --tctl-temp=70 --stapm-limit=5000 --stapm-time=150 --fast-limit=7000 --slow-limit=6000; break ;; - "light gaming") sudo ryzenadj --slow-time=30 --vrmmax-current=35000 --max-gfxclk=900 --max-fclk-frequency=1200 --tctl-temp=65 --stapm-limit=10000 --stapm-time=300 --fast-limit=12000 --slow-limit=11000; break ;; - "heavy gaming") sudo ryzenadj --slow-time=60 --vrmmax-current=60000 --max-gfxclk=900 --max-fclk-frequency=1200 --tctl-temp=70 --stapm-limit=20000 --stapm-time=1000 --fast-limit=25000 --slow-limit=21000; break ;; - "super heavy programs") sudo ryzenadj --slow-time=60 --vrmmax-current=60000 --max-gfxclk=900 --max-fclk-frequency=1200 --tctl-temp=75 --stapm-limit=25000 --stapm-time=1000 --fast-limit=30000 --slow-limit=27000; break ;; +case "$(printf "normal mode\\nlight gaming\\nheavy gaming\\nheavy programs\\nheavy gaming pro" | dmenu -p "Current: $current_mode")" in + "normal mode") sudo ryzenadj --slow-time=30 --vrmmax-current=30000 --tctl-temp=60 --stapm-limit=10000 --stapm-time=300 --fast-limit=12000 --slow-limit=11000 --power-saving; 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 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 ;; esac diff --git a/dmenuryzenadj-prof-manager b/dmenuryzenadj-prof-manager new file mode 100755 index 0000000..e870c3a --- /dev/null +++ b/dmenuryzenadj-prof-manager @@ -0,0 +1,14 @@ +#!/bin/sh + +# A script to run my game specifiy ryzenadj scripts + + +# cd into the given directory +cd $1 + +profile=$(ls -1 -A | dmenu -l 30 -p "Choose your file!") + +[ -n "$profile" ] || exit + +quick-notify "Loading profile" "$profile" +./$profile diff --git a/dmenuusbman b/dmenuusbman new file mode 100755 index 0000000..7c5597a --- /dev/null +++ b/dmenuusbman @@ -0,0 +1,47 @@ +#!/bin/sh + +driveCount(){ + count="$(echo "$1" | wc -l)" +} + +mount(){ + mountable="$(lsblk -lp | awk '/^\/dev\/sd.*part $/ { print $1 " ("$4")" }')" + + if [ "$mountable" = "" ]; then + quick-notify "Dmenu Usb Manager" "No drives to mount" + exit + fi + + chosen="$(printf '%s' "$mountable" | dmenu -p "Drive to mount?")" + + if [ -n "$chosen" ];then + udisksctl mount -b "${chosen%% *}" + else + quick-notify "Dmenu Usb Manager" "No drives chosen to mount" + exit + fi + +} + +unmount(){ + mounted="$(lsblk -lp | awk '/run/ { print $1 " ("$4")" }')" + + if [ "$mounted" = "" ]; then + quick-notify "Dmenu Usb Manager" "No drives to unmount" + exit + fi + + chosen="$(printf '%s' "$mounted" | dmenu -p "Drive to unmount?")" + + if [ -n "$chosen" ];then + udisksctl unmount -b "${chosen%% *}" + else + quick-notify "Dmenu Usb Manager" "No drives chosen to unmount" + exit + fi +} + +case $(printf "mount\\nunmount" | dmenu -p "Chose your usb action") in + "mount") mount ;; + "unmount") unmount ;; +esac