about summary refs log tree commit diff
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/battery-screen70
-rwxr-xr-x.local/bin/lock-screen13
-rwxr-xr-x.local/bin/rofi-notes9
-rwxr-xr-x.local/bin/rofi-powermenu49
-rwxr-xr-x.local/bin/rofi-ppd48
-rwxr-xr-x.local/bin/rofi-translate60
-rwxr-xr-x.local/bin/rofi-wifimenu38
-rwxr-xr-x.local/bin/take-slurpshot18
8 files changed, 0 insertions, 305 deletions
diff --git a/.local/bin/battery-screen b/.local/bin/battery-screen
deleted file mode 100755
index 26ac78a..0000000
--- a/.local/bin/battery-screen
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env lua
-
-local function read(path)
-  local f = io.open(path)
-  if not f then return nil end
-  local v = tonumber(f:read('*l'))
-  f:close()
-  return v
-end
-
-local function batterytext()
-  local base        = '/sys/class/power_supply/macsmc-battery/'
-
-  local energy_now  = read(base .. 'energy_now')
-  local energy_full = read(base .. 'energy_full')
-  local status_f    = io.open(base .. 'status')
-
-  if not energy_now or not energy_full or not status_f then
-    return { { full_text = 'bat ?' } }
-  end
-
-  local status = status_f:read('*l')
-  status_f:close()
-
-  local capacity = math.floor(energy_now / energy_full * 100 + 0.5)
-
-  local text_color = '#ffffff'
-  local battery_symbol = ' '
-
-  if capacity < 30 then
-    text_color = '#ed8796'
-    battery_symbol = '󰁼'
-  elseif capacity > 70 then
-    text_color = '#a6da95'
-    battery_symbol = '󰂁'
-  else
-    text_color = '#eed49f'
-    battery_symbol = '󰁾'
-  end
-
-  local symbol = ({
-    Charging    = '󱐋',
-    Discharging = battery_symbol,
-  })[status] or ' '
-
-  return string.format('%s %2d%%', symbol, capacity), text_color
-end
-
-function hexToRgb(hex)
-  hex = hex:gsub("#", "")
-
-  local r = tonumber(hex:sub(1, 2), 16)
-  local g = tonumber(hex:sub(3, 4), 16)
-  local b = tonumber(hex:sub(5, 6), 16)
-
-  return r, g, b
-end
-
-function printHexColor(text, hex)
-  local r, g, b = hexToRgb(hex)
-  local colorCode = string.format("\27[38;2;%d;%d;%dm", r, g, b)
-  local resetCode = "\27[0m"
-
-  print(colorCode .. text .. resetCode)
-end
-
-while true do
-  printHexColor(batterytext())
-  os.execute("sleep 1")   -- Wait for 1 second
-end
diff --git a/.local/bin/lock-screen b/.local/bin/lock-screen
deleted file mode 100755
index 4307c9a..0000000
--- a/.local/bin/lock-screen
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-
-if [[ $1 =~ ^[0-9]+$ ]]; then
-    SLEEP_DURATION=$1
-else
-    SLEEP_DURATION=10
-fi
-
-grim /tmp/lockscreen-0.png
-magick /tmp/lockscreen-0.png -scale 10% -blur 0x1 -resize 1000% /tmp/lockscreen.png
-swaylock -i /tmp/lockscreen.png &
-sleep $SLEEP_DURATION
-systemctl sleep
diff --git a/.local/bin/rofi-notes b/.local/bin/rofi-notes
deleted file mode 100755
index 840dea6..0000000
--- a/.local/bin/rofi-notes
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env sh
-
-note_list=$(zk list -f "{{ title }}" -d $'\n' -q)
-
-selected=$(printf "%s\n" "$note_list" | rofi -dmenu -i -p "󱞁 ")
-
-if [[ -n $selected ]]; then
-    foot -a=floating_foot -e sh -c "zk edit --match \"${selected}\""
-fi
diff --git a/.local/bin/rofi-powermenu b/.local/bin/rofi-powermenu
deleted file mode 100755
index 0ff3f9c..0000000
--- a/.local/bin/rofi-powermenu
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env lua
-
-local function rofi(prompt, lines)
-  local cmd = string.format(
-    'printf "%s" | rofi -dmenu -i -p "%s"',
-    table.concat(lines, "\n"),
-    prompt
-  )
-  local handle = io.popen(cmd)
-  local selection = handle:read("*a")
-  handle:close()
-  selection = selection:gsub("%s+$", "")
-  if selection == "" then return nil end
-  return selection
-end
-
-local function contains(tbl, val)
-  for _, v in pairs(tbl) do
-    if v == val then
-      return true
-    end
-  end
-  return false
-end
-
--- TODO: Deduplicate This
-local options = {
-  "Log Out",
-  "Shutdown",
-  "Restart"
-}
-
-local option_pair = {
-  ["Log Out"] = "swaymsg exit",
-  ["Shutdown"] = "systemctl poweroff",
-  ["Restart"] = "systemctl reboot"
-}
-
-local choice = rofi("Action:", options)
-if (not choice) or (not contains(options,choice)) then os.exit() end
-
-if choice == "Log Out" then
-  io.popen(option_pair[choice])
-else
-  local confirm = rofi("Are you sure?:", {"Yes", "No"})
-  if confirm == "Yes" then
-    io.popen(option_pair[choice])
-  end
-end
diff --git a/.local/bin/rofi-ppd b/.local/bin/rofi-ppd
deleted file mode 100755
index 5a4f13b..0000000
--- a/.local/bin/rofi-ppd
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env lua
-
-local function trim(s)
-  return s:gsub("^%s+", ""):gsub("%s+$", "")
-end
-
-local function rofi(prompt, lines)
-  local cmd = string.format(
-    'printf "%s" | rofi -dmenu -i -p "%s"',
-    table.concat(lines, "\n"),
-    prompt
-  )
-  local handle = io.popen(cmd)
-  local selection = handle:read("*a")
-  handle:close()
-  selection = trim(selection or "")
-  if selection == "" then return nil end
-  return selection
-end
-
-local modes = {}
-
-local handle = io.popen('powerprofilesctl list')
-local profile_list = handle:read("*a")
-handle:close()
-
-local handle = io.popen('powerprofilesctl get')
-local current_profile = trim(handle:read("*a") or "")
-handle:close()
-
-for line in profile_list:gmatch("[^\r\n]+") do
-  line = trim(line)
-  local mode = line:match("^%*?%s*([%w%-_]+)%s*:$")
-  if mode then
-    if mode == current_profile then
-      table.insert(modes, "* " .. mode)
-    else
-      table.insert(modes, "  " .. mode)
-    end
-  end
-end
-
-local selected_profile = rofi('󰓅', modes)
-if not selected_profile then os.exit() end
-
-selected_profile = selected_profile:gsub("^%*%s*", ""):gsub("^%s+", "")
-
-io.popen('powerprofilesctl set ' .. selected_profile)
diff --git a/.local/bin/rofi-translate b/.local/bin/rofi-translate
deleted file mode 100755
index f71557d..0000000
--- a/.local/bin/rofi-translate
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env lua
-
-local function rofi(prompt, lines)
-  local cmd = string.format(
-    'printf "%s" | rofi -dmenu -i -p "%s"',
-    table.concat(lines, "\n"),
-    prompt
-  )
-  local handle = io.popen(cmd)
-  local selection = handle:read("*a")
-  handle:close()
-  selection = selection:gsub("%s+$", "")
-  if selection == "" then return nil end
-  return selection
-end
-
-local function contains(tbl, val)
-  for _, v in pairs(tbl) do
-    if v == val then
-      return true
-    end
-  end
-  return false
-end
-
-local directions = {
-  "English → Portuguese",
-  "Portuguese → English"
-}
-
-local choice = rofi("Translate:", directions)
-if (not choice) or (not contains(directions,choice)) then os.exit() end
-
-local lang_pair = {
-  ["English → Portuguese"] = "en:pt",
-  ["Portuguese → English"] = "pt:en"
-}
-local pair = lang_pair[choice]
-
-local text = rofi("󰗊", { "" })
-if not text then os.exit() end
-
-local trans_cmd = string.format('trans -b %s "%s"', pair, text:gsub('"', '\\"'))
-local trans_handle = io.popen(trans_cmd)
-local translation = trans_handle:read("*a")
-trans_handle:close()
-translation = translation:gsub("%s+$", "")
-
-if translation == "" then
-  translation = "(no translation returned)"
-else
-  io.popen("wl-copy " .. translation)
-end
-
-local notify_cmd = string.format(
-  'notify-send -- "Translation (%s)" "%s"',
-  choice,
-  translation:gsub('"', '\\"')
-)
-os.execute(notify_cmd)
diff --git a/.local/bin/rofi-wifimenu b/.local/bin/rofi-wifimenu
deleted file mode 100755
index fb45671..0000000
--- a/.local/bin/rofi-wifimenu
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env bash
-
-notify-send "Getting list of available Wi-Fi networks..."
-# Get a list of available wifi connections and morph it into a nice-looking list
-wifi_list=$(nmcli --fields "SECURITY,SSID" device wifi list | sed 1d | sed 's/  */ /g' | sed -E "s/WPA*.?\S/ /g" | sed "s/^--/ /g" | sed "s/  //g" | sed "/--/d")
-
-connected=$(nmcli -fields WIFI g)
-if [[ "$connected" =~ "enabled" ]]; then
-	toggle="󰖪  Disable Wi-Fi"
-elif [[ "$connected" =~ "disabled" ]]; then
-	toggle="󰖩  Enable Wi-Fi"
-fi
-
-# Use rofi to select wifi network
-chosen_network=$(echo -e "$toggle\n$wifi_list" | uniq -u | rofi -dmenu -i -selected-row 1 -p "Wi-Fi SSID: " )
-# Get name of connection
-read -r chosen_id <<< "${chosen_network:3}"
-
-if [ "$chosen_network" = "" ]; then
-	exit
-elif [ "$chosen_network" = "󰖩  Enable Wi-Fi" ]; then
-	nmcli radio wifi on
-elif [ "$chosen_network" = "󰖪  Disable Wi-Fi" ]; then
-	nmcli radio wifi off
-else
-	# Message to show when connection is activated successfully
-  	success_message="You are now connected to the Wi-Fi network \"$chosen_id\"."
-	# Get saved connections
-	saved_connections=$(nmcli -g NAME connection)
-	if [[ $(echo "$saved_connections" | grep -w "$chosen_id") = "$chosen_id" ]]; then
-		nmcli connection up id "$chosen_id" | grep "successfully" && notify-send "Connection Established" "$success_message"
-	else
-		if [[ "$chosen_network" =~ "" ]]; then
-			wifi_password=$(rofi -dmenu -p "Password: " )
-		fi
-		nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && notify-send "Connection Established" "$success_message"
-    fi
-fi
diff --git a/.local/bin/take-slurpshot b/.local/bin/take-slurpshot
deleted file mode 100755
index f30fabe..0000000
--- a/.local/bin/take-slurpshot
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-# Generate base filename with timestamp
-base_filename=$(date +"%m-%d-%Y_%H-%M-%S")
-extension=".png"
-
-# Initialize full filename
-filename="${base_filename}${extension}"
-counter=1
-
-# Check if file exists and append incremental suffix if needed
-while [[ -e "$filename" ]]; do
-    filename="${base_filename}-${counter}${extension}"
-    ((counter++))
-done
-
-# Output the available filename
-grim -g "$(slurp)" "$HOME/Pictures/Screenshots/$filename"