This commit is contained in:
ayushDumasia 2024-10-21 22:35:37 +05:30
parent b8de2e70f8
commit d1bbbcbb15
16 changed files with 1538 additions and 3 deletions

317
rofi/bluetooth/bluetooth.sh Executable file
View file

@ -0,0 +1,317 @@
#!/usr/bin/env bash
# __ _ _ _ _ _ _
# _ __ ___ / _(_) | |__ | |_ _ ___| |_ ___ ___ | |_| |__
# | '__/ _ \| |_| |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __| '_ \
# | | | (_) | _| |_____| |_) | | |_| | __/ || (_) | (_) | |_| | | |
# |_| \___/|_| |_| |_.__/|_|\__,_|\___|\__\___/ \___/ \__|_| |_|
#
# Author: Nick Clyde (clydedroid)
#
# A script that generates a rofi menu that uses bluetoothctl to
# connect to bluetooth devices and display status info.
#
# Inspired by networkmanager-dmenu (https://github.com/firecat53/networkmanager-dmenu)
# Thanks to x70b1 (https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/system-bluetooth-bluetoothctl)
#
# Depends on:
# Arch repositories: rofi, bluez-utils (contains bluetoothctl)
# Constants
divider="---------"
goback="Back"
# Checks if bluetooth controller is powered on
power_on() {
if bluetoothctl show | grep -q "Powered: yes"; then
return 0
else
return 1
fi
}
# Toggles power state
toggle_power() {
if power_on; then
bluetoothctl power off
show_menu
else
if rfkill list bluetooth | grep -q 'blocked: yes'; then
rfkill unblock bluetooth && sleep 3
fi
bluetoothctl power on
show_menu
fi
}
# Checks if controller is scanning for new devices
scan_on() {
if bluetoothctl show | grep -q "Discovering: yes"; then
echo "Scan: on"
return 0
else
echo "Scan: off"
return 1
fi
}
# Toggles scanning state
toggle_scan() {
if scan_on; then
kill $(pgrep -f "bluetoothctl scan on")
bluetoothctl scan off
show_menu
else
bluetoothctl scan on &
echo "Scanning..."
sleep 5
show_menu
fi
}
# Checks if controller is able to pair to devices
pairable_on() {
if bluetoothctl show | grep -q "Pairable: yes"; then
echo "Pairable: on"
return 0
else
echo "Pairable: off"
return 1
fi
}
# Toggles pairable state
toggle_pairable() {
if pairable_on; then
bluetoothctl pairable off
show_menu
else
bluetoothctl pairable on
show_menu
fi
}
# Checks if controller is discoverable by other devices
discoverable_on() {
if bluetoothctl show | grep -q "Discoverable: yes"; then
echo "Discoverable: on"
return 0
else
echo "Discoverable: off"
return 1
fi
}
# Toggles discoverable state
toggle_discoverable() {
if discoverable_on; then
bluetoothctl discoverable off
show_menu
else
bluetoothctl discoverable on
show_menu
fi
}
# Checks if a device is connected
device_connected() {
device_info=$(bluetoothctl info "$1")
if echo "$device_info" | grep -q "Connected: yes"; then
return 0
else
return 1
fi
}
# Toggles device connection
toggle_connection() {
if device_connected "$1"; then
bluetoothctl disconnect "$1"
device_menu "$device"
else
bluetoothctl connect "$1"
device_menu "$device"
fi
}
# Checks if a device is paired
device_paired() {
device_info=$(bluetoothctl info "$1")
if echo "$device_info" | grep -q "Paired: yes"; then
echo "Paired: yes"
return 0
else
echo "Paired: no"
return 1
fi
}
# Toggles device paired state
toggle_paired() {
if device_paired "$1"; then
bluetoothctl remove "$1"
device_menu "$device"
else
bluetoothctl pair "$1"
device_menu "$device"
fi
}
# Checks if a device is trusted
device_trusted() {
device_info=$(bluetoothctl info "$1")
if echo "$device_info" | grep -q "Trusted: yes"; then
echo "Trusted: yes"
return 0
else
echo "Trusted: no"
return 1
fi
}
# Toggles device connection
toggle_trust() {
if device_trusted "$1"; then
bluetoothctl untrust "$1"
device_menu "$device"
else
bluetoothctl trust "$1"
device_menu "$device"
fi
}
# Prints a short string with the current bluetooth status
# Useful for status bars like polybar, etc.
print_status() {
if power_on; then
printf ''
paired_devices_cmd="devices Paired"
# Check if an outdated version of bluetoothctl is used to preserve backwards compatibility
if (( $(echo "$(bluetoothctl version | cut -d ' ' -f 2) < 5.65" | bc -l) )); then
paired_devices_cmd="paired-devices"
fi
mapfile -t paired_devices < <(bluetoothctl $paired_devices_cmd | grep Device | cut -d ' ' -f 2)
counter=0
for device in "${paired_devices[@]}"; do
if device_connected "$device"; then
device_alias=$(bluetoothctl info "$device" | grep "Alias" | cut -d ' ' -f 2-)
if [ $counter -gt 0 ]; then
printf ", %s" "$device_alias"
else
printf " %s" "$device_alias"
fi
((counter++))
fi
done
printf "\n"
else
echo ""
fi
}
# A submenu for a specific device that allows connecting, pairing, and trusting
device_menu() {
device=$1
# Get device name and mac address
device_name=$(echo "$device" | cut -d ' ' -f 3-)
mac=$(echo "$device" | cut -d ' ' -f 2)
# Build options
if device_connected "$mac"; then
connected="Connected: yes"
else
connected="Connected: no"
fi
paired=$(device_paired "$mac")
trusted=$(device_trusted "$mac")
options="$connected\n$paired\n$trusted\n$divider\n$goback\nExit"
# Open rofi menu, read chosen option
chosen="$(echo -e "$options" | $rofi_command "$device_name")"
# Match chosen option to command
case "$chosen" in
"" | "$divider")
echo "No option chosen."
;;
"$connected")
toggle_connection "$mac"
;;
"$paired")
toggle_paired "$mac"
;;
"$trusted")
toggle_trust "$mac"
;;
"$goback")
show_menu
;;
esac
}
# Opens a rofi menu with current bluetooth status and options to connect
show_menu() {
# Get menu options
if power_on; then
power="Power: on"
# Human-readable names of devices, one per line
# If scan is off, will only list paired devices
devices=$(bluetoothctl devices | grep Device | cut -d ' ' -f 3-)
# Get controller flags
scan=$(scan_on)
pairable=$(pairable_on)
discoverable=$(discoverable_on)
# Options passed to rofi
options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nExit"
else
power="Power: off"
options="$power\nExit"
fi
# Open rofi menu, read chosen option
chosen="$(echo -e "$options" | $rofi_command "Bluetooth")"
# Match chosen option to command
case "$chosen" in
"" | "$divider")
echo "No option chosen."
;;
"$power")
toggle_power
;;
"$scan")
toggle_scan
;;
"$discoverable")
toggle_discoverable
;;
"$pairable")
toggle_pairable
;;
*)
device=$(bluetoothctl devices | grep "$chosen")
# Open a submenu if a device is selected
if [[ $device ]]; then device_menu "$device"; fi
;;
esac
}
# Rofi command to pipe into, can add any options here
rofi_command="rofi -dmenu $* -p"
case "$1" in
--status)
print_status
;;
*)
show_menu
;;
esac

