Skip to content

Instantly share code, notes, and snippets.

View naranyala's full-sized avatar
🎯
F11 - back to the context

FMH (@gema_naranyala) naranyala

🎯
F11 - back to the context
View GitHub Profile
@naranyala
naranyala / rofi-showapps-select2kill.sh
Last active September 6, 2023 07:29
kill running app with rofi launcher
#!/bin/bash
# Use Rofi to list running processes and select one to kill
selected_process=$(ps axh -o comm | sort -u | rofi -dmenu -p "Kill Process:")
# Check if a process was selected
if [ -n "$selected_process" ]; then
# Kill the selected process
pkill "$selected_process"
fi
@naranyala
naranyala / rofi-showmenu-webseach.sh
Created September 6, 2023 08:07
toggle rofi launcher to direct search in custom sites
#!/bin/bash
# Declare a custom array of websites
declare -A websites
websites["Google-Search"]="https://www.google.com/search?q=%s"
websites["Stack-Overflow"]="https://stackoverflow.com/search?q=%s"
websites["Youtube"]="https://www.youtube.com/results?search_query=%s"
websites["GitHub"]="https://github.com/search?q=%s"
websites["Twitter"]="https://twitter.com/search?q=%s"
websites["Hacker-News"]="https://hn.algolia.com/?query=%s"
#/bin/bash
### modal to switch tmux-session ###
tmux list-sessions -F '#S' |\
awk 'BEGIN {ORS=" "} {print $1, NR, "\"switch-client -t", $1 "\""}' |\
xargs tmux display-menu -T "Switch-session"
### bind inside tmux.conf ###
# unbind s
# unbind " "
#!/bin/bash
options=("Full Screen" "Selected Area" "Active Window")
selected_option=$(printf '%s\n' "${options[@]}" | rofi -dmenu -p "Screenshot Mode:")
case "$selected_option" in
"Full Screen")
notify-send "Taking full-screen screenshot..."
maim ~/Pictures/screenshot-$(date +"%Y-%m-%d_%H-%M-%S").png
#!/bin/bash
options=("Suspend" "Lockscreen" "Logout" "Restart" "Power Off")
selected_option=$(printf '%s\n' "${options[@]}" | rofi -dmenu -p "System Action:")
case "$selected_option" in
"Suspend")
systemctl suspend
;;
#!/bin/bash
# Function to change wallpaper
change_wallpaper() {
feh --bg-fill "$1" # This sets the wallpaper using Awesome's command
}
# Select random wallpaper from local collection
local_wallpapers_dir="/home/naranyala/repos/wallpapers/"
@naranyala
naranyala / git-rmdir.sh
Created September 12, 2023 10:03
remove unnecessary directory from repository
#/bin/bash
git_rmdir() {
if [ $# -eq 0 ]; then
echo "Usage: git-rmdir <directory>"
return 1
fi
git rm -r --cached "$1"
}
import { onMount, createSignal } from 'solid-js'
const sampleData = {
edges:[
{ "from": 1, "to": 0 },
{"from": 2, "to": 0},
{"from": 3,"to": 1},
{"from": 4,"to": 1},
],
#!/bin/bash
echo "[INFO] total disk usage of flatpak ..."
sudo du -sh /var/lib/flatpak
echo "[INFO] total disk usage of snap ..."
sudo du -sh /var/lib/snapd
@naranyala
naranyala / rofi-selectoption-wifi.sh
Created October 21, 2023 09:30
rofi launcher feature to connect wifi
#!/bin/bash
# Network manager script for Awesome WM using Rofi and nmcli
options="Connect to Wi-Fi\nDisconnect\nEdit Connections\nQuit"
choice=$(echo -e "$options" | rofi -dmenu -p "Network Manager")
case "$choice" in
"Connect to Wi-Fi")
# Display a list of available Wi-Fi networks with SSID names and numbers
wifi_list=$(nmcli -t -f in-use,ssid dev wifi list | awk -F: '{print NR, $2}')