diff options
author | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2022-05-18 01:17:06 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2022-05-18 01:17:06 +0300 |
commit | a36aadab60c09bff3a055b0442971aa5e8a87a27 (patch) | |
tree | 0026c02065a0cf35478386312aeb5cb732192469 /dotfiles/.local | |
parent | 484181c25cba61469254e24bff578cff5189c8a7 (diff) | |
download | swayrice-a36aadab60c09bff3a055b0442971aa5e8a87a27.tar.gz swayrice-a36aadab60c09bff3a055b0442971aa5e8a87a27.zip |
WIP: rofi
* Moved basically all menu scripts to use rofi
* Updated some custom desktop entries
* Updated list of packages. TODO: make a better installer script/package
list.
* Removed some old and extraneous scripts.
* Other minor changes to config.
Diffstat (limited to 'dotfiles/.local')
30 files changed, 133 insertions, 253 deletions
diff --git a/dotfiles/.local/bin/addwgprofile b/dotfiles/.local/bin/addwgprofile deleted file mode 100755 index 1fa5eca..0000000 --- a/dotfiles/.local/bin/addwgprofile +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -nmcli connection import type wireguard file ~/.config/wireguard/wg0.conf diff --git a/dotfiles/.local/bin/barvpnstatus b/dotfiles/.local/bin/barvpnstatus deleted file mode 100755 index cca0201..0000000 --- a/dotfiles/.local/bin/barvpnstatus +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -isup=$(ip a | grep wg0:) - -if [ -n "$isup" ]; then - printf " vpn\n" -else - printf "" -fi - -# For some goddamned weird reason sed crashes with a -# "couldn't flush stdout: broken pipe" error when running from waybar itself -# if I don't call sed from its hard location, so I had to call it using -# /usr/bin/sed -nmcli monitor | grep -E --line-buffered 'wg0: connected|wg0: disconnected' | /usr/bin/sed --unbuffered 's/wg0: connected/ vpn/g;s/wg0: disconnected//g' diff --git a/dotfiles/.local/bin/chcolors b/dotfiles/.local/bin/chcolors index 7732267..e62b047 100755 --- a/dotfiles/.local/bin/chcolors +++ b/dotfiles/.local/bin/chcolors @@ -3,7 +3,7 @@ COLORSCHEME="dark" if [ -f $HOME/.cache/colorscheme ]; then - source $HOME/.cache/colorscheme + . $HOME/.cache/colorscheme fi case $COLORSCHEME in diff --git a/dotfiles/.local/bin/imgres b/dotfiles/.local/bin/imgres index 4eec5f6..ec7a20d 100755 --- a/dotfiles/.local/bin/imgres +++ b/dotfiles/.local/bin/imgres @@ -21,6 +21,16 @@ case "$option" in -quality 80 \ "$output" ;; + photo) + convert "$input" \ + -strip \ + -interlace plane \ + -define jpeg:dct-method=float \ + -sampling-factor 4:2:0 \ + -resize 1600x900 \ + -quality 80 \ + "$output" + ;; wallpaper) convert "$input" -resize 2560x1440^ -quality 90 "$output" ;; diff --git a/dotfiles/.local/bin/menublk b/dotfiles/.local/bin/menublk index 7af7a7f..499fe5d 100755 --- a/dotfiles/.local/bin/menublk +++ b/dotfiles/.local/bin/menublk @@ -8,8 +8,6 @@ # Yaroslav de la Peña Smirnov -. ~/.config/bemenurc - readarray -t blkdevs <<< "$(lsblk -r -o NAME,TYPE,FSTYPE,MOUNTPOINT | tail -n +2)" notify_and_end() { @@ -59,7 +57,7 @@ mount_dev() { fstype="$(lsblk -r -o FSTYPE "/dev/$1" | tail -n 1)" part="/dev/$1" if [ "$fstype" = "crypto_LUKS" ]; then - password="$(echo "" | bemenu -p "Enter passphrase for encrypted drive:" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --ff="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" + password="$(echo "" | rofi -dmenu -p "Enter passphrase for encrypted drive" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --ff="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" if [ -z "$password" ]; then exit 0 fi @@ -113,23 +111,23 @@ poweroff_dev() { fi } -action="$(printf "mount\nunmount\npoweroff\n" | bemenu -p "What to do?" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" +action="$(printf "mount\nunmount\npoweroff\n" | rofi -dmenu -p "What to do?" )" case "$action" in mount) - blkdev="$(get_mountable | bemenu -p "Choose device to mount:" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" + blkdev="$(get_mountable | rofi -dmenu -p "Choose device to mount" )" if [ -z "$blkdev" ]; then exit 0 fi mount_dev "$blkdev";; unmount) - blkdev="$(get_unmountable | bemenu -p "Choose device to umount:" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" + blkdev="$(get_unmountable | rofi -dmenu -p "Choose device to umount" )" if [ -z "$blkdev" ]; then exit 0 fi unmount_dev "$blkdev";; poweroff) - blkdev="$(get_usb_storage | bemenu -p "Choose device to power off:" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" + blkdev="$(get_usb_storage | rofi -dmenu -p "Choose device to power off" )" if [ -z "$blkdev" ]; then exit 0 fi diff --git a/dotfiles/.local/bin/menudisplay b/dotfiles/.local/bin/menudisplay deleted file mode 100755 index e42ec42..0000000 --- a/dotfiles/.local/bin/menudisplay +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# Source settings from .bemenurc -. ~/.config/bemenurc - -display=$(swaymsg -t get_outputs | grep -E "name" | sed "s/^.*\"name\": \"//g;s/\",$//g;" | bemenu -p "Select output: " --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") - -if [ -z $display ]; then - exit 0 -fi - -action=$(printf "enable\ndisable\n" | bemenu -p "Choose action: " --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") - -swaymsg output $display $action diff --git a/dotfiles/.local/bin/menuemoji b/dotfiles/.local/bin/menuemoji deleted file mode 100755 index 094a5a9..0000000 --- a/dotfiles/.local/bin/menuemoji +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# Give dmenu list of all unicode characters to copy. -# Shows the selected character in dunst if running. - -list="$(grep -v "#" ~/.local/share/script-data/emoji)" - -if [ "$1" = "-t" ]; then - chosen=$(printf "$list" | fzf) -else - # Source settings from .bemenurc - . ~/.config/bemenurc - - chosen=$(printf "$list" | bemenu -i -l 25 --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") -fi - -if [ -z "$chosen" ]; then - exit 0 -fi - -c=$(echo "$chosen" | sed "s/ .*//") -echo "$c" | tr -d '\n' | wl-copy -echo "$c" -notify-send "'$c' copied to clipboard." diff --git a/dotfiles/.local/bin/menugrim b/dotfiles/.local/bin/menugrim deleted file mode 100755 index 28e1249..0000000 --- a/dotfiles/.local/bin/menugrim +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -if ! [ -d $SCROT_DIR ]; then - mkdir -p $SCROT_DIR -fi - -# Source settings from .bemenurc -. ~/.config/bemenurc - -notify_saved() { - notify-send "screenshot has been saved in $SCROT_DIR" ; -} - -notify_copied() { - notify-send "screenshot has been copied to clipboard" ; -} - -case "$1" in - --quick|-q) - grim $SCROT_DIR/fullscreen-"$(date '+%y%m%d-%H%M-%S').png"; notify_saved ;; - *) - case "$(printf "a selected area\ncurrent window\nfull screen\na selected area (copy)\ncurrent window (copy)\nfull screen (copy)\n" | bemenu -l 6 -i -p "Screenshot which area?" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" in - "a selected area") grim -g "$(slurp)" $SCROT_DIR/selected-"$(date '+%y%m%d-%H%M-%S').png"; notify_saved ;; - "current window") grim -g "$(swaygetcurrentwindow)" $SCROT_DIR/window-"$(date '+%y%m%d-%H%M-%S').png"; notify_saved ;; - "full screen") grim $SCROT_DIR/fullscreen-"$(date '+%y%m%d-%H%M-%S').png"; notify_saved ;; - "a selected area (copy)") grim -g "$(slurp)" - | wl-copy; notify_copied ;; - "current window (copy)") grim -g "$(swaygetcurrentwindow)" - | wl-copy; notify_copied ;; - "full screen (copy)") grim - | wl-copy; notify_copied ;; - *) exit 0 ;; - esac -esac - - diff --git a/dotfiles/.local/bin/menumako b/dotfiles/.local/bin/menumako index 87cb473..628a93a 100755 --- a/dotfiles/.local/bin/menumako +++ b/dotfiles/.local/bin/menumako @@ -1,6 +1,3 @@ #!/bin/sh -# Source settings from .bemenurc -. ~/.config/bemenurc - -makoctl menu bemenu -p "What to do?" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR" +makoctl menu rofi -dmenu -p "What to do?" diff --git a/dotfiles/.local/bin/menuman b/dotfiles/.local/bin/menuman index 98efc02..6c41415 100755 --- a/dotfiles/.local/bin/menuman +++ b/dotfiles/.local/bin/menuman @@ -1,18 +1,15 @@ #!/bin/sh # Search and open man page # Options: -# -t use in terminal with fzf otherwise launch bemenu. +# -t use in terminal with fzf otherwise launch gui menu # -s search with apropos. -# Source settings from .bemenurc -. ~/.config/bemenurc - issearch= isterminal= printusage() { echo "Options:" >&2 - echo " -t use in terminal with fzf otherwise launch bemenu." >&2 + echo " -t use in terminal with fzf otherwise gui menu." >&2 echo " -s search with apropos." >&2 } @@ -35,7 +32,7 @@ if [ ! -z "$issearch" ]; then printf "Enter query:\t" read query else - query="$(echo "" | bemenu -p "Enter apropos query:" -i --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" + query="$(echo "" | rofi -dmenu -p "Enter apropos query" -i)" fi if [ -z "$query" ]; then echo "Empty query" >&2 @@ -49,7 +46,7 @@ fi if [ ! -z "$isterminal" ]; then chosen=$(printf "$list" | fzf) else - chosen=$(printf "$list" | bemenu -p "Select man page:" -i -l 25 --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") + chosen=$(printf "$list" | rofi -dmenu -p "Select man page" -i) fi if [ -z "$chosen" ]; then diff --git a/dotfiles/.local/bin/menuoutput b/dotfiles/.local/bin/menuoutput deleted file mode 100755 index b9a4faa..0000000 --- a/dotfiles/.local/bin/menuoutput +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# Change audio output for all streams and set as default using dmenu - -# Source settings from .bemenurc -. ~/.config/bemenurc - -output=$(listsinks | bemenu -p "Select audio output: " --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") - -[ "$output" != "" ] || exit - -changeoutput $output - -notify-send "🔉 Audio output switched" "Audio output switched to '$output'" diff --git a/dotfiles/.local/bin/menupass b/dotfiles/.local/bin/menupass index 9633b56..844ef33 100755 --- a/dotfiles/.local/bin/menupass +++ b/dotfiles/.local/bin/menupass @@ -3,9 +3,6 @@ # Inspiration taken from # https://git.zx2c4.com/password-store/tree/contrib/dmenu/passmenu -# Source settings from .bemenurc -. ~/.config/bemenurc - shopt -s nullglob globstar notititle="🔑 Password store" @@ -33,7 +30,7 @@ notify_nocache() { } show_menu() { - password=$(printf '%s\n' "${password_files[@]}" | bemenu -p "$1:" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") + password=$(printf '%s\n' "${password_files[@]}" | rofi -dmenu -p "$1") [ -n "$password" ] || exit } diff --git a/dotfiles/.local/bin/menuprompt b/dotfiles/.local/bin/menuprompt deleted file mode 100755 index 32823ec..0000000 --- a/dotfiles/.local/bin/menuprompt +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# A dmenu binary prompt script. -# Gives a dmenu prompt labeled with $1 to perform command $2. -# For example: -# `./prompt "Do you want to shutdown?" "shutdown -h now"` - -[ "$(printf "No\\nYes" | bemenu -i -p "$1" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" = "Yes" ] && $2 diff --git a/dotfiles/.local/bin/menurun b/dotfiles/.local/bin/menurun deleted file mode 100755 index 772cd6f..0000000 --- a/dotfiles/.local/bin/menurun +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# Source settings from .bemenurc -. ~/.config/bemenurc - -title="Run:" -action="" - -case $1 in - -x) - action="xway" - title="Run through xwayland:";; - -t) - action="$TERMINAL" - title="Run in terminal:";; -esac - -program="$(compgen -c | sort -u | bemenu -p "$title" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" - -[ -n "$action" ] && $action "$program" && exit 0 -$program diff --git a/dotfiles/.local/bin/menusession b/dotfiles/.local/bin/menusession deleted file mode 100755 index de4d602..0000000 --- a/dotfiles/.local/bin/menusession +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# Source settings from .bemenurc -. ~/.config/bemenurc - -action=$(printf "logout\nsuspend\nreboot\npoweroff\n" | bemenu -p "What to do?" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") - -swaysession $action diff --git a/dotfiles/.local/bin/menutz b/dotfiles/.local/bin/menutz deleted file mode 100755 index 2d783ae..0000000 --- a/dotfiles/.local/bin/menutz +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# Source settings from .bemenurc -. ~/.config/bemenurc - -timezone=$(cd /usr/share/zoneinfo/posix && find * -type f -or -type l | sort | bemenu -p "Select output: " --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") - -if [ -n "$timezone" ]; then - notify-send "🗺 Date and time in $timezone" "$(TZ=:$timezone date)" -else - notify-send "🗺 Date and time in your timezone" "$(TZ=:$timezone date)" -fi diff --git a/dotfiles/.local/bin/menuwebsurf b/dotfiles/.local/bin/menuwebsurf deleted file mode 100755 index 8d63fc8..0000000 --- a/dotfiles/.local/bin/menuwebsurf +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -# menu prompt to open a link with mimeo - -# Source settings from .bemenurc -. ~/.config/bemenurc - -searchurl="https://srx.yaroslavps.com/search?q=" - -# Have to use this "hack" because bemenu doesn't know how to paste -if [ "$1" = "paste" ]; then - prompt="$(wl-paste)" -else - qmarks="$HOME/.config/qutebrowser/quickmarks" - bmarks="$HOME/.config/qutebrowser/bookmarks/urls" - hist="$HOME/.local/share/qutebrowser/history.sqlite" - prompt="$(sqlite3 -separator ' ' "$hist" \ - 'select title, url from CompletionHistory' | - cat "$qmarks" - | cat "$bmarks" -)" -fi - -choice=$(printf "%s" "$prompt" | - bemenu -i -l 25 -p "Enter link or query:" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") || exit 1 - -if echo "$choice" | egrep ".*://.*" >/dev/null 2>&1; then - choice="$(echo "$choice" | sed -E 's/[^ ]+ +//g' | - grep -E "https?:" || echo "$choice")" - mimeo "$choice" -else - $BROWSER "$choice" -fi - diff --git a/dotfiles/.local/bin/menuworkspace b/dotfiles/.local/bin/menuworkspace deleted file mode 100755 index 7d947d0..0000000 --- a/dotfiles/.local/bin/menuworkspace +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# Open a "workspace" (see workspace) from a list of dirs under home - -# Source settings from .bemenurc -. ~/.config/bemenurc - -# All dirs under home, except ones under hidden dirs -dirs="$(find $HOME -type d -path "*/\.*" -prune -o -not -name ".*" -type d)" - -workspace "$(echo "$dirs" | - bemenu -i -l 25 -p "Enter link or query:" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" diff --git a/dotfiles/.local/bin/rofiaudio b/dotfiles/.local/bin/rofiaudio new file mode 100755 index 0000000..6912bed --- /dev/null +++ b/dotfiles/.local/bin/rofiaudio @@ -0,0 +1,16 @@ +#!/bin/bash + +if [ "$ROFI_RETV" != 0 ]; then + changeoutput $1 + notify-send "🔉 Audio output" "Audio output switched to '$1'" + exit 0 +fi + +displays="$(swaymsg -t get_outputs | grep -E "name" | + sed "s/^.*\"name\": \"//g;s/\",$//g;")" + +echo -ne "\0no-custom\x1ftrue\n" +echo -ne "\0prompt\x1fSelect audio output\n" +for s in $(listsinks); do + echo -ne "$s\0icon\x1faudio-speakers\n" +done diff --git a/dotfiles/.local/bin/rofidisplay b/dotfiles/.local/bin/rofidisplay index 26f0f1a..9d1e5ec 100755 --- a/dotfiles/.local/bin/rofidisplay +++ b/dotfiles/.local/bin/rofidisplay @@ -7,6 +7,7 @@ fi displays="$(swaymsg -t get_outputs | grep -E "name" | sed "s/^.*\"name\": \"//g;s/\",$//g;")" +echo -ne "\0no-custom\x1ftrue\n" echo -ne "\0prompt\x1fToggle display\n" for d in $displays; do echo -ne "$d\0icon\x1fdisplay\n" diff --git a/dotfiles/.local/bin/rofigrim b/dotfiles/.local/bin/rofigrim new file mode 100755 index 0000000..47aff4d --- /dev/null +++ b/dotfiles/.local/bin/rofigrim @@ -0,0 +1,18 @@ +#!/bin/bash + +if [ "$ROFI_RETV" = 1 ]; then + coproc screensht "$1" + exit 0 +elif [ "$ROFI_RETV" = 20 ]; then + coproc screensht "$1" copy + exit 0 +fi + + +echo -ne "\0no-custom\x1ftrue\n" +echo -ne "\0prompt\x1fWhat to screenshot?\n" +echo -ne "\0message\x1fMake a selection (Alt+Enter to copy to clipboard)\n" +echo -ne "\0use-hot-keys\x1ftrue\n" +echo -ne "select area\0icon\x1fedit-cut\n" +echo -ne "current window\0icon\x1fdesktop\n" +echo -ne "full screen\0icon\x1fdisplay\n" diff --git a/dotfiles/.local/bin/rofisession b/dotfiles/.local/bin/rofisession index 88cf3c6..8ee7b2e 100755 --- a/dotfiles/.local/bin/rofisession +++ b/dotfiles/.local/bin/rofisession @@ -7,9 +7,8 @@ if [ -n "$1" ]; then exit 0 fi -echo -ne "\0no-custom\x1ftrue\n" echo -ne "\0prompt\x1fWhat to do?\n" echo -ne "logout\0icon\x1fsystem-log-out\n" echo -ne "suspend\0icon\x1fsystem-suspend\n" -echo -ne "reboot\0icon\x1fsystem-restart\n" +echo -ne "reboot\0icon\x1fsystem-reboot\n" echo -ne "poweroff\0icon\x1fsystem-shutdown\n" diff --git a/dotfiles/.local/bin/rofitz b/dotfiles/.local/bin/rofitz new file mode 100755 index 0000000..d7f5ad7 --- /dev/null +++ b/dotfiles/.local/bin/rofitz @@ -0,0 +1,13 @@ +#!/bin/bash + +tzones="$(cd /usr/share/zoneinfo/posix && find * -type f -or -type l)" + +echo -ne "\0no-custom\x1ftrue\n" +echo -ne "\0prompt\x1fChoose timezone\n" + +if [ "$ROFI_RETV" != 0 ]; then + t="$(TZ=$1 date)" + echo -ne "\0message\x1fDate and time in $1: $t\n" +fi + +printf "%s" "$tzones" diff --git a/dotfiles/.local/bin/screensht b/dotfiles/.local/bin/screensht new file mode 100755 index 0000000..f170d38 --- /dev/null +++ b/dotfiles/.local/bin/screensht @@ -0,0 +1,51 @@ +#!/bin/sh + +notify_saved() { + notify-send -i "$1" "🖼 Screenshot" "Screenshot has been saved in $1" ; +} + +notify_copied() { + notify-send "🖼 Screenshot" "Screenshot has been copied to clipboard" ; +} + +if [ "$2" = "copy" ]; then + case "$1" in + "select area") + grim -g "$(slurp)" - | wl-copy + notify_copied + ;; + "current window") + grim -g "$(swaygetcurrentwindow)" - | wl-copy + notify_copied + ;; + "full screen") + grim - | wl-copy + notify_copied + ;; + *) exit 0;; + esac + exit 0 +else + if ! [ -d $SCROT_DIR ]; then + mkdir -p $SCROT_DIR + fi + case "$1" in + "select area") + scrpath="$SCROT_DIR/selected-$(date '+%y%m%d-%H%M-%S').png" + grim -g "$(slurp)" "$scrpath" + notify_saved "$scrpath" + ;; + "current window") + scrpath="$SCROT_DIR/window-$(date '+%y%m%d-%H%M-%S').png" + grim -g "$(swaygetcurrentwindow)" "$scrpath" + notify_saved "$scrpath" + ;; + "full screen") + scrpath="$SCROT_DIR/fullscreen-$(date '+%y%m%d-%H%M-%S').png" + grim "$scrpath" + notify_saved "$scrpath" + ;; + *) exit 0;; + esac + exit 0 +fi diff --git a/dotfiles/.local/bin/swayrecord b/dotfiles/.local/bin/swayrecord index 91f6d31..b4e2aa6 100755 --- a/dotfiles/.local/bin/swayrecord +++ b/dotfiles/.local/bin/swayrecord @@ -1,7 +1,4 @@ -#!/bin/sh - -# Source settings from .bemenurc -. ~/.config/bemenurc +#!/bin/bash if ! [ -d $VREC_DIR ]; then mkdir -p $VREC_DIR @@ -116,7 +113,7 @@ audio () { } askrecording () { - TYPE="$(printf "video\nscreencast\nscreenshare\naudio\n" | bemenu -l 6 -i -p "What should be recorded?" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB")" + TYPE="$(echo -ne "video\0icon\x1fcamera-video\nscreencast\0icon\x1fcamera-web\nscreenshare\0icon\x1fvideo-display\naudio\0icon\x1faudio-input-microphone\n" | rofi -dmenu -i -p "What should be recorded?")" case "$TYPE" in video) video;; screencast) screencast;; @@ -132,11 +129,13 @@ if [ -f "$HOME/.cache/recordingpid" ]; then fi if [ $(swaymsg -t get_outputs | jq '. | length') -gt 1 ]; then -MONITOR=$(swaymsg -t get_outputs | grep -E "name" | sed "s/^.*\"name\": \"//g;s/\",$//g;" | bemenu -p "Select display for capture: " --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") + MONITOR=$(swaymsg -t get_outputs | grep -E "name" | sed "s/^.*\"name\": \"\(.*\)\",/\1\x00icon\x1fdisplay/g;" | rofi -dmenu -i -p "Select display for capture") else MONITOR="$(swaymsg -t get_outputs | jq -r '.[0]["name"]')" fi +[ -z "$MONITOR" ] && exit 0 + case $1 in video) video;; screencast) screencast;; diff --git a/dotfiles/.local/bin/togglevpn b/dotfiles/.local/bin/togglevpn deleted file mode 100755 index 8baed38..0000000 --- a/dotfiles/.local/bin/togglevpn +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -isup=$(ip a | grep wg0:) - -if [ -z "$isup" ]; then - nmcli connection up wg0 && notify-send " VPN" "Wireguard VPN tunnel established" && exit - notify-send " VPN" "Error while trying to start Wireguard tunnel" - exit 1 -fi -nmcli connection down wg0 && notify-send " VPN" "Wireguard VPN tunnel brought down" && exit -notify-send " VPN" "Error while trying to close Wireguard tunnel" -exit 1 diff --git a/dotfiles/.local/share/applications/aerc.desktop b/dotfiles/.local/share/applications/aerc.desktop deleted file mode 100644 index 84cf639..0000000 --- a/dotfiles/.local/share/applications/aerc.desktop +++ /dev/null @@ -1,6 +0,0 @@ -[Desktop Entry] -Name=aerc -GenericName=Email Client -Exec=aerc %u -Terminal=true -MimeType=x-scheme-handler/mailto diff --git a/dotfiles/.local/share/applications/neomutt.desktop b/dotfiles/.local/share/applications/neomutt.desktop index 167c431..6fc290f 100644 --- a/dotfiles/.local/share/applications/neomutt.desktop +++ b/dotfiles/.local/share/applications/neomutt.desktop @@ -3,4 +3,7 @@ Name=neomutt GenericName=Email Client Exec=neomutt -- %u Terminal=true +Icon=mail-unread +Type=Application +StartupNotify=false MimeType=x-scheme-handler/mailto diff --git a/dotfiles/.local/share/applications/nsxiv.desktop b/dotfiles/.local/share/applications/nsxiv.desktop index adb015a..51e8d41 100644 --- a/dotfiles/.local/share/applications/nsxiv.desktop +++ b/dotfiles/.local/share/applications/nsxiv.desktop @@ -1,8 +1,8 @@ [Desktop Entry] -Type=Application Name=nsxiv GenericName=Image Viewer Exec=nsxiv-rifle %F -MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/png;image/tiff;image/x-bmp;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-tga;image/x-xpixmap;image/webp; -NoDisplay=true +Type=Application Icon=nsxiv +NoDisplay=true +MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/png;image/tiff;image/x-bmp;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-tga;image/x-xpixmap;image/webp; diff --git a/dotfiles/.local/share/applications/sxiv.desktop b/dotfiles/.local/share/applications/sxiv.desktop deleted file mode 100644 index 966e4c0..0000000 --- a/dotfiles/.local/share/applications/sxiv.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Application -Name=sxiv -GenericName=Image Viewer -Exec=sxiv-rifle %F -MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/png;image/tiff;image/x-bmp;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-tga;image/x-xpixmap; -NoDisplay=true -Icon=sxiv |