From 210acbc3e92993865bbd4f9c02d09248e5718204 Mon Sep 17 00:00:00 2001 From: stkhan Date: Wed, 5 May 2021 12:47:50 -0500 Subject: Rewrote ns script --- README.md | 12 ++++++++++++ bin/brighter | 2 +- bin/ns | 35 +++++++++++++++++++++++++++++++---- etc/ns.conf | 15 +++++++++++++++ install.sh | 3 ++- 5 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 etc/ns.conf diff --git a/README.md b/README.md index dbe8c85..e81af72 100644 --- a/README.md +++ b/README.md @@ -53,12 +53,24 @@ Alt+Shift+D = Volume goes down Alt+Shift+M = Toggles mute +Alt+Shift+Enter = Switches master window ### Exiting Alt+x = Closes app Alt+Shift+Q = Quits dwm +### Scripts + +## ns + +A script that starts a wireless network via wpa_supplicant and dhcpcd. + +### How to use: + +Create your wpa_supplicant configuration file, and get your wifi device (ip link). + +Edit /etc/ns.conf, place where your wpa_supplicant config is in the CONFIG var, and WiFi device in INTERFACE. ## Credits diff --git a/bin/brighter b/bin/brighter index b495a84..1dd5452 100755 --- a/bin/brighter +++ b/bin/brighter @@ -1,4 +1,4 @@ #!/bin/sh -sudo light -A 6 +sudo light -A 3 diff --git a/bin/ns b/bin/ns index 70b10a2..170afcd 100755 --- a/bin/ns +++ b/bin/ns @@ -1,5 +1,32 @@ -#!/bin/sh -# A simple script that starts wifi with wpa_supplicant and dhcpcd +#!/usr/bin/bash +source /etc/ns.conf + +case $1 in + + -k) + + killall wpa_supplicant + killall dhcpcd + ;; + -r) + killall wpa_supplicant + killall dhcpcd + + wpa_supplicant -c $CONFIG -B -i $INTERFACE + dhcpcd $INTERFACE + echo "Done" + ;; + -s) + wpa_supplicant -c $CONFIG -B -i $INTERFACE + dhcpcd $INTERFACE + ;; + *) + echo "ns" + echo + echo " -s: Starts the wifi" + echo " -r: Restarts wpa_supplicant and dhcpcd" + echo " -k: Kills the network" + echo + ;; +esac -wpa_supplicant -c/etc/wpa_supplicant.conf -B -i$1 -dhcpcd $1 diff --git a/etc/ns.conf b/etc/ns.conf new file mode 100644 index 0000000..47eb03c --- /dev/null +++ b/etc/ns.conf @@ -0,0 +1,15 @@ +# ns.conf +# +# Don't remove from /etc or bad things will happen +# +# The interface var is the WiFi device name, wlan0 or wlp3s0 ex. +# +# INTERFACE="wlan0" +# +# +# The config var is your wpa_supplicant config file, usually located in /etc +# +# CONFIG="/etc/wpa_supplicant.conf" + +INTERFACE="wlan0" +CONFIG="wlp3s0" diff --git a/install.sh b/install.sh index 1b7ca09..1153c4c 100755 --- a/install.sh +++ b/install.sh @@ -15,12 +15,13 @@ clear theme="$(cat /tmp/.theme_sel)" echo "Your theme is $theme" - sudo pacman -Sy --needed webkit2gtk dialog wpa_supplicant iw dhcpcd adobe-source-code-pro-fonts falkon libnotify xorg xorg-xinit light picom feh dunst pulseaudio + sudo pacman -Sy --needed webkit2gtk dialog bash wpa_supplicant iw dhcpcd adobe-source-code-pro-fonts falkon libnotify xorg xorg-xinit light picom feh dunst pulseaudio echo "Setting up config folders" mkdir -p ~/.config/sarc cp * ~/.config/sarc/ cd ~/.config/sarc/ + sudo cp /etc/ns.conf /etc/ cd $dwm cp ./themes/$theme ./config.h -- cgit v1.2.3