11
rofi/clipboard/launcher.sh Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
## Directory and theme setup
dir="$HOME/.config/rofi/clipboard/"
theme='style'
echo ${dir}
## Clipboard Search with Rofi and custom theme
cliphist list | awk '{$1=""; print $0}' | rofi -dmenu -i -p "Search" -theme ${dir}/${theme}.rasi | wl-copy

180
rofi/clipboard/style.rasi Normal file
View file

@ -0,0 +1,180 @@
/*****----- Configuration -----*****/
configuration {
modi: "drun,window";
show-icons: true;
display-drun: "";
display-run: "";
display-filebrowser: "";
display-window: "";
drun-display-format: "{name}";
window-format: "{w} {c}";
}
/*****----- Global Properties -----*****/
* {
font: "JetBrains Mono Nerd Font 10";
background: #11111b;
background-alt: #313244;
foreground: #eff1f5;
selected: #cba6f7;
active: #6E77FF;
urgent: #8E3596;
}
/*****----- Main Window -----*****/
window {
/* properties for window widget */
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 500px;
x-offset: 0px;
y-offset: 0px;
/* properties for all widgets */
enabled: true;
border-radius: 8px;
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 0px;
background-color: transparent;
orientation: vertical;
children: [ "inputbar", "listbox" ];
}
listbox {
spacing: 0px;
padding: 0px;
background-color: transparent;
orientation: vertical;
children: [ "listview" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 8px;
padding: 32px 32px 0px 32px;
background-color: transparent;
text-color: @foreground;
orientation: horizontal;
children: [ "textbox-prompt-colon", "entry", "dummy", "mode-switcher" ];
}
textbox-prompt-colon {
enabled: true;
expand: false;
str: "";
padding: 12px 20px 12px 15px;
border-radius: 10%;
background-color: #a6e3a1;
text-color: @background;
}
entry {
enabled: true;
expand: false;
width: 200px;
padding: 12px 16px 0px 16px;
border-radius: 10px;
background-color: @background-alt;
text-color: inherit;
cursor: text;
placeholder: "Search";
placeholder-color: inherit;
}
dummy {
expand: true;
background-color: transparent;
}
/*****----- Mode Switcher -----*****/
mode-switcher{
enabled: true;
spacing: 8px;
background-color: transparent;
text-color: @foreground;
}
button {
padding: 12px 22px 0px 16px;
border-radius: 100%;
background-color: @background-alt;
text-color: inherit;
cursor: pointer;
}
button selected {
background-color: @selected;
text-color: @background;
}
/*****----- Listview -----*****/
listview {
padding : 8px;
enabled: true;
columns: 1;
lines: 8;
cycle: true;
dynamic: true;
scrollbar: false;
layout: vertical;
reverse: false;
fixed-height: true;
fixed-columns: true;
spacing: 8px;
margin: 32px 24px;
border-radius: 8px;
background-color: #1e1e2e;
text-color: @foreground;
cursor: "default";
}
/*****----- Elements -----*****/
element {
enabled: true;
spacing: 0px;
padding: 8px;
border-radius: 8px;
background-color: transparent;
text-color: @foreground;
cursor: pointer;
}
element selected.normal {
background-color: @selected;
text-color: @background;
}
element-icon {
size: 0px;
}
element-text {
padding: 0px 0px;
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0;
}
/*****----- Message -----*****/
message {
background-color: transparent;
}
textbox {
padding: 0px;
border-radius: 0px;
background-color: @background-alt;
text-color: @foreground;
vertical-align: 0.5;
horizontal-align: 0.5;
}
error-message {
padding: 0px;
border-radius: 0px;
background-color: @background;
text-color: @foreground;
}

9
rofi/launcher/launcher.sh Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
dir="$HOME/.config/rofi/launcher/"
theme='style'
## Run
rofi \
-show drun \
-theme ${dir}/${theme}.rasi

183
rofi/launcher/style.rasi Normal file
View file

@ -0,0 +1,183 @@
/*****----- Configuration -----*****/
configuration {
modi: "drun,window";
show-icons: true;
display-drun: "";
display-run: "";
display-filebrowser: "";
display-window: "";
drun-display-format: "{name}";
window-format: "{w} {c}";
}
/*****----- Global Properties -----*****/
* {
font: "JetBrains Mono Nerd Font 10";
background: #11111b;
background-alt: #313244;
foreground: #eff1f5;
selected: #cba6f7;
active: #6E77FF;
urgent: #8E3596;
}
/*****----- Main Window -----*****/
window {
/* properties for window widget */
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 500px;
x-offset: 0px;
y-offset: 0px;
/* properties for all widgets */
enabled: true;
border-radius: 8px;
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 0px;
background-color: transparent;
orientation: vertical;
children: [ "inputbar", "listbox" ];
}
listbox {
spacing: 0px;
padding: 0px;
background-color: transparent;
orientation: vertical;
children: [ "listview" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 8px;
padding: 32px 32px 80px 32px;
background-color: transparent;
background-image: url("~/Downloads/wallpaper/Window.png",width);
text-color: @foreground;
orientation: horizontal;
children: [ "textbox-prompt-colon", "entry", "dummy", "mode-switcher" ];
}
textbox-prompt-colon {
enabled: true;
expand: false;
str: "";
padding: 12px 20px 12px 15px;
border-radius: 100%;
background-color: #a6e3a1;
text-color: @background;
}
entry {
enabled: true;
expand: false;
width: 200px;
padding: 12px 16px 8px 16px;
border-radius: 100%;
background-color: @background-alt;
text-color: inherit;
cursor: text;
placeholder: "Search";
placeholder-color: inherit;
}
dummy {
expand: true;
background-color: transparent;
}
/*****----- Mode Switcher -----*****/
mode-switcher{
enabled: true;
spacing: 8px;
background-color: transparent;
text-color: @foreground;
}
button {
padding: 12px 22px 12px 16px;
border-radius: 100%;
background-color: @background-alt;
text-color: inherit;
cursor: pointer;
}
button selected {
background-color: @selected;
text-color: @background;
}
/*****----- Listview -----*****/
listview {
padding : 8px;
enabled: true;
columns: 1;
lines: 5;
cycle: true;
dynamic: true;
scrollbar: false;
layout: vertical;
reverse: false;
fixed-height: true;
fixed-columns: true;
spacing: 8px;
margin: 32px 24px;
border-radius: 8px;
background-color: #1e1e2e;
text-color: @foreground;
cursor: "default";
}
/*****----- Elements -----*****/
element {
enabled: true;
spacing: 0px;
padding: 8px;
border-radius: 8px;
background-color: transparent;
text-color: @foreground;
cursor: pointer;
}
element selected.normal {
background-color: @selected;
text-color: @background;
}
element-icon {
background-color: transparent;
text-color: inherit;
size: 32px;
cursor: inherit;
}
element-text {
padding: 0px 16px;
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0;
}
/*****----- Message -----*****/
message {
background-color: transparent;
}
textbox {
padding: 0px;
border-radius: 0px;
background-color: @background-alt;
text-color: @foreground;
vertical-align: 0.5;
horizontal-align: 0.5;
}
error-message {
padding: 0px;
border-radius: 0px;
background-color: @background;
text-color: @foreground;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View file

@ -0,0 +1,104 @@
/*****----- Configuration -----*****/
configuration {
show-icons: false;
}
/*****----- Global Properties -----*****/
* {
font: "JetBrainsMono Nerd Font Mono Bold 12";
background: #11111b;
selected: #cba6f7;
active: #716251;
urgent: #934A1C;
}
/*
USE_BUTTONS=YES
*/
/*****----- Main Window -----*****/
window {
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 350px;
x-offset: 0px;
y-offset: 0px;
padding: 0px;
border: 0px solid;
border-radius: 8px;
border-color: @selected;
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 0px;
margin: 0px;
padding: 0px;
border: 0px solid;
border-radius: 0px;
border-color: @selected;
background-color: transparent;
children: [ "message", "listview" ];
}
/*****----- Listview -----*****/
listview {
enabled: true;
columns: 2;
lines: 1;
cycle: true;
dynamic: true;
scrollbar: false;
layout: vertical;
reverse: false;
fixed-height: true;
fixed-columns: true;
spacing: 16px;
padding: 32px;
margin: 0px;
background-color: transparent;
cursor: "default";
}
/*****----- Elements -----*****/
element {
enabled: true;
padding: 17px;
border-radius: 16px;
background-color: #585b70;
text-color: #eff1f5;
cursor: pointer;
}
element-text {
font: "Font Awesome 5 Free Bold 24";
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.5;
}
element selected.normal {
background-color: #8839ef;
}
/*****----- Message -----*****/
message {
enabled: true;
margin: 0px 25px;
padding: 10px 20px;
border-radius: 0% 0% 100% 100%;
background-color: #f5c2e7;
}
textbox {
background-color: transparent;
text-color: #313244;
vertical-align: 0.5;
horizontal-align: 0.5;
}

102
rofi/powermenu/powermenu.sh Executable file
View file

@ -0,0 +1,102 @@
#!/usr/bin/env bash
# Current Theme
dir="$HOME/.config/rofi/powermenu/"
theme='style'
# CMDs
uptime="`uptime -p | sed -e 's/up //g' | sed -e 's/hour/hr/g' | sed -e 's/minute/min/g'`"
# Options
hibernate=''
shutdown=''
reboot=''
lock=''
suspend=''
logout=''
yes=''
no=''
# Rofi CMD
rofi_cmd() {
rofi -dmenu \
-p "$USER" \
-mesg " Uptime: $uptime" \
-theme ${dir}/${theme}.rasi
}
# Confirmation CMD
confirm_cmd() {
rofi -markup-rows -dmenu \
-p 'Confirmation' \
-mesg 'Are you Sure?' \
-theme ${dir}/confirmation.rasi
}
# Ask for confirmation
confirm_exit() {
echo -e "<span foreground='#a6e3a1'>$yes</span>\n<span foreground='#f38ba8'>$no</span>" | confirm_cmd
}
# Pass variables to rofi dmenu
run_rofi() {
echo -e "$shutdown\n$reboot\n$lock\n$suspend\n$hibernate\n$logout" | rofi_cmd
}
# Execute Command
run_cmd() {
selected="$(confirm_exit)"
echo "$selected"
if [[ "$selected" =~ "$yes" ]]; then
if [[ $1 == '--shutdown' ]]; then
systemctl poweroff
elif [[ $1 == '--reboot' ]]; then
systemctl reboot
elif [[ $1 == '--hibernate' ]]; then
systemctl hibernate
elif [[ $1 == '--suspend' ]]; then
mpc -q pause
amixer set Master mute
systemctl suspend
elif [[ $1 == '--logout' ]]; then
if [[ "$DESKTOP_SESSION" == 'openbox' ]]; then
openbox --exit
elif [[ "$DESKTOP_SESSION" == 'bspwm' ]]; then
bspc quit
elif [[ "$DESKTOP_SESSION" == 'i3' ]]; then
i3-msg exit
elif [[ "$DESKTOP_SESSION" == 'plasma' ]]; then
qdbus org.kde.ksmserver /KSMServer logout 0 0 0
fi
fi
else
exit 0
fi
}
# Actions
chosen="$(run_rofi)"
case ${chosen} in
$shutdown)
run_cmd --shutdown
;;
$reboot)
run_cmd --reboot
;;
$hibernate)
run_cmd --hibernate
;;
$lock)
if [[ -x '/usr/bin/betterlockscreen' ]]; then
betterlockscreen -l
elif [[ -x '/usr/bin/i3lock' ]]; then
i3lock
fi
;;
$suspend)
run_cmd --suspend
;;
$logout)
run_cmd --logout
;;
esac

