updated
This commit is contained in:
parent
d1f6270794
commit
9c46cb4d42
5 changed files with 106 additions and 21 deletions
|
@ -343,6 +343,10 @@ globalkeys = my_table.join(
|
|||
{description = "show rofi window menu", group = "hotkeys"}),
|
||||
awful.key({ modkey }, "w", function () awful.util.spawn("/home/drk/.shell-scripts/./rofi-wifi-menu.sh") end,
|
||||
{description = "show rofi wifi menu", group = "hotkeys"}),
|
||||
awful.key({ modkey, altkey }, "Delete", function () awful.util.spawn("/home/drk/.shell-scripts/./rofi-power-menu.sh") end,
|
||||
{description = "show rofi power menu", group = "hotkeys"}),
|
||||
awful.key({ modkey, altkey }, "Print", function () awful.util.spawn("/home/drk/.shell-scripts/./rofi-scrot-menu.sh") end,
|
||||
{description = "show rofi power menu", group = "hotkeys"}),
|
||||
|
||||
-- Keyboard Layouts
|
||||
awful.key({ modkey, "Shift" }, "e", function () awful.util.spawn("setxkbmap -layout es") end,
|
||||
|
@ -574,6 +578,8 @@ clientbuttons = gears.table.join(
|
|||
root.keys(globalkeys)
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
|
||||
* Rules
|
||||
Here are the rules, so basically here you can specify how you want Awesomewm to manage clients. I edited this to make sure that my master client always stays in its default position, for example in the master and stack layout or "tile layout", it wont matter how much apps i open, my main client will stay there in the main position. Also you can edit this to specify wich apps needs to open always in floating mode and a bunch of other things.
|
||||
#+begin_src lua
|
||||
|
|
|
@ -258,6 +258,10 @@ globalkeys = my_table.join(
|
|||
{description = "show rofi window menu", group = "hotkeys"}),
|
||||
awful.key({ modkey }, "w", function () awful.util.spawn("/home/drk/.shell-scripts/./rofi-wifi-menu.sh") end,
|
||||
{description = "show rofi wifi menu", group = "hotkeys"}),
|
||||
awful.key({ modkey, altkey }, "Delete", function () awful.util.spawn("/home/drk/.shell-scripts/./rofi-power-menu.sh") end,
|
||||
{description = "show rofi power menu", group = "hotkeys"}),
|
||||
awful.key({ modkey, altkey }, "Print", function () awful.util.spawn("/home/drk/.shell-scripts/./rofi-scrot-menu.sh") end,
|
||||
{description = "show rofi power menu", group = "hotkeys"}),
|
||||
|
||||
-- Keyboard Layouts
|
||||
awful.key({ modkey, "Shift" }, "e", function () awful.util.spawn("setxkbmap -layout es") end,
|
||||
|
|
24
shell-scripts/rofi-power-menu.sh
Executable file
24
shell-scripts/rofi-power-menu.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
option1=" lock"
|
||||
option2=" logout"
|
||||
option3=" reboot"
|
||||
option4=" power off"
|
||||
option5=" suspend"
|
||||
|
||||
options="$option1\n$option2\n$option3\n$option4\n$option5"
|
||||
|
||||
choice=$(echo -e "$options" | rofi -dmenu -i -no-show-icons -lines 5 -width 20 -p " ")
|
||||
|
||||
case $choice in
|
||||
$option1)
|
||||
betterlockscreen -l ;;
|
||||
$option2)
|
||||
killall awesome;;
|
||||
$option3)
|
||||
systemctl reboot ;;
|
||||
$option4)
|
||||
systemctl poweroff ;;
|
||||
$option5)
|
||||
systemctl suspend ;;
|
||||
esac
|
39
shell-scripts/rofi-scrot-menu.sh
Executable file
39
shell-scripts/rofi-scrot-menu.sh
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script requires scrot
|
||||
mkdir -p $HOME/Pictures/Scrot
|
||||
option1=" Entire screen"
|
||||
option2=" Entire screen with delay"
|
||||
option3=" Focused window"
|
||||
option4=" Select area"
|
||||
|
||||
options="$option1\n$option2\n$option3\n$option4"
|
||||
|
||||
choice=$(echo -e "$options" | rofi -i -dmenu -no-show-icons -no-sidebar-mode -lines 4 -width 20 -p " ")
|
||||
|
||||
case $choice in
|
||||
$option1)
|
||||
scrot -e 'mv $f ~/Pictures/Scrot/' && notify-send -a 'Scrot' 'Screenshot saved.' -i 'dialog-information' -t 2000 ;;
|
||||
$option2)
|
||||
delayoption1="Take screenshot with 3 sec delay"
|
||||
delayoption2="Take screenshot with 5 sec delay"
|
||||
delayoption3="Take screenshot with 10 sec delay"
|
||||
delayoptions="$delayoption1\n$delayoption2\n$delayoption3"
|
||||
delay=$(echo -e "$delayoptions" | rofi -i -dmenu -no-show-icons -no-sidebar-mode -lines 3 -width 20 -p " ")
|
||||
|
||||
case $delay in
|
||||
|
||||
$delayoption1)
|
||||
scrot -d 3 -e 'mv $f ~/Pictures/Scrot/' && notify-send -a 'Scrot' 'Screenshot saved.' -i 'dialog-information' -t 2000 ;;
|
||||
$delayoption2)
|
||||
scrot -d 5 -e 'mv $f ~/Pictures/Scrot/' && notify-send -a 'Scrot' 'Screenshot saved.' -i 'dialog-information' -t 2000 ;;
|
||||
$delayoption3)
|
||||
scrot -d 10 -e 'mv $f ~/Pictures/Scrot/' && notify-send -a 'Scrot' 'Screenshot saved.' -i 'dialog-information' -t 2000 ;;
|
||||
esac ;;
|
||||
|
||||
$option3)
|
||||
scrot -u -b -e 'mv $f ~/Pictures/Scrot/' && notify-send -a 'Scrot' 'Screenshot saved.' -i 'dialog-information' -t 2000 ;;
|
||||
$option4)
|
||||
scrot -s -e 'mv $f ~/Pictures/Scrot/' && notify-send -a 'Scrot' 'Screenshot saved.' -i 'dialog-information' -t 2000 ;;
|
||||
|
||||
esac
|
54
shell-scripts/rofi-wifi-menu.sh
Normal file → Executable file
54
shell-scripts/rofi-wifi-menu.sh
Normal file → Executable file
|
@ -1,38 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
notify-send "Getting list of available Wi-Fi networks..."
|
||||
nmcli -t d wifi rescan
|
||||
# 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")
|
||||
LIST=$(nmcli --fields SSID,SECURITY,BARS device wifi list | sed '/^--/d' | sed 1d | sed -E "s/WPA*.?\S/~~/g" | sed "s/~~ ~~/~~/g;s/802\.1X//g;s/--/~~/g;s/ *~/~/g;s/~ */~/g;s/_/ /g" | column -t -s '~')
|
||||
|
||||
connected=$(nmcli -fields WIFI g)
|
||||
if [[ "$connected" =~ "enabled" ]]; then
|
||||
toggle="睊 Disable Wi-Fi"
|
||||
elif [[ "$connected" =~ "disabled" ]]; then
|
||||
toggle="直 Enable Wi-Fi"
|
||||
# get current connection status
|
||||
CONSTATE=$(nmcli -fields WIFI g)
|
||||
if [[ "$CONSTATE" =~ "enabled" ]]; then
|
||||
TOGGLE="Disable WiFi 睊"
|
||||
elif [[ "$CONSTATE" =~ "disabled" ]]; then
|
||||
TOGGLE="Enable WiFi 直"
|
||||
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: " )
|
||||
CHENTRY=$(echo -e "$TOGGLE\n$LIST" | uniq -u | rofi -dmenu -selected-row 1 -p "Wi-Fi SSID: ")
|
||||
# Get name of connection
|
||||
chosen_id=$(echo "${chosen_network:3}" | xargs)
|
||||
CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $1}')
|
||||
|
||||
if [ "$chosen_network" = "" ]; then
|
||||
exit
|
||||
elif [ "$chosen_network" = "直 Enable Wi-Fi" ]; then
|
||||
if [ "$CHENTRY" = "" ]; then
|
||||
exit
|
||||
elif [ "$CHENTRY" = "Enable WiFi 直" ]; then
|
||||
nmcli radio wifi on
|
||||
elif [ "$chosen_network" = "睊 Disable Wi-Fi" ]; then
|
||||
elif [ "$CHENTRY" = "Disable WiFi 睊" ]; 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"
|
||||
# get list of known connections
|
||||
KNOWNCON=$(nmcli connection show)
|
||||
|
||||
# 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 [[ "$chosen_network" =~ "" ]]; then
|
||||
wifi_password=$(rofi -dmenu -p "Password: " )
|
||||
if [[ "$CHENTRY" =~ "" ]]; then
|
||||
WIFIPASS=$(echo " Press Enter if network is saved" | rofi -dmenu -p " WiFi Password: " -lines 1 )
|
||||
fi
|
||||
if nmcli dev wifi con "$CHSSID" password "$WIFIPASS"
|
||||
then
|
||||
notify-send 'Connection successful'
|
||||
else
|
||||
notify-send 'Connection failed'
|
||||
fi
|
||||
nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && notify-send "Connection Established" "$success_message"
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue