Add files via upload

This commit is contained in:
Sankalp Tharu authored and GitHub committed 2023-02-21 14:33:17 +05:45
1 parent 326c2d8820
commit 19741e568a
26 files changed
+1213

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
rofi -config ~/.config/rofi/mount/passwd.rasi -dmenu -i -password -p "Sudo"
+40
View File
@@ -0,0 +1,40 @@
#!/bin/sh
# merged and modified luke smith's mount and unmount script and imported to rofi
# Modified by S4NKALP
# ┌─┐┌─┐┌┐┌┌─┐┬┌─┐┬ ┬┬─┐┌─┐┌┬┐┬┌─┐┌┐┌┌─┐
# │ │ ││││├┤ ││ ┬│ │├┬┘├─┤ │ ││ ││││└─┐
# └─┘└─┘┘└┘└ ┴└─┘└─┘┴└─┴ ┴ ┴ ┴└─┘┘└┘└─┘
# rofi sconfig
roficonfig=~/.config/rofi/mount/prompt.rasi
# Always mount your phone here
mountpoint=$HOME/Cell
[ -d "$mountpoint" ] || mkdir -pv "$mountpoint"
# ┬─┐┌─┐┌─┐┬
# ├┬┘│ │├┤ │
# ┴└─└─┘└ ┴
androiddevices=$(simple-mtpfs -l 2>/dev/null)
[ -z "$androiddevices" ] && printf "exit" | rofi -config $roficonfig -dmenu -i -only-match -p "No Android Device Found" && exit
chk=$(printf "Mount\nUnmount" | rofi -config $roficonfig -dmenu -i -hover-select -p "Android Device: ")
case $chk in
Unmount)
unmountable=$(grep simple-mtpfs /etc/mtab 2>/dev/null)
if [ -z "$unmountable" ]; then
printf "exit" | rofi -config $roficonfig -dmenu -i -only-match -p "Nothing to Unmount" && exit
else
devices="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | rofi -config $roficonfig -dmenu -fuzzy -hover-select -i -p "Choose Device to Unmount")"
fusermount -u $devices && printf "exit" | rofi -config $roficonfig -dmenu -i -only-match -p "Unmounted Successfully"
fi
;;
Mount)
device="$(echo "$androiddevices" | rofi -config $roficonfig -dmenu -i -hover-select -p "Choose Device")"
simple-mtpfs --device "$device" "$mountpoint" && echo "exit" | rofi -config $roficonfig -dmenu -i -only-match -p "Mounted Successfully" && exit
echo "Ok" | rofi -config $roficonfig -dmenu -i -p "Tap Allow on your phone, after that Enter."
simple-mtpfs --device "$device" "$mountpoint" && echo "exit" | rofi -config $roficonfig -dmenu -only-match -i -p "Mounted Successfully" || echo "exit" | rofi -config $roficonfig -only-match -dmenu -i -p "Not mounted"
esac 2>/dev/null
+79
View File
@@ -0,0 +1,79 @@
configuration {
sort: true;
sorting-method: "normal";
disable-history: false;
scroll-method: 0;
window-thumbnail: true;
}
@theme "/dev/null"
* {
bg: #0C0F09;
fg: #05E289;
bgAlt: #1B1E25;
button: #05E289;
background-color: @bg;
text-color: @fg;
}
@import "../Themes/style.rasi"
mainbox { children: [ inputbar, listview ]; }
window {
transparency: "real";
width: 600px;
border: 15px 15px 15px 15px;
border-radius: 12px;
border-color: @bg;
height: 500px;
}
inputbar {
children: [ prompt, entry ];
expand: false;
padding: 10px 10px 10px 10px;
}
prompt {
enabled: true;
padding: 10px;
border-radius: 15px;
}
entry {
background-color: @bgAlt;
placeholder: "Search";
expand: true;
padding: 10px;
border-radius: 15px;
}
listview {
columns: 2;
cycle: true;
dynamic: true;
layout: vertical;
scrollbar: false;
}
element {
orientation: vertical;
margin: 4px 4px 4px 4px;
border-radius: 10px;
background-color: @bgAlt;
}
element-text {
expand: true;
margin: 12px 15px 12px 15px;
background-color: inherit;
text-color: inherit;
}
element selected {
background-color: @fg;
text-color: @bgAlt;
border-radius: 10px;
}
+92
View File
@@ -0,0 +1,92 @@
#!/bin/sh
# merged and modified luke smith's mount and unmount script and imported to rofi
#S4NKALP
# ┌─┐┌─┐┌┐┌┌─┐┬┌─┐┬ ┬┬─┐┌─┐┌┬┐┬┌─┐┌┐┌┌─┐
# │ │ ││││├┤ ││ ┬│ │├┬┘├─┤ │ ││ ││││└─┐
# └─┘└─┘┘└┘└ ┴└─┘└─┘┴└─┴ ┴ ┴ ┴└─┘┘└┘└─┘
# Rofi Configs
roficonfig=~/.config/rofi/mount/dmenu.rasi
rofiprompt=~/.config/rofi/mount/prompt.rasi
# Always mount every thing here or in it's subdirectories
mountdir=/mnt
# uncomment this line if you already have askpass setuped.
[ -z "$SUDO_ASKPASS" ] && export SUDO_ASKPASS=~/.config/rofi/mount/askpass
# ┌┬┐┌─┐┬ ┬┌┐┌┌┬┐ ┌─┐┌─┐┬─┐┬┌─┐┌┬┐
# ││││ ││ ││││ │ └─┐│ ├┬┘│├─┘ │
# ┴ ┴└─┘└─┘┘└┘ ┴ └─┘└─┘┴└─┴┴ ┴
mountable="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')"
getmount() {
[ -z "$chosen" ] && exit 1
mp="$(find $1 2>/dev/null | rofi -config $roficonfig -dmenu -i -fuzzy -hover-select -p "Type in mount point. or
Type folder name to create")" || exit 1
test -z "$mp" && exit 1
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "Yes\\nNo" | rofi -config $rofiprompt -dmenu -fuzzy -i -hover-select -p "$mp does not exist. Create it? (in $mountdir)") || exit 1
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mountdir/$mp" || sudo -A mkdir -p "$mountdir/$mp") && mp=$mountdir/$mp
fi
}
mountusb() { \
chosen="$(echo "$mountable" | rofi -config $rofiprompt -dmenu -i -fuzzy -hover-select -p "Mount which drive?")" || exit 1
chosen="$(echo "$chosen" | awk '{print $1}')"
sudo -A mount "$chosen" 2>/dev/null && printf "exit" | rofi -config $rofiprompt -dmenu -i -only-match -p "Mounted $chosen to $mp" && exit 0
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}')
getmount "$mountdir -type d $alreadymounted"
partitiontype="$(lsblk -no "fstype" "$chosen")"
case "$partitiontype" in
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000 && printf "exit" | rofi -config $rofiprompt -dmenu -i -only-match -p "Mounted $chosen to $mp" && exit 0
;;
"exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" && printf "exit" | rofi -config $rofiprompt -dmenu -i -only-match -p "Mounted $chosen to $mp" && exit 0
;;
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp" && printf "exit" | rofi -config $rofiprompt -dmenu -i -only-match -p "Mounted $chosen to $mp" && exit 0
;;
esac
printf "exit" | rofi -config $rofiprompt -dmenu -i -only-match -p "Failed to Mount $chosen to $mp" && exit 0
}
# ┬ ┬┌┐┌┌┬┐┌─┐┬ ┬┌┐┌┌┬┐ ┌─┐┌─┐┬─┐┬┌─┐┌┬┐
# │ ││││││││ ││ ││││ │ └─┐│ ├┬┘│├─┘ │
# └─┘┘└┘┴ ┴└─┘└─┘┘└┘ ┴ └─┘└─┘┴└─┴┴ ┴
unmountable=$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}')
unmountusb() {
[ -z "$unmountable" ] && exit
chosen="$(echo "$unmountable" | rofi -config $rofiprompt -dmenu -fuzzy -hover-select -i -p "Unmount which drive?")" || exit 1
chosen="$(echo "$chosen" | awk '{print $1}')"
[ -z "$chosen" ] && exit
sudo -A umount "$chosen" && printf "exit" | rofi -config $rofiprompt -dmenu -i -only-match -p "Unmounted $chosen" && exit
}
# ┬─┐┌─┐┌─┐┬
# ├┬┘│ │├┤ │
# ┴└─└─┘└ ┴
chk=$(printf "Mount\nUnmount" | rofi -config $rofiprompt -dmenu -i -hover-select -p "USB/Drives" )
case $chk in
Unmount)
if [ -z "$unmountable" ]; then
echo "No USB drives to unmount." && exit
else
unmountusb
fi
;;
Mount)
if [ -z "$mountable" ]; then
notify-send "No USB drives detected" && exit
else
mountusb
fi
esac
+82
View File
@@ -0,0 +1,82 @@
configuration {
font: "AlegreyaSans Bold 16";
sort: true;
sorting-method: "normal";
disable-history: false;
scroll-method: 0;
window-thumbnail: true;
}
@theme "/dev/null"
* {
bg: #0C0F09;
fg: #05E289;
bgAlt: #1B1E25;
button: #05E289;
background-color: @bg;
text-color: @fg;
}
@import "../Themes/style.rasi"
mainbox { children: [ inputbar, listview ]; }
window {
transparency: "real";
width: 400px;
border: 15px 15px 15px 15px;
border-radius: 15px;
height: 200px;
border-color: @bg;
}
inputbar {
children: [ prompt, entry ];
expand: false;
padding: 10px 10px 10px 10px;
}
prompt {
enabled: true;
background-color: @bg;
padding: 10px;
border-radius: 15px;
}
entry {
background-color: @bgAlt;
placeholder: "Password";
expand: true;
padding: 10px;
border-radius: 15px;
}
listview {
columns: 2;
cycle: true;
dynamic: true;
layout: vertical;
scrollbar: false;
}
element {
orientation: vertical;
margin: 5px 10px 5px 10px;
border-radius: 10px;
background-color: @bgAlt;
}
element-text {
expand: true;
margin: 10px 15px 10px 15px;
background-color: inherit;
text-color: inherit;
}
element selected {
background-color: @fg;
text-color: @bgAlt;
border-radius: 10px;
}
+72
View File
@@ -0,0 +1,72 @@
configuration {
sort: true;
sorting-method: "normal";
disable-history: false;
scroll-method: 0;
window-thumbnail: true;
}
@theme "/dev/null"
* {
bg: #0C0F09;
fg: #05E289;
bgAlt: #1B1E25;
button: #05E289;
background-color: @bg;
text-color: @fg;
}
@import "../Themes/style.rasi"
mainbox { children: [ inputbar, listview ]; }
window {
transparency: "real";
width: 600px;
border: 15px 15px 15px 15px;
border-radius: 15px;
height: 500px;
border-color: @bg;
}
inputbar {
children: [ prompt ];
expand: false;
padding: 10px 10px 10px 10px;
}
prompt {
enabled: true;
background-color: @bg;
padding: 10px;
border-radius: 15px;
}
listview {
columns: 2;
cycle: true;
dynamic: true;
layout: vertical;
scrollbar: false;
}
element {
orientation: vertical;
margin: 3px 5px 3px 5px;
border-radius: 10px;
background-color: @bgAlt;
}
element-text {
expand: true;
margin: 10px 15px 10px 15px;
background-color: inherit;
text-color: inherit;
}
element selected {
background-color: @fg;
text-color: @bgAlt;
border-radius: 10px;
}