summaryrefslogtreecommitdiff
path: root/rofi
diff options
context:
space:
mode:
authorShubham Saini <pryr@pryr.xyz>2021-05-22 12:56:08 +0000
committerShubham Saini <pryr@pryr.xyz>2021-05-22 12:56:08 +0000
commitbde9d8e1c9a6e2213fc7d40298d43a14f2e99359 (patch)
tree548d45ecb1ada0be5a099ea8b0879c82e08560d7 /rofi
parent4d6de10a92b0264a1cebfbe813d2e7961ef29c2b (diff)
cleaned the repo
Diffstat (limited to 'rofi')
-rwxr-xr-xrofi/.config/rofi/config11
-rwxr-xr-xrofi/.config/rofi/rofi-power.sh38
-rwxr-xr-xrofi/.config/rofi/rofi-wifi.sh108
-rwxr-xr-xrofi/.config/rofi/wifi19
4 files changed, 0 insertions, 176 deletions
diff --git a/rofi/.config/rofi/config b/rofi/.config/rofi/config
deleted file mode 100755
index b096ad7..0000000
--- a/rofi/.config/rofi/config
+++ /dev/null
@@ -1,11 +0,0 @@
1rofi.theme: ~/.cache/wal/colors-rofi-dark.rasi
2rofi.lines: 6
3!rofi.separator-style: none
4!rofi.columns: 1
5rofi.font: Hermit 12
6!rofi.bw: 0
7!rofi.eh: 2
8!rofi.hide-scrollbar: true
9rofi.auto-select: false
10!rofi.display-drun:?
11
diff --git a/rofi/.config/rofi/rofi-power.sh b/rofi/.config/rofi/rofi-power.sh
deleted file mode 100755
index 6aecdbb..0000000
--- a/rofi/.config/rofi/rofi-power.sh
+++ /dev/null
@@ -1,38 +0,0 @@
1#!/usr/bin/env bash
2
3OPTIONS="Reboot\nShut-down\nSuspend\nLock"
4
5# source configuration or use default values
6 LAUNCHER="rofi -location 5 -width 15 -lines 4 -dmenu -i -p power -show-icons "
7 USE_LOCKER="true"
8 LOCKER="/home/ssaini/.config/lock.sh"
9
10
11# Show exit wm option if exit command is provided as an argument
12if [ ${#1} -gt 0 ]; then
13 OPTIONS="Exit window manager\n$OPTIONS"
14fi
15
16option=`echo -e $OPTIONS | $LAUNCHER | awk '{print $1}' | tr -d '\r\n'`
17if [ ${#option} -gt 0 ]
18then
19 case $option in
20 Exit)
21 eval $1
22 ;;
23 Reboot)
24 reboot
25 ;;
26 Shut-down)
27 poweroff
28 ;;
29 Suspend)
30 suspend
31 ;;
32 Lock)
33 light-locker-command -l
34 ;;
35 *)
36 ;;
37 esac
38fi
diff --git a/rofi/.config/rofi/rofi-wifi.sh b/rofi/.config/rofi/rofi-wifi.sh
deleted file mode 100755
index 4694e66..0000000
--- a/rofi/.config/rofi/rofi-wifi.sh
+++ /dev/null
@@ -1,108 +0,0 @@
1#!/usr/bin/env bash
2
3# Starts a scan of available broadcasting SSIDs
4# nmcli dev wifi rescan
5
6DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
7
8FIELDS=SSID,SECURITY
9POSITION=5
10#YOFF=-40
11#XOFF=-120
12FONT="Hermit 12"
13
14if [ -r "$DIR/config" ]; then
15 source ./config
16elif [ -r "~/.config/rofi/config" ]; then
17 source "~/.config/rofi/config"
18else
19 echo "WARNING: config file not found! Using default values."
20fi
21
22LIST=$(nmcli --fields "$FIELDS" device wifi list | sed '/^--/d')
23# For some reason rofi always approximates character width 2 short... hmmm
24RWIDTH=$(($(echo "$LIST" | head -n 1 | awk '{print length($0); }')+2))
25# Dynamically change the height of the rofi menu
26LINENUM=$(echo "$LIST" | wc -l)
27# Gives a list of known connections so we. can parse it later
28KNOWNCON=$(nmcli connection show)
29# Really janky way of telling if there is currently a connection
30CONSTATE=$(nmcli -fields WIFI g)
31
32CURRSSID=$(iwgetid -r)
33
34if [[ ! -z $CURRSSID ]]; then
35 HIGHLINE=$(echo "$(echo "$LIST" | awk -F "[ ]{2,}" '{print $1}' | grep -Fxn -m 1 "$CURRSSID" | awk -F ":" '{print $1}') + 1" | bc )
36fi
37
38# HOPEFULLY you won't need this as often as I do
39# If there are more than 8 SSIDs, the menu will still only have 8 lines
40if [ "$LINENUM" -gt 8 ] && [[ "$CONSTATE" =~ "enabled" ]]; then
41 LINENUM=8
42elif [[ "$CONSTATE" =~ "disabled" ]]; then
43 LINENUM=1
44fi
45
46
47if [[ "$CONSTATE" =~ "enabled" ]]; then
48 TOGGLE="toggle off"
49elif [[ "$CONSTATE" =~ "disabled" ]]; then
50 TOGGLE="toggle on"
51fi
52
53eval FIELDSARR=( $(cat ./config | awk 'BEGIN { FS=","; OFS="\n" } /^FIELDS/ { $1 = substr($1, 8); print $0; }') )
54
55for i in "${!FIELDSARR[@]}"; do
56 if [[ "${FIELDSARR[$i]}" = "SSID" ]]; then
57 SSID_POS="${i}";
58 fi
59done
60
61let AWKSSIDPOS=$SSID_POS+1
62
63CHENTRY=$(echo -e "$TOGGLE\nmanual\n$LIST" | uniq -u | rofi -dmenu -p "Wi-Fi SSID: " -lines "$LINENUM" -a "$HIGHLINE" -location "$POSITION" -yoffset "$YOFF" -xoffset "$XOFF" -font "$FONT" -width -"$RWIDTH")
64#echo "$CHENTRY"
65CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $'$AWKSSIDPOS'}')
66#echo "$CHSSID"
67
68# If the user inputs "manual" as their SSID in the start window, it will bring them to this screen
69if [ "$CHENTRY" = "manual" ] ; then
70 # Manual entry of the SSID and password (if appplicable)
71 MSSID=$(echo "enter the SSID of the network (SSID,password)" | rofi -dmenu -p "Manual Entry: " -font "$FONT" -lines 1)
72 # Separating the password from the entered string
73 MPASS=$(echo "$MSSID" | awk -F "," '{print $2}')
74
75 #echo "$MSSID"
76 #echo "$MPASS"
77
78 # If the user entered a manual password, then use the password nmcli command
79 if [ "$MPASS" = "" ]; then
80 nmcli dev wifi con "$MSSID"
81 else
82 nmcli dev wifi con "$MSSID" password "$MPASS"
83 fi
84
85elif [ "$CHENTRY" = "toggle on" ]; then
86 nmcli radio wifi on
87
88elif [ "$CHENTRY" = "toggle off" ]; then
89 nmcli radio wifi off
90
91else
92
93 # If the connection is already in use, then this will still be able to get the SSID
94 if [ "$CHSSID" = "*" ]; then
95 CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $3}')
96 fi
97
98 # Parses the list of preconfigured connections to see if it already contains the chosen SSID. This speeds up the connection process
99 if [[ $(echo "$KNOWNCON" | grep "$CHSSID") = "$CHSSID" ]]; then
100 nmcli con up "$CHSSID"
101 else
102 if [[ "$CHENTRY" =~ "WPA2" ]] || [[ "$CHENTRY" =~ "WEP" ]]; then
103 WIFIPASS=$(echo "if connection is stored, hit enter" | rofi -dmenu -p "password: " -lines 1 -font "$FONT" )
104 fi
105 nmcli dev wifi con "$CHSSID" password "$WIFIPASS"
106 fi
107
108fi
diff --git a/rofi/.config/rofi/wifi b/rofi/.config/rofi/wifi
deleted file mode 100755
index 954e4ae..0000000
--- a/rofi/.config/rofi/wifi
+++ /dev/null
@@ -1,19 +0,0 @@
1# Config for rofi-wifi-menu
2
3# position values:
4# 1 2 3
5# 8 0 4
6# 7 6 5
7POSITION=3
8
9#y-offset
10YOFF=17
11
12#x-offset
13XOFF=0
14
15#fields to be displayed
16FIELDS=SSID,SECURITY,BARS
17
18#font
19FONT="Source Code Pro 12"