From 9e3b9cc441cd52815aca81f5d41324d3a8861f58 Mon Sep 17 00:00:00 2001 From: CronyAkatsuki Date: Sat, 13 Mar 2021 18:09:41 +0100 Subject: [PATCH] Adding my scripts. --- README.md | 25 +++++++++++++++++++++++++ dmenufilehandler | 7 +++++++ dmenulinkhandler | 11 +++++++++++ dmenupass | 6 ++++++ dmenupowermenu | 6 ++++++ dmenuryzenadj | 9 +++++++++ dmenuscreenshot | 14 ++++++++++++++ 7 files changed, 78 insertions(+) create mode 100644 README.md create mode 100755 dmenufilehandler create mode 100755 dmenulinkhandler create mode 100755 dmenupass create mode 100755 dmenupowermenu create mode 100755 dmenuryzenadj create mode 100755 dmenuscreenshot diff --git a/README.md b/README.md new file mode 100644 index 0000000..0f0fdf9 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# Welcome to my dmenu scripts repository + +## dmenufilehandler + +A very simple script that uses the **find** command to list all the file and diretory's in a given path. After selecting one of the files or directory it will open it in your preferred program using xdg-open. + +> example + +~~~ +dmenufilehandler ~/Videos/Anime +~~~ + +## dmenulinkhandler + +A script that uses case to let you choose from a set of programs to open a link that you want in the desired one. Used in my newsboat config. + +Programs used in this script are **mpv**, environmental variable **BROWSER**, copying url using xclip and opening the url using w3m. + +> example + +~~~ +dmenulinkhandler gnu.org +~~~ + + diff --git a/dmenufilehandler b/dmenufilehandler new file mode 100755 index 0000000..a5d3956 --- /dev/null +++ b/dmenufilehandler @@ -0,0 +1,7 @@ +#!/bin/sh + +# feed the script with your directory path +# and it will list all your files and open them +# in your prefered program with xdg-open + +find "$1" | dmenu -l 30 | xargs -I {} xdg-open "{}" diff --git a/dmenulinkhandler b/dmenulinkhandler new file mode 100755 index 0000000..1851863 --- /dev/null +++ b/dmenulinkhandler @@ -0,0 +1,11 @@ +#!/bin/sh + +# Feed this script a link and it will give dmenu +# some choice programs to use to open it. + +case "$(printf "mpv\\nbrowser\\ncopy url\\nw3m" | dmenu -p "Open link with what program?")" in + mpv) mpv -quiet "$1" ;; + browser) "$BROWSER" "$1" > /dev/null;; + "copy url") echo "$1" | xclip -selection clipboard ;; + w3m) w3m "$1";; +esac diff --git a/dmenupass b/dmenupass new file mode 100755 index 0000000..fa58159 --- /dev/null +++ b/dmenupass @@ -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 "$1" <&- && echo diff --git a/dmenupowermenu b/dmenupowermenu new file mode 100755 index 0000000..f8521ca --- /dev/null +++ b/dmenupowermenu @@ -0,0 +1,6 @@ +#!/bin/sh + +case "$(printf "shutdown\\nreboot" | dmenu -l 2 -p "Choose your poison")" in + "shutdown") poweroff ;; + "reboot") reboot ;; +esac diff --git a/dmenuryzenadj b/dmenuryzenadj new file mode 100755 index 0000000..06301f5 --- /dev/null +++ b/dmenuryzenadj @@ -0,0 +1,9 @@ +#!/bin/sh + +case "$(printf "normal mode\\nfluff mode\\nlight gaming\\nheavy gaming\\nsuper heavy programs" | dmenu -p "Choose Ryzen 5 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 ;; +esac diff --git a/dmenuscreenshot b/dmenuscreenshot new file mode 100755 index 0000000..017db73 --- /dev/null +++ b/dmenuscreenshot @@ -0,0 +1,14 @@ +#!/bin/sh + +# It lets you +# choose the kind of screenshot to take, including copying the image or even +# highlighting an area to copy. scrotcucks on suicidewatch right now. + +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 $HOME/Pictures/screenshots/pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;; + "current window") sleep 0.5; maim -i "$(xdotool getactivewindow)" $HOME/Pictures/screenshots/pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;; + "full screen") sleep 0.5; maim $HOME/Pictures/screenshots/pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;; + "a selected area (copy)") sleep 0.5; maim -s | xclip -selection clipboard -t image/png ;; + "current window (copy)") sleep 0.5; maim -i "$(xdotool getactivewindow)" | xclip -selection clipboard -t image/png ;; + "full screen (copy)") sleep 0.5; maim | xclip -selection clipboard -t image/png ;; +esac