diff options
Diffstat (limited to 'dotfiles/dwm/.local/bin')
| -rwxr-xr-x | dotfiles/dwm/.local/bin/airplanemodetoggle | 33 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/brightness | 36 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/colorpick | 6 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/dmenuexitmenu | 12 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/dmenuunicode | 18 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/screenshotmenu | 13 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/toggle-touchpad | 16 | ||||
| -rwxr-xr-x | dotfiles/dwm/.local/bin/wallsearch | 43 |
8 files changed, 177 insertions, 0 deletions
diff --git a/dotfiles/dwm/.local/bin/airplanemodetoggle b/dotfiles/dwm/.local/bin/airplanemodetoggle new file mode 100755 index 0000000..038a0d6 --- /dev/null +++ b/dotfiles/dwm/.local/bin/airplanemodetoggle @@ -0,0 +1,33 @@ +#!/bin/bash + +if [ "$(printf "On\\nOff" | dmenu -i -p "Set airplane mode:")" = "On" ] +then + notify-send "Airplane Mode" "Turning on airplane mode...." + sudo systemctl stop bluetooth.service + sudo systemctl stop expressvpn.service + sudo systemctl stop sshd.service + systemctl --user stop syncthing.service + sudo systemctl stop avahi-daemon.service + sudo systemctl stop cronie.service + sudo systemctl stop cups.service + sudo ip link set wlp170s0 down + sudo systemctl stop wpa_supplicant.service + sudo systemctl stop NetworkManager.service + sudo nmcli radio all off + sudo powertop --auto-tune + notify-send "Airplane Mode" "Airplane mode is now on." +else + notify-send "Airplane Mode" "Turning off airplane mode....." + sudo nmcli radio wifi on + sudo systemctl start NetworkManager.service + sudo systemctl start wpa_supplicant.service + sudo ip link set wlp170s0 up + sudo systemctl start bluetooth.service + sudo systemctl start expressvpn.service + sudo systemctl start sshd.service + systemctl --user start syncthing.service + sudo systemctl start avahi-daemon.service + sudo systemctl start cronie.service + sudo systemctl start cups.service + notify-send "Airplane Mode" "Airplane mode is now off." +fi diff --git a/dotfiles/dwm/.local/bin/brightness b/dotfiles/dwm/.local/bin/brightness new file mode 100755 index 0000000..9142f33 --- /dev/null +++ b/dotfiles/dwm/.local/bin/brightness @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Craig Jennings <c@cjennings.net> +# DWM convenience script for changing backlight +# depends on xbacklight + +increment=10 + +case $1 in + "max") + sudo xbacklight -set 100%; + ;; + "min") + sudo xbacklight -set 5%; + ;; + "up") + # get current setting as an int + current=$( printf "%.0f" "$(xbacklight -get)" ) + + # add the increment + newvalue=$(("$current" + "$increment")) + + # don't let the brightness go above 100 + [ "$newvalue" -ge 100 ] && newvalue=100; + + # set the value + xbacklight -set "$newvalue"; + ;; + "down") + current=$( printf "%.0f" "$(xbacklight -get)" ) + newvalue=$(("$current" - "$increment")) + [ "$newvalue" -le 5 ] && newvalue=5; + xbacklight -set "$newvalue"; + ;; +esac +newvalue=$( printf "%.0f" "$(xbacklight -get)") +notify-send "backlight" "backlight now set to $newvalue" diff --git a/dotfiles/dwm/.local/bin/colorpick b/dotfiles/dwm/.local/bin/colorpick new file mode 100755 index 0000000..b5e1aff --- /dev/null +++ b/dotfiles/dwm/.local/bin/colorpick @@ -0,0 +1,6 @@ +#!/bin/sh +# displays colorpicker app +# turns cursor into crosshairs, adds preview at bottom left +# selected color is added to the clipboard + +colorpicker --short --one-shot --preview | xsel -b diff --git a/dotfiles/dwm/.local/bin/dmenuexitmenu b/dotfiles/dwm/.local/bin/dmenuexitmenu new file mode 100755 index 0000000..5570364 --- /dev/null +++ b/dotfiles/dwm/.local/bin/dmenuexitmenu @@ -0,0 +1,12 @@ +#!/bin/sh + +menuitems=("Lock \nSuspend \nLogout \nReboot \nShutdown \nCancel ") +choice=$(echo -e $menuitems | dmenu -nb "#DAA520" -nf "#2E3440" -sb "#2E3440" -sf "#DAA520") + +case "$choice" in + "Logout ") loginctl terminate-user $(whoami) ;; + "Lock ") slock ;; + "Suspend ") systemctl suspend;; + "Shutdown ") systemctl poweroff;; + "Reboot ") systemctl reboot ;; +esac diff --git a/dotfiles/dwm/.local/bin/dmenuunicode b/dotfiles/dwm/.local/bin/dmenuunicode new file mode 100755 index 0000000..b25876f --- /dev/null +++ b/dotfiles/dwm/.local/bin/dmenuunicode @@ -0,0 +1,18 @@ +#!/bin/sh + +# The famous "get a menu of emojis to copy" script. + +# Get user selection via dmenu from emoji file. +chosen=$(cut -d ';' -f1 ~/.local/share/emoji | dmenu -i -l 30 | sed "s/ .*//") + +# Exit if none chosen. +[ -z "$chosen" ] && exit + +# If you run this command with an argument, it will automatically insert the +# character. Otherwise, show a message that the emoji has been copied. +if [ -n "$1" ]; then + xdotool type "$chosen" +else + printf "$chosen" | xclip -selection clipboard + notify-send "'$chosen' copied to clipboard." & +fi diff --git a/dotfiles/dwm/.local/bin/screenshotmenu b/dotfiles/dwm/.local/bin/screenshotmenu new file mode 100755 index 0000000..c899dfc --- /dev/null +++ b/dotfiles/dwm/.local/bin/screenshotmenu @@ -0,0 +1,13 @@ +#!/bin/sh +# Requires maim, xdotool, and dmenu +# Uses dmenu to choose the type of screenshot to take, + +case "$(printf "full screen\\nselected area\\ncurrent window\\nselected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in + "full screen") file="$(date +%Y.%m.%d-%M%S).png" && maim ~/pictures/screenshots/$file && notify-send "Image selection saved to ~/pictures/screenshots/$file" ;; + "full screen (5 sec delay)") file="$(date +%Y.%m.%d-%M%S).png" && sleep 5 && maim ~/pictures/screenshots/$file && notify-send "Image selection saved to ~/pictures/screenshots/$file" ;; + "selected area") file="$(date +%Y.%m.%d-%M%S).png" && maim -s ~/pictures/screenshots/$file && notify-send "Image selection saved to ~/pictures/screenshots/$file" ;; + "current window") maim -i "$(xdotool getactivewindow)" '~/pictures/screenshots/$(date +%Y.%m.%d-%M%S).png' && notify-send "Image selection saved to ~/pictures/screenshots/" ;; + "selected area (copy)") maim -s | xclip -selection clipboard -t image/png && notify-send "Image selection copied to clipboard." ;; + "current window (copy)") maim -i "$(xdotool getactivewindow)" | xclip -selection clipboard -t image/png && notify-send "Image selection copied to clipboard." ;; + "full screen (copy)") maim | xclip -selection clipboard -t image/png && notify-send "Image copied to clipboard." ;; +esac diff --git a/dotfiles/dwm/.local/bin/toggle-touchpad b/dotfiles/dwm/.local/bin/toggle-touchpad new file mode 100755 index 0000000..9dde99b --- /dev/null +++ b/dotfiles/dwm/.local/bin/toggle-touchpad @@ -0,0 +1,16 @@ +#!/bin/sh +# Toggle touchpad status +# Using libinput and xinput + +# Use xinput list and do a search for touchpads. Then get the first one and get its name. +device="$(xinput list | grep -P '(?<= )[\w\s:]*(?i)(touchpad|synaptics)(?-i).*?(?=\s*id)' -o | head -n1)" + +# If it was activated disable it and if it wasn't disable it +if [[ "$(xinput list-props "$device" | grep -P ".*Device Enabled.*\K.(?=$)" -o)" == "1" ]] +then + xinput disable "$device" + notify-send "Touchpad" "Touchpad disabled" +else + xinput enable "$device" + notify-send "Touchpad" "Touchpad enabled" +fi diff --git a/dotfiles/dwm/.local/bin/wallsearch b/dotfiles/dwm/.local/bin/wallsearch new file mode 100755 index 0000000..f71d150 --- /dev/null +++ b/dotfiles/dwm/.local/bin/wallsearch @@ -0,0 +1,43 @@ +#!/bin/bash + +walldir="$HOME/Pictures/wallpaper/incoming" +tmpdir="$HOME/.wallsearch" +maxpage=5 +tagoptions="CANCEL\n#minimalism\n#digital art\n#4K\n#nature\n#abstract\n#landscape\n#cityscape\n#surf\n#technology" +sortoptions="CANCEL\ndate_added\nrelevance\nrandom\nfavorites\ntoplist" + +if [ -d $tmpdir ]; then + rm -rf $tmpdir +fi +mkdir -p $tmpdir + +if [ -z $1 ]; then + query=$(echo -e $tagoptions | dmenu -p "Search Wallhaven: " -i) +else + query=$1 +fi + +[ $query == "CANCEL" ] && notify-send "Cancelled wallpaper search." && exit 0; + +sorting=$(echo -e $sortoptions | dmenu -p "Sort Order: " -i) + +[ $sorting == "CANCEL" ] && notify-send "Cancelled wallpaper search." && exit 0; + +query="$(sed 's/#//g' <<<$query)" +query="$(sed 's/ /+/g' <<<$query)" +echo #query + +notify-send "wallsearch" "Searching wallpapers..." + +for i in $(seq 1 10); +do + curl -s https://wallhaven.cc/api/v1/search\?atleast\=1920x1080\&sorting\=$sorting\&q\=$query\&purity=111\&page\=$i > tmp.txt + page=$(cat tmp.txt | jq '.' | grep -Eoh "https:\/\/w\.wallhaven.cc\/full\/.*(jpg|png)\b") + wget -nc -P $tmpdir $page + notify-send "wallsearch" "Searching wallpapers..." +done + +rm tmp.txt +notify-send "wallsearch" "Done searching wallpaper." +sxiv -to $tmpdir/* | xargs -I % mv % $walldir +#rm -rf $tmpdir |