130
rofi/powermenu/style.rasi Normal file
View file

@ -0,0 +1,130 @@
/*****----- Configuration -----*****/
configuration {
show-icons: false;
}
/*****----- Global Properties -----*****/
* {
font: "JetBrainsMono Nerd Font Mono Bold 12";
background: #11111b;
background-alt: #f2cdcd;
foreground: #FFFFFF;
selected: #cba6f7;
active: #716251;
urgent: #934A1C;
}
/*
USE_BUTTONS=YES
*/
/*****----- Main Window -----*****/
window {
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 600px;
x-offset: 0px;
y-offset: 0px;
padding: 0px;
border: 0px solid;
border-radius: 8px;
border-color: @selected;
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 0px;
margin: 0px;
padding: 0px;
border: 0px solid;
border-radius: 0px;
border-color: @selected;
background-color: transparent;
children: [ "inputbar", "message", "listview" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 0px;
padding: 102px 32px 80px 32px;
border-radius: 0%;
background-color: transparent;
background-image: url("~/Downloads/wallpaper/Anime.png",width);
children: ["dummy", "prompt"];
}
prompt {
enabled: true;
padding: 8px;
border-radius: 8px;
background-color: #a6e3a1;
text-color: #313244;
}
dummy {
background-color: transparent;
}
/*****----- Listview -----*****/
listview {
enabled: true;
columns: 6;
lines: 1;
cycle: true;
dynamic: true;
scrollbar: false;
layout: vertical;
reverse: false;
fixed-height: true;
fixed-columns: true;
spacing: 16px;
padding: 32px;
margin: 0px;
background-color: transparent;
cursor: "default";
}
/*****----- Elements -----*****/
element {
enabled: true;
padding: 17px;
border-radius: 16px;
background-color: #585b70;
text-color: #eff1f5;
cursor: pointer;
}
element-text {
font: "Font Awesome 5 Free Bold 24";
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.5;
}
element selected.normal {
background-color: #cba6f7;
text-color: #313244;
}
/*****----- Message -----*****/
message {
enabled: true;
margin: 20px 150px 0px 150px;
padding: 10px 20px;
border-radius: 100%;
background-color: #f5c2e7;
}
textbox {
background-color: transparent;
text-color: #313244;
vertical-align: 0.5;
horizontal-align: 0.5;
}

110
rofi/wifi/enable.rasi Normal file
View file

@ -0,0 +1,110 @@
/*****----- Configuration -----*****/
configuration {
show-icons: false;
}
/*****----- Global Properties -----*****/
* {
font: "JetBrains Mono Nerd Font 12";
background: #11111b;
background-alt: #313244;
foreground: #eff1f5;
selected: #cba6f7;
active: #6E77FF;
urgent: #8E3596;
}
/*****----- Main Window -----*****/
window {
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 320px;
x-offset: 0px;
y-offset: 0px;
/* properties for all widgets */
enabled: true;
border-radius: 8px;
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 0px;
background-color: transparent;
orientation: horizontal;
children: [ "inputbar", "listview" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 0px;
padding: 28px 0px 28px 24px;
background-color: transparent;
text-color: @foreground;
orientation: horizontal;
children: [ "textbox-prompt-colon" ];
}
textbox-prompt-colon {
enabled: true;
expand: false;
str: "";
padding: 12px 24px 12px 14px;
border-radius: 100%;
background-color: #a6e3a1;
text-color: @background;
}
/*****----- Listview -----*****/
listview {
enabled: true;
columns: 1;
lines: 1;
cycle: true;
dynamic: false;
scrollbar: false;
layout: vertical;
reverse: false;
spacing: 0px;
margin: 28px 24px;
border-radius: 8px;
background-color: #1e1e2e;
text-color: @foreground;
cursor: "default";
}
/*****----- Elements -----*****/
element {
enabled: true;
spacing: 0px;
padding: 12px 8px;
border-radius: 8px;
background-color: transparent;
text-color: @foreground;
cursor: pointer;
}
element selected.normal {
background-color: @selected;
text-color: @background;
}
element-icon {
background-color: transparent;
text-color: inherit;
size: 0px;
cursor: inherit;
}
element-text {
padding: 0px 16px;
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0;
}

126
rofi/wifi/list.rasi Normal file
View file

@ -0,0 +1,126 @@
/*****----- Configuration -----*****/
configuration {
show-icons: false;
}
/*****----- Global Properties -----*****/
* {
font: "JetBrains Mono Nerd Font 12";
background: #11111b;
background-alt: #313244;
foreground: #eff1f5;
selected: #cba6f7;
active: #6E77FF;
urgent: #8E3596;
}
/*****----- Main Window -----*****/
window {
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 500px;
x-offset: 0px;
y-offset: 0px;
/* properties for all widgets */
enabled: true;
border-radius: 8px;
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 0px;
background-color: transparent;
orientation: vertical;
children: [ "inputbar", "listview" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 0px;
padding: 28px 24px 0px 24px;
background-color: transparent;
text-color: @foreground;
orientation: horizontal;
children: [ "textbox-prompt-colon", "dummy", "entry" ];
}
dummy {
background-color: transparent;
}
entry {
enabled: true;
expand: false;
width: 250px;
padding: 12px 16px 8px 16px;
border-radius: 8px;
background-color: @background-alt;
text-color: inherit;
cursor: text;
placeholder: "Search";
placeholder-color: inherit;
}
textbox-prompt-colon {
enabled: true;
expand: false;
str: "";
padding: 12px 24px 12px 14px;
border-radius: 100%;
background-color: #a6e3a1;
text-color: @background;
}
/*****----- Listview -----*****/
listview {
enabled: true;
columns: 1;
lines: 5;
cycle: true;
dynamic: true;
scrollbar: false;
layout: vertical;
reverse: false;
fixed-height: true;
fixed-columns: true;
spacing: 0px;
margin: 32px 24px;
border-radius: 8px;
background-color: #1e1e2e;
text-color: @foreground;
cursor: "default";
}
/*****----- Elements -----*****/
element {
enabled: true;
spacing: 0px;
padding: 12px 8px;
border-radius: 8px;
background-color: transparent;
text-color: @foreground;
cursor: pointer;
}
element.selected {
background-color: @selected;
text-color: @background;
}
element-icon {
size: 0px;
}
element-text {
padding: 0px 16px;
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0;
}

90
rofi/wifi/password.rasi Normal file
View file

@ -0,0 +1,90 @@
/*****----- Configuration -----*****/
configuration {
show-icons: false;
}
/*****----- Global Properties -----*****/
* {
font: "JetBrains Mono Nerd Font 12";
background: #11111b;
background-alt: #313244;
foreground: #eff1f5;
selected: #cba6f7;
active: #6E77FF;
urgent: #8E3596;
}
/*****----- Main Window -----*****/
window {
width: 700px;
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
x-offset: 0px;
y-offset: 0px;
/* properties for all widgets */
enabled: true;
border-radius: 8px;
padding: 24px;
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 0px;
background-color: transparent;
orientation: vertical;
children: [ "inputbar" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 16px;
padding: 0px;
background-color: transparent;
text-color: @foreground;
orientation: horizontal;
children: [ "textbox-prompt-colon", "prompt", "dummy", "entry" ];
}
entry {
enabled: true;
expand: false;
width: 300px;
padding: 12px 16px 8px 16px;
border-radius: 8px;
background-color: @background-alt;
text-color: inherit;
cursor: text;
placeholder: "Enter Password";
placeholder-color: inherit;
}
textbox-prompt-colon {
enabled: true;
expand: false;
str: "";
padding: 12px 24px 12px 14px;
border-radius: 100%;
background-color: #a6e3a1;
text-color: @background;
}
prompt {
enabled: true;
margin: 0px;
padding: 0px;
border-radius: 8px;
background-color: @background;
text-color: #a6e3a1;
vertical-align: 0.5;
}
dummy {
background-color: transparent;
}

90
rofi/wifi/ssid.rasi Normal file
View file

@ -0,0 +1,90 @@
/*****----- Configuration -----*****/
configuration {
show-icons: false;
}
/*****----- Global Properties -----*****/
* {
font: "JetBrains Mono Nerd Font 12";
background: #11111b;
background-alt: #313244;
foreground: #eff1f5;
selected: #cba6f7;
active: #6E77FF;
urgent: #8E3596;
}
/*****----- Main Window -----*****/
window {
width: 659px;
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
x-offset: 0px;
y-offset: 0px;
/* properties for all widgets */
enabled: true;
border-radius: 8px;
padding: 24px;
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 0px;
background-color: transparent;
orientation: vertical;
children: [ "inputbar" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 16px;
padding: 0px;
background-color: transparent;
text-color: @foreground;
orientation: horizontal;
children: [ "textbox-prompt-colon", "prompt", "dummy", "entry" ];
}
entry {
enabled: true;
expand: false;
width: 300px;
padding: 12px 16px 8px 16px;
border-radius: 8px;
background-color: @background-alt;
text-color: inherit;
cursor: text;
placeholder: "Enter SSID";
placeholder-color: inherit;
}
textbox-prompt-colon {
enabled: true;
expand: false;
str: "";
padding: 12px 24px 12px 14px;
border-radius: 100%;
background-color: #a6e3a1;
text-color: @background;
}
prompt {
enabled: true;
margin: 0px;
padding: 0px;
border-radius: 8px;
background-color: @background;
text-color: #a6e3a1;
vertical-align: 0.5;
}
dummy {
background-color: transparent;
}

83
rofi/wifi/wifi.sh Executable file
View file

@ -0,0 +1,83 @@
#!/usr/bin/env bash
# Check if wifi is on
check_wifi_on=$( nmcli --field WIFI g | sed 1d | sed 's/ //g' )
# Get the SSID of the connected wifi network
connected_wifi=$( nmcli -t -f active,ssid device wifi | grep -i 'yes' | sed 's/yes://g' )
# Get the list of all avalaible wifi network
wifi_list=$( nmcli --fields "SECURITY,SSID" device wifi list | sed 1d | sed -E "s/WPA*.?//g"| sed "s/802.1X//g" | sed "s/^--/ /g" | sed "s/ //g" | sed "/--/d" | sed "s/ */ /g" | sed 's/[[:space:]]*$//' )
# Generate the string to pass on
if [ -z "$connected_wifi" ] ; then
string_to_pass=""
else
string_to_pass=" Connected to ${connected_wifi}\n"
fi
# Rofi skeleton for enable
enable_menu() {
rofi -markup-rows -dmenu -theme "$HOME/.config/rofi/wifi/enable.rasi"
}
# Rofi skeleton for list
list_menu() {
rofi -markup-rows -dmenu -theme "$HOME/.config/rofi/wifi/list.rasi"
}
# Rofi menu for wifi enable
enable_wifi() {
echo -e "󰤨 Enable Wifi" | enable_menu
}
# Rofi menu for the wifi list
list_wifi() {
echo -e "󰤭 Disable Wifi\n${string_to_pass} Manual Setup\n${wifi_list}" | list_menu
}
# Rofi menu for the details of the active connection
show_details() {
rofi -e "${details}"
}
# Rofi menu for the ssid
take_ssid() {
ssid=$( echo "" | rofi -dmenu -p "${choice}" -theme "$HOME/.config/rofi/wifi/ssid.rasi" )
}
# Rofi menu for the password
take_password() {
password=$( echo "" | rofi -dmenu -p "${choice}" -theme "$HOME/.config/rofi/wifi/password.rasi" )
}
# Show the menu accordingly
if [ "$check_wifi_on" == "enabled" ] ; then
choice=$(list_wifi)
else
choice=$(enable_wifi)
fi
# Remove the junk from the string
choice="${choice:4}"
# Perform tasks based on the choice
if [ "$choice" == "Enable Wifi" ] ; then
nmcli radio wifi on
elif [ "$choice" == "Disable Wifi" ] ; then
nmcli radio wifi off
elif [ "$choice" == "Manual Setup" ] ; then
take_ssid
if [[ "$ssid" != "" ]] ; then
take_password
nmcli device wifi connect "$ssid" hidden yes password "$password"
fi
elif [[ $choice =~ "Connected to" ]] ; then
kitty -e sh -c "nmcli dev wifi show-password; read -p 'Press Return to close...'"
elif [[ $choice != "" ]] ; then
take_password
nmcli device wifi connect "$choice" password "$password"
fi