diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-06-03 19:56:39 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-06-03 19:56:39 +0800 |
| commit | ca968c4e5040f1ff4b5b5e12d9312360d807dcc1 (patch) | |
| tree | 9900920e8f566794560c1519678e344351d2803b /dot-config/rofi/scripts | |
| parent | 5f3deaff0bf006a1a353e57b82ad48c0e8f143bc (diff) | |
added submodules, change . -> dot (see man stow --dotfiles)
Diffstat (limited to 'dot-config/rofi/scripts')
| -rwxr-xr-x | dot-config/rofi/scripts/emoji | 5 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/powermenu.sh | 98 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_askpass | 12 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_asroot | 76 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_clip | 8 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_configs | 129 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_emoji | 10 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_filebrowser | 11 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_launcher | 10 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_music | 116 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_powermenu | 244 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_runner | 11 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_screenshot | 139 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_shutdown | 51 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_shutdown_menu | 52 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_themes | 44 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_wallpaper | 21 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/rofi_windows | 10 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/screenshot-wl.sh | 31 | ||||
| -rwxr-xr-x | dot-config/rofi/scripts/screenshot.sh | 31 |
20 files changed, 1109 insertions, 0 deletions
diff --git a/dot-config/rofi/scripts/emoji b/dot-config/rofi/scripts/emoji new file mode 100755 index 00000000..dcc641ee --- /dev/null +++ b/dot-config/rofi/scripts/emoji @@ -0,0 +1,5 @@ +#!/bin/bash + +DIR="$HOME/.config" + +rofi -show emoji -modi emoji -theme $DIR/rofi/Themes/emojis.rasi diff --git a/dot-config/rofi/scripts/powermenu.sh b/dot-config/rofi/scripts/powermenu.sh new file mode 100755 index 00000000..ac311732 --- /dev/null +++ b/dot-config/rofi/scripts/powermenu.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +## Author : Aditya Shakya +## Mail : adi1090x@gmail.com +## Github : @adi1090x +## Twitter : @adi1090x + +dir="$HOME/.config/rofi/styles" +rofi_command="rofi -theme $dir/five.rasi" + +uptime=$(uptime -p | sed -e 's/up //g') + +# Options +shutdown="" +reboot="" +lock="" +suspend="" +logout="" + +# Confirmation +confirm_exit() { + rofi -dmenu\ + -i\ + -no-fixed-num-lines\ + -p "Are You Sure? : "\ + -theme $dir/confirm.rasi +} + +# Message +msg() { + rofi -theme "$dir/message.rasi" -e "Available Options - yes / y / no / n" +} + +# Variable passed to rofi +options="$shutdown\n$reboot\n$lock\n$suspend\n$logout" + +chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 2)" +case $chosen in + $shutdown) + ans=$(confirm_exit &) + if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then + loginctl poweroff + elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then + exit 0 + else + msg + fi + ;; + $reboot) + ans=$(confirm_exit &) + if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then + loginctl reboot + elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then + exit 0 + else + msg + fi + ;; + $lock) + if [[ -f /usr/bin/i3lock ]]; then + i3lock + elif [[ -f /usr/bin/betterlockscreen ]]; then + betterlockscreen -l + fi + ;; + $suspend) + ans=$(confirm_exit &) + if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then + loginctl suspend + elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then + exit 0 + else + msg + fi + ;; + $logout) + ans=$(confirm_exit &) + if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then + if [[ "$DESKTOP_SESSION" == "/usr/share/xsessions/voidwm" ]]; then + pkill dwm + elif [[ "$DESKTOP_SESSION" == "bspwm" ]]; then + bspc quit + elif [[ "$DESKTOP_SESSION" == "/usr/share/xsessions/i3" ]]; then + i3-msg exit + elif [[ "$DESKTOP_SESSION" == "/usr/local/bin/dwm" ]]; then + pkill dwm + elif [[ "$DESKTOP_SESSION" == "awesome" ]]; then + pkill awesome + else + pkill Hyprland + fi + elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then + exit 0 + else + msg + fi + ;; +esac diff --git a/dot-config/rofi/scripts/rofi_askpass b/dot-config/rofi/scripts/rofi_askpass new file mode 100755 index 00000000..69c9d115 --- /dev/null +++ b/dot-config/rofi/scripts/rofi_askpass @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +RASI="$DIR/askpass.rasi" + +# Rofi text dialog to get password +rofi -dmenu \ + -password \ + -i \ + -p "Root" \ + -theme ${RASI} diff --git a/dot-config/rofi/scripts/rofi_asroot b/dot-config/rofi/scripts/rofi_asroot new file mode 100755 index 00000000..1fe2a5b0 --- /dev/null +++ b/dot-config/rofi/scripts/rofi_asroot @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +RASI="$DIR/asroot.rasi" + +# Theme Elements +prompt='Root' +mesg="Run Applications As Root" +term='alacritty --class alacritty-float,alacritty-float --config-file /root/.config/bspwm/alacritty/alacritty.yml' + +# Options +layout=`cat ${RASI} | grep 'USE_ICON' | cut -d'=' -f2` +if [[ "$layout" == 'NO' ]]; then + option_1=" Alacritty" + option_2=" Thunar" + option_3=" Geany" + option_4=" Ranger" + option_5=" Vim" +else + option_1="" + option_2="" + option_3="" + option_4="" + option_5="" +fi + +# Rofi CMD +rofi_cmd() { + rofi -dmenu \ + -p "$prompt" \ + -mesg "$mesg" \ + -markup-rows \ + -theme ${RASI} +} + +# Pass variables to rofi dmenu +run_rofi() { + echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5" | rofi_cmd +} + +# Execute Command +run_cmd() { + if [[ "$1" == '--opt1' ]]; then + bspasroot "$term" + elif [[ "$1" == '--opt2' ]]; then + bspasroot 'dbus-run-session thunar' + elif [[ "$1" == '--opt3' ]]; then + bspasroot geany + #bspasroot code + elif [[ "$1" == '--opt4' ]]; then + bspasroot "$term -e ranger" + elif [[ "$1" == '--opt5' ]]; then + bspasroot "$term -e lvim" + fi +} + +# Actions +chosen="$(run_rofi)" +case ${chosen} in + $option_1) + run_cmd --opt1 + ;; + $option_2) + run_cmd --opt2 + ;; + $option_3) + run_cmd --opt3 + ;; + $option_4) + run_cmd --opt4 + ;; + $option_5) + run_cmd --opt5 + ;; +esac diff --git a/dot-config/rofi/scripts/rofi_clip b/dot-config/rofi/scripts/rofi_clip new file mode 100755 index 00000000..2cfd75e6 --- /dev/null +++ b/dot-config/rofi/scripts/rofi_clip @@ -0,0 +1,8 @@ +#!/usr/bin/bash + +#export CM_LAUNCHER=rofi +#export CM_DIR="$XDG_CONFIG_HOME" +DIR="$HOME/.config/rofi" +RASI="$DIR/clipboard.rasi" +mesg="Clipboard History" +clipmenu -i -fn Terminus:size=15 -nb '#002b36' -nf '#839496' -sb '#073642' -sf '#93a1a1' -theme ${RASI} -mesg $mesg diff --git a/dot-config/rofi/scripts/rofi_configs b/dot-config/rofi/scripts/rofi_configs new file mode 100755 index 00000000..995e8821 --- /dev/null +++ b/dot-config/rofi/scripts/rofi_configs @@ -0,0 +1,129 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +RASI="$DIR/configs.rasi" + +# Theme Elements +mesg="Select configs" + +# Options +option_1="ZSH profile(zshrc)" +option_2="ZSH environment(zshenv)" +option_3="BSPWM autostart(bspwmrc)" +option_4="BSPWM hotkey(sxhkdrc)" +option_5="Polybar config" +option_6="Polybar module" +option_7="Alacritty main config" +option_8="Picom config" +option_9="Directorys" +option_10=".config" +option_11=".local" +option_12="ZSH" +option_13="BSPWM" +option_14="Polybar" +option_15="BPWM-Scripts" +option_16="Scripts" +#option_17="Neovim(lvim)" + +# Rofi CMD +rofi_cmd() { + rofi -dmenu \ + -mesg "$mesg" \ + -case-sensitive \ + -i \ + -markup-rows \ + -theme ${RASI} +} + +# Pass variables to rofi dmenu +run_rofi() { + echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5\n$option_6\n$option_7\n$option_8\n$option_9\n$option_10\n$option_11\n$option_12\n$option_13\n$option_14\n$option_15\n$option_16" | rofi_cmd +} + +# Execute Command +run_cmd() { + if [[ "$1" == '--opt1' ]]; then + alacritty --class 'alacritty-float,alacritty-float' --command lvim $HOME/.zshrc + elif [[ "$1" == '--opt2' ]]; then + alacritty --class 'alacritty-float,alacritty-float' --command lvim $HOME/.zshenv + elif [[ "$1" == '--opt3' ]]; then + alacritty --class 'alacritty-float,alacritty-float' --command lvim $HOME/.config/bspwm/bspwmrc + elif [[ "$1" == '--opt4' ]]; then + alacritty --class 'alacritty-float,alacritty-float' --command lvim $HOME/.config/bspwm/sxhkdrc + elif [[ "$1" == '--opt5' ]]; then + alacritty --class 'alacritty-float,alacritty-float' --command lvim $HOME/.config/polybar/config.ini + elif [[ "$1" == '--opt6' ]]; then + alacritty --class 'alacritty-float,alacritty-float' --command lvim $HOME/.config/polybar/modules.ini + elif [[ "$1" == '--opt7' ]]; then + alacritty --class 'alacritty-float,alacritty-float' --command lvim $HOME/.config/alacritty/alacritty.toml + elif [[ "$1" == '--opt8' ]]; then + alacritty --class 'alacritty-float,alacritty-float' --command lvim $HOME/.config/picom.conf + elif [[ "$1" == '--opt10' ]]; then + rofi -show file-browser-extended -theme $HOME/.config/rofi/filebrowser.rasi -file-browser-dir $HOME/.config + elif [[ "$1" == '--opt11' ]]; then + rofi -show file-browser-extended -theme $HOME/.config/rofi/filebrowser.rasi -file-browser-dir $HOME/.local/share + elif [[ "$1" == '--opt12' ]]; then + rofi -show file-browser-extended -theme $HOME/.config/rofi/filebrowser.rasi -file-browser-dir $HOME/.config/zsh + elif [[ "$1" == '--opt13' ]]; then + rofi -show file-browser-extended -theme $HOME/.config/rofi/filebrowser.rasi -file-browser-dir $HOME/.config/bspwm + elif [[ "$1" == '--opt14' ]]; then + rofi -show file-browser-extended -theme $HOME/.config/rofi/filebrowser.rasi -file-browser-dir $HOME/.config/polybar + elif [[ "$1" == '--opt15' ]]; then + rofi -show file-browser-extended -theme $HOME/.config/rofi/filebrowser.rasi -file-browser-dir $HOME/.config/bspwm/scripts + elif [[ "$1" == '--opt16' ]]; then + rofi -show file-browser-extended -theme $HOME/.config/rofi/filebrowser.rasi -file-browser-dir $HOME/scripts + elif [[ "$1" == '--opt17' ]]; then + rofi -show file-browser-extended -theme $HOME/.config/rofi/filebrowser.rasi -file-browser-dir $HOME/.config/lvim + fi +} + +# Actions +chosen="$(run_rofi)" +case ${chosen} in + $option_1) + run_cmd --opt1 + ;; + $option_2) + run_cmd --opt2 + ;; + $option_3) + run_cmd --opt3 + ;; + $option_4) + run_cmd --opt4 + ;; + $option_5) + run_cmd --opt5 + ;; + $option_6) + run_cmd --opt6 + ;; + $option_7) + run_cmd --opt7 + ;; + $option_8) + run_cmd --opt8 + ;; + $option_10) + run_cmd --opt10 + ;; + $option_11) + run_cmd --opt11 + ;; + $option_12) + run_cmd --opt12 + ;; + $option_13) + run_cmd --opt13 + ;; + $option_14) + run_cmd --opt14 + ;; + $option_15) + run_cmd --opt15 + ;; + $option_16) + run_cmd --opt16 + ;; +esac diff --git a/dot-config/rofi/scripts/rofi_emoji b/dot-config/rofi/scripts/rofi_emoji new file mode 100755 index 00000000..60f03e0c --- /dev/null +++ b/dot-config/rofi/scripts/rofi_emoji @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +RASI="$DIR/emoji.rasi" + +# Run +rofi \ + -show emoji \ + -theme ${RASI} diff --git a/dot-config/rofi/scripts/rofi_filebrowser b/dot-config/rofi/scripts/rofi_filebrowser new file mode 100755 index 00000000..a8faec9e --- /dev/null +++ b/dot-config/rofi/scripts/rofi_filebrowser @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +RASI="$DIR/filebrowser.rasi" + +# Run +rofi \ + -show file-browser-extended \ + -theme ${RASI} \ + "$@" diff --git a/dot-config/rofi/scripts/rofi_launcher b/dot-config/rofi/scripts/rofi_launcher new file mode 100755 index 00000000..399c9419 --- /dev/null +++ b/dot-config/rofi/scripts/rofi_launcher @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +RASI="$DIR/launcher.rasi" + +# Run +rofi \ + -show drun \ + -theme ${RASI} diff --git a/dot-config/rofi/scripts/rofi_music b/dot-config/rofi/scripts/rofi_music new file mode 100755 index 00000000..9f71440b --- /dev/null +++ b/dot-config/rofi/scripts/rofi_music @@ -0,0 +1,116 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +RASI="$DIR/music.rasi" + +# Theme Elements +status="`mpc status`" +if [[ -z "$status" ]]; then + prompt='Offline' + mesg="MPD is Offline" +else + prompt="`mpc -f "%artist%" current`" + mesg="`mpc -f "%title%" current` :: `mpc status | grep "#" | awk '{print $3}'`" +fi + +# Options +layout=`cat ${RASI} | grep 'USE_ICON' | cut -d'=' -f2` +if [[ "$layout" == 'NO' ]]; then + if [[ ${status} == *"[playing]"* ]]; then + option_1=" Pause" + else + option_1=" Play" + fi + option_2=" Stop" + option_3=" Previous" + option_4=" Next" + option_5=" Repeat" + option_6=" Random" +else + if [[ ${status} == *"[playing]"* ]]; then + option_1="" + else + option_1="" + fi + option_2="" + option_3="" + option_4="" + option_5="" + option_6="" +fi + +# Toggle Actions +active='' +urgent='' +# Repeat +if [[ ${status} == *"repeat: on"* ]]; then + active="-a 4" +elif [[ ${status} == *"repeat: off"* ]]; then + urgent="-u 4" +else + option_5=" Parsing Error" +fi +# Random +if [[ ${status} == *"random: on"* ]]; then + [ -n "$active" ] && active+=",5" || active="-a 5" +elif [[ ${status} == *"random: off"* ]]; then + [ -n "$urgent" ] && urgent+=",5" || urgent="-u 5" +else + option_6=" Parsing Error" +fi + +# Rofi CMD +rofi_cmd() { + rofi -dmenu \ + -p "$prompt" \ + -mesg "$mesg" \ + ${active} ${urgent} \ + -markup-rows \ + -theme ${RASI} +} + +# Pass variables to rofi dmenu +run_rofi() { + echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5\n$option_6" | rofi_cmd +} + +# Execute Command +run_cmd() { + if [[ "$1" == '--opt1' ]]; then + mpc -q toggle && kunst --size 60x60 --silent + elif [[ "$1" == '--opt2' ]]; then + mpc -q stop + elif [[ "$1" == '--opt3' ]]; then + mpc -q prev && kunst --size 60x60 --silent + elif [[ "$1" == '--opt4' ]]; then + mpc -q next && kunst --size 60x60 --silent + elif [[ "$1" == '--opt5' ]]; then + mpc -q repeat + elif [[ "$1" == '--opt6' ]]; then + mpc -q random + fi +} + +# Actions +chosen="$(run_rofi)" +case ${chosen} in + $option_1) + run_cmd --opt1 + ;; + $option_2) + run_cmd --opt2 + ;; + $option_3) + run_cmd --opt3 + ;; + $option_4) + run_cmd --opt4 + ;; + $option_5) + run_cmd --opt5 + ;; + $option_6) + run_cmd --opt6 + ;; +esac diff --git a/dot-config/rofi/scripts/rofi_powermenu b/dot-config/rofi/scripts/rofi_powermenu new file mode 100755 index 00000000..3fa27e93 --- /dev/null +++ b/dot-config/rofi/scripts/rofi_powermenu @@ -0,0 +1,244 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +RASI="$DIR/powermenu.rasi" +CNFR="$DIR/confirm.rasi" + +# Theme Elements +prompt="`hostname` (`echo $DESKTOP_SESSION`)" +mesg="Uptime : `uptime -p | sed -e 's/up //g'`" + +# Options +layout=`cat ${RASI} | grep 'USE_ICON' | cut -d'=' -f2` +if [[ "$layout" == 'NO' ]]; then + option_1=" Lock" + option_2=" Logout" + option_3=" Suspend" + option_4=" Hibernate" + option_5="🔳Hybrid-sleep" + option_6=" Reboot" + option_7=" Shutdown" +else + option_1="" + option_2="" + option_3="" + option_4="" + option_5="🔳" + option_6="" + option_7="" +fi +cnflayout=`cat ${CNFR} | grep 'USE_ICON' | cut -d'=' -f2` +if [[ "$cnflayout" == 'NO' ]]; then + yes=' Yes' + no=' No' +else + yes='' + no='' +fi + +# Rofi CMD +rofi_cmd() { + rofi -dmenu \ + -p "$prompt" \ + -mesg "$mesg" \ + -markup-rows \ + -theme ${RASI} +} + +# Pass variables to rofi dmenu +run_rofi() { + echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5\n$option_6\n$option_7" | rofi_cmd +} + +# Confirmation CMD +confirm_cmd() { + rofi -dmenu \ + -p 'Confirmation' \ + -mesg 'Are you Sure?' \ + -theme ${CNFR} +} + +confirm_cmd2() { + rofi -dmenu \ + -p 'Confirmation' \ + -mesg "Logout?" \ + -theme ${CNFR} +} + +confirm_cmd3() { + rofi -dmenu \ + -p 'Confirmation' \ + -mesg "Sleep/Suspend?" \ + -theme ${CNFR} +} + +confirm_cmd4() { + rofi -dmenu \ + -p 'Confirmation' \ + -mesg "Hibernate?" \ + -theme ${CNFR} +} + +confirm_cmd5() { + rofi -dmenu \ + -p 'Confirmation' \ + -mesg "Hybrid Sleep?" \ + -theme ${CNFR} +} + +confirm_cmd6() { + rofi -dmenu \ + -p 'Confirmation' \ + -mesg "Reboot?" \ + -theme ${CNFR} +} + +confirm_cmd7() { + rofi -dmenu \ + -p 'Confirmation' \ + -mesg "Shutdown?" \ + -theme ${CNFR} +} + + +# Ask for confirmation +confirm_exit() { + echo -e "$yes\n$no" | confirm_cmd +} + +confirm_exit2() { + echo -e "$yes\n$no" | confirm_cmd2 +} + +confirm_exit3() { + echo -e "$yes\n$no" | confirm_cmd3 +} + +confirm_exit4() { + echo -e "$yes\n$no" | confirm_cmd4 +} + +confirm_exit5() { + echo -e "$yes\n$no" | confirm_cmd5 +} + +confirm_exit6() { + echo -e "$yes\n$no" | confirm_cmd6 +} + +confirm_exit7() { + echo -e "$yes\n$no" | confirm_cmd7 +} + +# Confirm and execute +confirm_run () { + selected="$(confirm_exit)" + if [[ "$selected" == "$yes" ]]; then + ${1} && ${2} && ${3} + else + exit + fi +} + + +confirm_run2 () { + selected="$(confirm_exit2)" + if [[ "$selected" == "$yes" ]]; then + ${1} && ${2} && ${3} + else + exit + fi +} + +confirm_run3 () { + selected="$(confirm_exit3)" + if [[ "$selected" == "$yes" ]]; then + ${1} && ${2} && ${3} + else + exit + fi +} + +confirm_run4 () { + selected="$(confirm_exit4)" + if [[ "$selected" == "$yes" ]]; then + ${1} && ${2} && ${3} + else + exit + fi +} + +confirm_run5 () { + selected="$(confirm_exit5)" + if [[ "$selected" == "$yes" ]]; then + ${1} && ${2} && ${3} + else + exit + fi +} + +confirm_run6 () { + selected="$(confirm_exit6)" + if [[ "$selected" == "$yes" ]]; then + ${1} && ${2} && ${3} + else + exit + fi +} + + +confirm_run7 () { + selected="$(confirm_exit7)" + if [[ "$selected" == "$yes" ]]; then + ${1} && ${2} && ${3} + else + exit + fi +} + + +# Execute Command +run_cmd() { + if [[ "$1" == '--opt1' ]]; then + betterlockscreen --lock + elif [[ "$1" == '--opt2' ]]; then + confirm_run2 'bspc quit' + elif [[ "$1" == '--opt3' ]]; then + confirm_run3 'mpc -q pause' 'systemctl suspend' #'betterlockscreen --suspend' 'pulsemixer --unmute' # 'pulsemixer --mute' + elif [[ "$1" == '--opt4' ]]; then + confirm_run4 'systemctl hibernate' + elif [[ "$1" == '--opt5' ]]; then + confirm_run5 'systemctl hybrid-sleep' + elif [[ "$1" == '--opt6' ]]; then + confirm_run6 'systemctl reboot' + elif [[ "$1" == '--opt7' ]]; then + confirm_run7 'systemctl poweroff' + fi +} + +# Actions +chosen="$(run_rofi)" +case ${chosen} in + $option_1) + run_cmd --opt1 + ;; + $option_2) + run_cmd --opt2 + ;; + $option_3) + run_cmd --opt3 + ;; + $option_4) + run_cmd --opt4 + ;; + $option_5) + run_cmd --opt5 + ;; + $option_6) + run_cmd --opt6 + ;; + $option_7) + run_cmd --opt7 + ;; +esac diff --git a/dot-config/rofi/scripts/rofi_runner b/dot-config/rofi/scripts/rofi_runner new file mode 100755 index 00000000..0a4c4963 --- /dev/null +++ b/dot-config/rofi/scripts/rofi_runner @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +RASI="$DIR/custom_command.rasi" + +# Rofi text dialog to get password +sh -c "$(rofi -dmenu \ + -i \ + -p 'Command' \ + -theme ${RASI})" diff --git a/dot-config/rofi/scripts/rofi_screenshot b/dot-config/rofi/scripts/rofi_screenshot new file mode 100755 index 00000000..f5a1c3d7 --- /dev/null +++ b/dot-config/rofi/scripts/rofi_screenshot @@ -0,0 +1,139 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +RASI="$DIR/screenshot.rasi" + +# Theme Elements +prompt='Screenshot' +mesg="Directory :: `xdg-user-dir PICTURES`/Screenshots" + +# Options +layout=`cat ${RASI} | grep 'USE_ICON' | cut -d'=' -f2` +if [[ "$layout" == 'NO' ]]; then + option_1=" Capture Desktop" + option_2=" Capture Area" + option_3=" Capture Window" + option_4=" Capture in 5s" + option_5=" Capture in 10s" +else + option_1="" + option_2="" + option_3="" + option_4="" + option_5="" +fi + +# Rofi CMD +rofi_cmd() { + rofi -dmenu \ + -p "$prompt" \ + -mesg "$mesg" \ + -markup-rows \ + -theme ${RASI} +} + +# Pass variables to rofi dmenu +run_rofi() { + echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5" | rofi_cmd +} + +# Screenshot +time=`date +%Y-%m-%d-%H-%M-%S` +geometry=`xrandr | grep 'current' | head -n1 | cut -d',' -f2 | tr -d '[:blank:],current'` +dir="`xdg-user-dir PICTURES`/Screenshots" +file="Screenshot_${time}_${geometry}.png" + +# Directory +if [[ ! -d "$dir" ]]; then + mkdir -p "$dir" +fi + +# notify and view screenshot +notify_view() { + notify_cmd_shot='dunstify -u low -h string:x-dunst-stack-tag:obscreenshot -i /usr/share/archcraft/icons/dunst/picture.png' + ${notify_cmd_shot} "Copied to clipboard." + paplay /usr/share/sounds/freedesktop/stereo/screen-capture.oga &>/dev/null & + viewnior ${dir}/"$file" + if [[ -e "$dir/$file" ]]; then + ${notify_cmd_shot} "Screenshot Saved." + else + ${notify_cmd_shot} "Screenshot Deleted." + fi +} + +# Copy screenshot to clipboard +copy_shot () { + tee "$file" | xclip -selection clipboard -t image/png +} + +# countdown +countdown () { + for sec in `seq $1 -1 1`; do + dunstify -t 1000 -h string:x-dunst-stack-tag:screenshottimer -i /usr/share/archcraft/icons/dunst/timer.png "Taking shot in : $sec" + sleep 1 + done +} + +# take shots +shotnow () { + cd ${dir} && sleep 0.5 && maim -u -f png | copy_shot + notify_view +} + +shot5 () { + countdown '5' + sleep 1 && cd ${dir} && maim -u -f png | copy_shot + notify_view +} + +shot10 () { + countdown '10' + sleep 1 && cd ${dir} && maim -u -f png | copy_shot + notify_view +} + +shotwin () { + cd ${dir} && maim -u -f png -i `xdotool getactivewindow` | copy_shot + notify_view +} + +shotarea () { + cd ${dir} && maim -u -f png -s -b 2 -c 0.35,0.55,0.85,0.25 -l | copy_shot + notify_view +} + +# Execute Command +run_cmd() { + if [[ "$1" == '--opt1' ]]; then + shotnow + elif [[ "$1" == '--opt2' ]]; then + shotarea + elif [[ "$1" == '--opt3' ]]; then + shotwin + elif [[ "$1" == '--opt4' ]]; then + shot5 + elif [[ "$1" == '--opt5' ]]; then + shot10 + fi +} + +# Actions +chosen="$(run_rofi)" +case ${chosen} in + $option_1) + run_cmd --opt1 + ;; + $option_2) + run_cmd --opt2 + ;; + $option_3) + run_cmd --opt3 + ;; + $option_4) + run_cmd --opt4 + ;; + $option_5) + run_cmd --opt5 + ;; +esac diff --git a/dot-config/rofi/scripts/rofi_shutdown b/dot-config/rofi/scripts/rofi_shutdown new file mode 100755 index 00000000..b17f7667 --- /dev/null +++ b/dot-config/rofi/scripts/rofi_shutdown @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +CNFR="$DIR/confirm.rasi" + +# Theme Elements +prompt="`hostname` (`echo $DESKTOP_SESSION`)" +mesg="Uptime : `uptime -p | sed -e 's/up //g'`" + +# Options +no='' + +# Confirmation CMD +confirm_cmd() { + rofi -dmenu \ + -p 'Confirmation' \ + -mesg 'Cancel?' \ + -theme ${CNFR} +} + +run_rofi() { + echo -e "$no" | confirm_cmd +} + +# Confirm and execute +confirm_run () { + selected="$(run_rofi)" + if [[ "$selected" || "$selected" == "" ]]; then + exit + else + echo "Error had occured" + exit 1 + fi +} + +confirm_run & +pid=$! +#pid=$(cat /run/user/$(id -u)/rofi.pid) +notify-send "Powering off system in 10 seconds" +for (( i = 9; i >= 0; --i )); do + if ! ps -p $pid > /dev/null; then + notify-send "Canceled shutdown process." + exit 0 + fi + notify-send "Powering off system in $i" + sleep 1 +done +if ps -p $pid > /dev/null; then + poweroff +fi diff --git a/dot-config/rofi/scripts/rofi_shutdown_menu b/dot-config/rofi/scripts/rofi_shutdown_menu new file mode 100755 index 00000000..a396189b --- /dev/null +++ b/dot-config/rofi/scripts/rofi_shutdown_menu @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +CNFR="$DIR/confirm.rasi" + +# Theme Elements +prompt="`hostname` (`echo $DESKTOP_SESSION`)" +mesg="Uptime : `uptime -p | sed -e 's/up //g'`" + +# Options +yes='' +no='' + +# Confirmation CMD +confirm_cmd() { + rofi -dmenu \ + -p 'Confirmation' \ + -mesg 'Confirmation?' \ + -theme ${CNFR} +} + +run_rofi() { + echo -e "$yes\n$no" | confirm_cmd +} + +# Confirm and execute +confirm_run () { + selected="$(run_rofi)" + if [[ "$selected" == "" || "$selected" == "$no" ]]; then + notify-send "Canceled shutdown process." + exit + elif [[ "$selected" == "$yes" ]]; then + poweroff + fi +} + +confirm_run & +pid=$! +#pid=$(cat /run/user/$(id -u)/rofi.pid) +notify-send "Powering off system in 10 seconds" +for (( i = 10; i > 0; --i )); do + if ! ps -p $pid > /dev/null; then + notify-send "Canceled shutdown process." + exit 0 + fi + notify-send "Powering off system in $i" + sleep 1 +done +if ps -p $pid > /dev/null; then + poweroff +fi diff --git a/dot-config/rofi/scripts/rofi_themes b/dot-config/rofi/scripts/rofi_themes new file mode 100755 index 00000000..854e8860 --- /dev/null +++ b/dot-config/rofi/scripts/rofi_themes @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +RASI="$DIR/themes.rasi" + +# List Available Themes +THEMES=(`cd $DIR/themes && ls -d */ | cut -d '/' -f1`) + +# Theme Elements +prompt="Themes" +mesg="<b>Available Themes</b> : `cd $DIR/themes && ls -d */ | cut -d '/' -f1 | wc -l`" + +# Rofi CMD +rofi_cmd() { + rofi -dmenu \ + -p "$prompt" \ + -mesg "$mesg" \ + -sep '|' \ + -markup-rows \ + -theme ${RASI} +} + +# Pass variables to rofi dmenu +run_rofi() { + echo ${THEMES[@]} | sed 's/ /|/g' | sed 's/$/|/' | rofi_cmd +} + +# Apply Theme +apply_theme() { + selected="`run_rofi`" + current="`cat $DIR/themes/.current`" + + for theme in "${THEMES[@]}"; do + if [[ -z "$selected" ]]; then + break + elif [[ "$selected" == "$theme" ]]; then + "$DIR"/themes/"$theme"/apply.sh + break + fi + done +} + +apply_theme && exit 0 diff --git a/dot-config/rofi/scripts/rofi_wallpaper b/dot-config/rofi/scripts/rofi_wallpaper new file mode 100755 index 00000000..b0be1000 --- /dev/null +++ b/dot-config/rofi/scripts/rofi_wallpaper @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +#CM_LAUNCHER=rofi +DIR="$HOME/.config/rofi" +RASI="$DIR/wallpaper.rasi" +mesg="Please Select a Wallpaper" + +# Define the directory to list files from +directory="$HOME/Pictures/wallpapers" + +# Use `ls` to list the files in the directory +files=$(ls $directory) + +# Use rofi to display the list of files +chosen=$(echo $files | tr " " "\n" | rofi -dmenu -theme ${RASI} -separator-style plain) + +# Check if a file was selected +if [ -n "$chosen" ]; then + # Run a command with the selected file as an argument + feh $chosen +fi diff --git a/dot-config/rofi/scripts/rofi_windows b/dot-config/rofi/scripts/rofi_windows new file mode 100755 index 00000000..90010332 --- /dev/null +++ b/dot-config/rofi/scripts/rofi_windows @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Import Current Theme +DIR="$HOME/.config/rofi" +RASI="$DIR/windows.rasi" + +# Run +rofi \ + -show window \ + -theme ${RASI} diff --git a/dot-config/rofi/scripts/screenshot-wl.sh b/dot-config/rofi/scripts/screenshot-wl.sh new file mode 100755 index 00000000..fcb907e3 --- /dev/null +++ b/dot-config/rofi/scripts/screenshot-wl.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +## Author : Aditya Shakya +## Mail : adi1090x@gmail.com +## Github : @adi1090x +## Twitter : @adi1090x + +dir="$HOME/.config/rofi/styles" +rofi_command="rofi -theme $dir/three.rasi" + +# Options +screen="" +area="" +window="" + +# Variable passed to rofi +options="$screen\n$area\n$window" + +chosen="$(echo -e "$options" | $rofi_command -p '' -dmenu -selected-row 1)" +case $chosen in + $screen) + sleep 0.4; grim -t png - | wl-copy -t image/png + ;; + $area) + grim -g "$(slurp)" -t png - | wl-copy -t image/png + ;; + $window) + sleep 0.4; grim -g "$(hyprctl activewindow | grep at: | cut -d' ' -f2) $(hyprctl activewindow | grep size: | cut -d' ' -f2 | sed 's/,/x/g')" - | wl-copy + ;; +esac + diff --git a/dot-config/rofi/scripts/screenshot.sh b/dot-config/rofi/scripts/screenshot.sh new file mode 100755 index 00000000..0b268295 --- /dev/null +++ b/dot-config/rofi/scripts/screenshot.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +## Author : Aditya Shakya +## Mail : adi1090x@gmail.com +## Github : @adi1090x +## Twitter : @adi1090x + +dir="$HOME/.config/rofi/styles" +rofi_command="rofi -theme $dir/three.rasi" + +# Options +screen="" +area="" +window="" + +# Variable passed to rofi +options="$screen\n$area\n$window" + +chosen="$(echo -e "$options" | $rofi_command -p '' -dmenu -selected-row 1)" +case $chosen in + $screen) + scrot -e 'xclip -selection clipboard -target image/png -i $f && rm $f' + ;; + $area) + scrot -s --line mode=edge -e 'xclip -selection clipboard -target image/png -i $f && rm $f' + ;; + $window) + scrot -u -e 'xclip -selection clipboard -target image/png -i $f && rm $f' + ;; +esac + |
