Initial commit
This commit is contained in:
95
.config/rofi/config
Normal file
95
.config/rofi/config
Normal file
@@ -0,0 +1,95 @@
|
||||
// vi: ft=css
|
||||
|
||||
configuration {
|
||||
modi: "window,drun";
|
||||
matching: "glob";
|
||||
drun-match-fields: "all";
|
||||
/*display-drun: "Apps";*/
|
||||
/*display-window: "Window";*/
|
||||
show-icons: true;
|
||||
|
||||
// continous scrolling
|
||||
scroll-method: 1;
|
||||
}
|
||||
|
||||
* {
|
||||
lines: 5;
|
||||
columns: 1;
|
||||
background-color: #00000090;
|
||||
// background-color: #00000065;
|
||||
border-color: #00000000;
|
||||
text-color: #EFEFEF;
|
||||
font: "Hack 20";
|
||||
}
|
||||
|
||||
#window {
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
padding: 30;
|
||||
width: 40%;
|
||||
height: 60%;
|
||||
}
|
||||
|
||||
#scrollbar {
|
||||
handle-color: #00a0e6;
|
||||
border-color: #00a0e6;
|
||||
}
|
||||
|
||||
#mainbox {
|
||||
background-color: #00000000;
|
||||
children: [inputbar, listview];
|
||||
spacing: 10px;
|
||||
/*margin: 20%;*/
|
||||
padding: 7px 0;
|
||||
border: 1px;
|
||||
border-color: @base0D;
|
||||
}
|
||||
|
||||
|
||||
#listview {
|
||||
background-color: #00000000;
|
||||
fixed-height: 0;
|
||||
border: 0px;
|
||||
spacing: 5px;
|
||||
scrollbar: true;
|
||||
padding: 10px 10px 0px;
|
||||
}
|
||||
|
||||
#element {
|
||||
background-color: #00000000;
|
||||
border: 0;
|
||||
border-radius: 15px;
|
||||
padding: 3 0 3 4 ;
|
||||
}
|
||||
|
||||
#element selected {
|
||||
background-color: #00a0e6;
|
||||
text-color: #EFEFEF;
|
||||
}
|
||||
|
||||
|
||||
#inputbar {
|
||||
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
|
||||
background-color: #00000000;
|
||||
}
|
||||
|
||||
#case-indicator {
|
||||
background-color: #00000000;
|
||||
spacing: 0;
|
||||
}
|
||||
#entry {
|
||||
background-color: #00000000;
|
||||
spacing: 0;
|
||||
}
|
||||
#prompt {
|
||||
background-color: #00000000;
|
||||
spacing: 0;
|
||||
}
|
||||
|
||||
#textbox-prompt-colon {
|
||||
background-color: #00000000;
|
||||
expand: false;
|
||||
str: ":";
|
||||
margin: 0px 0.3em 0em 0em ;
|
||||
}
|
||||
|
||||
95
.config/rofi/config.rasi
Normal file
95
.config/rofi/config.rasi
Normal file
@@ -0,0 +1,95 @@
|
||||
// vi: ft=css
|
||||
|
||||
configuration {
|
||||
modi: "window,drun";
|
||||
matching: "glob";
|
||||
drun-match-fields: "all";
|
||||
/*display-drun: "Apps";*/
|
||||
/*display-window: "Window";*/
|
||||
show-icons: true;
|
||||
|
||||
// continous scrolling
|
||||
scroll-method: 1;
|
||||
}
|
||||
|
||||
* {
|
||||
lines: 5;
|
||||
columns: 1;
|
||||
background-color: #00000090;
|
||||
// background-color: #00000065;
|
||||
border-color: #00000000;
|
||||
text-color: #EFEFEF;
|
||||
font: "Hack 20";
|
||||
}
|
||||
|
||||
#window {
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
padding: 30;
|
||||
width: 40%;
|
||||
height: 60%;
|
||||
}
|
||||
|
||||
#scrollbar {
|
||||
handle-color: #00a0e6;
|
||||
border-color: #00a0e6;
|
||||
}
|
||||
|
||||
#mainbox {
|
||||
background-color: #00000000;
|
||||
children: [inputbar, listview];
|
||||
spacing: 10px;
|
||||
/*margin: 20%;*/
|
||||
padding: 7px 0;
|
||||
border: 1px;
|
||||
border-color: @base0D;
|
||||
}
|
||||
|
||||
|
||||
#listview {
|
||||
background-color: #00000000;
|
||||
fixed-height: 0;
|
||||
border: 0px;
|
||||
spacing: 5px;
|
||||
scrollbar: true;
|
||||
padding: 10px 10px 0px;
|
||||
}
|
||||
|
||||
#element {
|
||||
background-color: #00000000;
|
||||
border: 0;
|
||||
border-radius: 15px;
|
||||
padding: 3 0 3 4 ;
|
||||
}
|
||||
|
||||
#element selected {
|
||||
background-color: #00a0e6;
|
||||
text-color: #EFEFEF;
|
||||
}
|
||||
|
||||
|
||||
#inputbar {
|
||||
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
|
||||
background-color: #00000000;
|
||||
}
|
||||
|
||||
#case-indicator {
|
||||
background-color: #00000000;
|
||||
spacing: 0;
|
||||
}
|
||||
#entry {
|
||||
background-color: #00000000;
|
||||
spacing: 0;
|
||||
}
|
||||
#prompt {
|
||||
background-color: #00000000;
|
||||
spacing: 0;
|
||||
}
|
||||
|
||||
#textbox-prompt-colon {
|
||||
background-color: #00000000;
|
||||
expand: false;
|
||||
str: ":";
|
||||
margin: 0px 0.3em 0em 0em ;
|
||||
}
|
||||
|
||||
52
.config/rofi/powermenu.sh
Executable file
52
.config/rofi/powermenu.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
# Inspired by https://github.com/cramermarius/rofi-menus/blob/master/scripts/powermenu.sh
|
||||
|
||||
# entries with associated commands
|
||||
declare -A entries
|
||||
entries=( [lock]="xset s activate"
|
||||
[logout]="i3-msg exit"
|
||||
[reboot]="systemctl reboot"
|
||||
[shutdown]="systemctl poweroff"
|
||||
[suspend]="systemctl suspend"
|
||||
[suspend (scheduled)]="scheduled_suspend")
|
||||
|
||||
declare -a rofi_args
|
||||
rofi_args=( -no-config
|
||||
-theme /usr/share/rofi/themes/android_notification.rasi
|
||||
-lines ${#entries[@]}
|
||||
-width 12
|
||||
-location 3
|
||||
-yoffset 32
|
||||
-dmenu
|
||||
-no-case-sensitive
|
||||
-p) # has to end with -p!
|
||||
|
||||
function scheduled_suspend {
|
||||
declare -i min=0
|
||||
min=$(rofi "${rofi_args[@]}" "minutes: ")
|
||||
|
||||
# make sure the input was a valid number
|
||||
# side effect: 0 minutes is not possible
|
||||
[ "$min" -ne 0 ] || exit 1
|
||||
|
||||
notify-send "suspend in" "$min minutes"
|
||||
sleep $((min*60)) && systemctl suspend
|
||||
}
|
||||
|
||||
# Choose option over rofi
|
||||
# Note: bash does not keep the order of the keys thus they get sorted
|
||||
chosen="$(printf '%s\n' "${!entries[@]}" | sort | rofi "${rofi_args[@]}" "power: ")"
|
||||
# exit if nothing was selected
|
||||
[ -n "$chosen" ] || exit 1
|
||||
# handle scheduled suspend different
|
||||
[ "$chosen" != "suspend (scheduled)" ] || { ${entries[$chosen]}; exit $?; }
|
||||
|
||||
# Confirm choice
|
||||
yesNo="$(echo -e "yes\nno" | rofi "${rofi_args[@]}" "Are you sure you want to ${chosen}? ")"
|
||||
|
||||
# Exit if "No"
|
||||
[ "$yesNo" == "yes" ] || exit 1
|
||||
|
||||
# Execute
|
||||
${entries[$chosen]}
|
||||
|
||||
101
.config/rofi/rofi-wifi-menu.sh
Normal file
101
.config/rofi/rofi-wifi-menu.sh
Normal file
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env bash
|
||||
# from https://github.com/zbaylin/rofi-wifi-menu/blob/master/rofi-wifi-menu.sh
|
||||
|
||||
# Starts a scan of available broadcasting SSIDs
|
||||
# nmcli dev wifi rescan
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
FIELDS=SSID,SECURITY
|
||||
POSITION=0
|
||||
YOFF=0
|
||||
XOFF=0
|
||||
FONT="DejaVu Sans Mono 8"
|
||||
|
||||
# if [ -r "$DIR/config" ]; then
|
||||
# source "$DIR/config"
|
||||
# elif [ -r "$HOME/.config/rofi/wifi" ]; then
|
||||
# source "$HOME/.config/rofi/wifi"
|
||||
# else
|
||||
# echo "WARNING: config file not found! Using default values."
|
||||
# fi
|
||||
|
||||
LIST=$(nmcli --fields "$FIELDS" device wifi list | sed '/^--/d')
|
||||
# For some reason rofi always approximates character width 2 short... hmmm
|
||||
RWIDTH=$(($(echo "$LIST" | head -n 1 | awk '{print length($0); }')+2))
|
||||
# Dynamically change the height of the rofi menu
|
||||
LINENUM=$(echo "$LIST" | wc -l)
|
||||
# Gives a list of known connections so we can parse it later
|
||||
KNOWNCON=$(nmcli connection show)
|
||||
# Really janky way of telling if there is currently a connection
|
||||
CONSTATE=$(nmcli -fields WIFI g)
|
||||
|
||||
CURRSSID=$(LANGUAGE=C nmcli -t -f active,ssid dev wifi | awk -F: '$1 ~ /^yes/ {print $2}')
|
||||
|
||||
if [[ ! -z $CURRSSID ]]; then
|
||||
HIGHLINE=$(echo "$(echo "$LIST" | awk -F "[ ]{2,}" '{print $1}' | grep -Fxn -m 1 "$CURRSSID" | awk -F ":" '{print $1}') + 1" | bc )
|
||||
fi
|
||||
|
||||
# HOPEFULLY you won't need this as often as I do
|
||||
# If there are more than 8 SSIDs, the menu will still only have 8 lines
|
||||
if [ "$LINENUM" -gt 8 ] && [[ "$CONSTATE" =~ "enabled" ]]; then
|
||||
LINENUM=8
|
||||
elif [[ "$CONSTATE" =~ "disabled" ]]; then
|
||||
LINENUM=1
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$CONSTATE" =~ "enabled" ]]; then
|
||||
TOGGLE="toggle off"
|
||||
elif [[ "$CONSTATE" =~ "disabled" ]]; then
|
||||
TOGGLE="toggle on"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
CHENTRY=$(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")
|
||||
#echo "$CHENTRY"
|
||||
CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $1}')
|
||||
#echo "$CHSSID"
|
||||
|
||||
# If the user inputs "manual" as their SSID in the start window, it will bring them to this screen
|
||||
if [ "$CHENTRY" = "manual" ] ; then
|
||||
# Manual entry of the SSID and password (if appplicable)
|
||||
MSSID=$(echo "enter the SSID of the network (SSID,password)" | rofi -dmenu -p "Manual Entry: " -font "$FONT" -lines 1)
|
||||
# Separating the password from the entered string
|
||||
MPASS=$(echo "$MSSID" | awk -F "," '{print $2}')
|
||||
|
||||
#echo "$MSSID"
|
||||
#echo "$MPASS"
|
||||
|
||||
# If the user entered a manual password, then use the password nmcli command
|
||||
if [ "$MPASS" = "" ]; then
|
||||
nmcli dev wifi con "$MSSID"
|
||||
else
|
||||
nmcli dev wifi con "$MSSID" password "$MPASS"
|
||||
fi
|
||||
|
||||
elif [ "$CHENTRY" = "toggle on" ]; then
|
||||
nmcli radio wifi on
|
||||
|
||||
elif [ "$CHENTRY" = "toggle off" ]; then
|
||||
nmcli radio wifi off
|
||||
|
||||
else
|
||||
|
||||
# If the connection is already in use, then this will still be able to get the SSID
|
||||
if [ "$CHSSID" = "*" ]; then
|
||||
CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $3}')
|
||||
fi
|
||||
|
||||
# Parses the list of preconfigured connections to see if it already contains the chosen SSID. This speeds up the connection process
|
||||
if [[ $(echo "$KNOWNCON" | grep "$CHSSID") = "$CHSSID" ]]; then
|
||||
nmcli con up "$CHSSID"
|
||||
else
|
||||
if [[ "$CHENTRY" =~ "WPA2" ]] || [[ "$CHENTRY" =~ "WEP" ]]; then
|
||||
WIFIPASS=$(echo "if connection is stored, hit enter" | rofi -dmenu -p "password: " -lines 1 -font "$FONT" )
|
||||
fi
|
||||
nmcli dev wifi con "$CHSSID" password "$WIFIPASS"
|
||||
fi
|
||||
|
||||
fi
|
||||
Reference in New Issue
Block a user