From 6edc41d678393cc38d64e54dcd4d7f1b2187afac Mon Sep 17 00:00:00 2001 From: Harri Lahtinen Date: Thu, 18 Jul 2019 13:59:39 +0300 Subject: [PATCH] lot of stuff --- .Xresources | 34 +-- .config/Scripts/rofi-bangs.sh | 4 + .config/Scripts/rofi-wifi-menu.sh | 100 +++++++ .config/compton.conf | 37 +-- .config/i3/config | 4 +- .config/nvim/init.vim | 5 +- .config/polybar/config | 92 ++++-- .config/rofi/wifi | 19 ++ .tmux.conf | 2 +- ...{old_install_arch.txt => install_arch.txt} | 0 addons/pkglist.txt | 274 ++++++++++++++++++ addons/update-resolv-conf | 71 +++++ 12 files changed, 582 insertions(+), 60 deletions(-) create mode 100755 .config/Scripts/rofi-wifi-menu.sh create mode 100755 .config/rofi/wifi rename addons/{old_install_arch.txt => install_arch.txt} (100%) create mode 100644 addons/pkglist.txt create mode 100755 addons/update-resolv-conf diff --git a/.Xresources b/.Xresources index fc23f83..bae63c6 100644 --- a/.Xresources +++ b/.Xresources @@ -5,23 +5,23 @@ *.foreground: white *.cursorColor: white -/* !! gruvbox: */ -/* *.color0: #1d2021 */ -/* *.color1: #cc241d */ -/* *.color2: #98971a */ -/* *.color3: #d79921 */ -/* *.color4: #458588 */ -/* *.color5: #b16286 */ -/* *.color6: #689d6a */ -/* *.color7: #a89984 */ -/* *.color8: #928374 */ -/* *.color9: #fb4934 */ -/* *.color10: #b8bb26 */ -/* *.color11: #fabd2f */ -/* *.color12: #83a598 */ -/* *.color13: #d3869b */ -/* *.color14: #8ec07c */ -/* *.color15: #ebdbb2 */ +!/* !! gruvbox: */ +!/* *.color0: #1d2021 */ +!/* *.color1: #cc241d */ +!/* *.color2: #98971a */ +!/* *.color3: #d79921 */ +!/* *.color4: #458588 */ +!/* *.color5: #b16286 */ +!/* *.color6: #689d6a */ +!/* *.color7: #a89984 */ +!/* *.color8: #928374 */ +!/* *.color9: #fb4934 */ +!/* *.color10: #b8bb26 */ +!/* *.color11: #fabd2f */ +!/* *.color12: #83a598 */ +!/* *.color13: #d3869b */ +!/* *.color14: #8ec07c */ +!/* *.color15: #ebdbb2 */ !! Transparency (0-1): st.alpha: 0.9 diff --git a/.config/Scripts/rofi-bangs.sh b/.config/Scripts/rofi-bangs.sh index 31f42ff..27de081 100755 --- a/.config/Scripts/rofi-bangs.sh +++ b/.config/Scripts/rofi-bangs.sh @@ -58,6 +58,10 @@ LABELS["websearch"]="" COMMANDS["workspace"]="~/.config/Scripts/i3_switch_workspace.sh" LABELS["workspace"]="" +# wifi-menu +COMMANDS["wifi-menu"]="~/.config/Scripts/rofi-wifi-menu.sh" +LABELS["wifi-menu"]="" + # show clipboard history # source: https://github.com/erebe/greenclip #COMMANDS["clipboard"]='rofi -modi "clipboard:greenclip print" -show clipboard' diff --git a/.config/Scripts/rofi-wifi-menu.sh b/.config/Scripts/rofi-wifi-menu.sh new file mode 100755 index 0000000..c70b3f0 --- /dev/null +++ b/.config/Scripts/rofi-wifi-menu.sh @@ -0,0 +1,100 @@ +#!/usr/bin/env bash + +# 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 diff --git a/.config/compton.conf b/.config/compton.conf index d0f1eb1..996b960 100644 --- a/.config/compton.conf +++ b/.config/compton.conf @@ -62,11 +62,11 @@ no-dock-shadow = true; # Zero the part of the shadow's mask behind the window. Fix some weirdness with ARGB windows. clear-shadow = true; # The blur radius for shadows. (default 12) -shadow-radius = 10; +shadow-radius = 7; # The left offset for shadows. (default -15) -shadow-offset-x = -10; +shadow-offset-x = -7; # The top offset for shadows. (default -15) -shadow-offset-y = -10; +shadow-offset-y = -7; # The translucency for shadows. (default .75) shadow-opacity = 0.5; @@ -84,11 +84,13 @@ shadow-exclude = [ "name *= 'Chrome'", "class_g ?= 'Notify-osd'", "name *= 'Firefox'", + "name = 'Polybar'", + "class_g = 'rofi'", "_GTK_FRAME_EXTENTS@:c", - #"class_g = 'i3-frame'", + "class_g = 'i3-frame'", "_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'", - "_NET_WM_STATE@:32a *= '_NET_WM_STATE_STICKY'" - #"!I3_FLOATING_WINDOW@:c" + "_NET_WM_STATE@:32a *= '_NET_WM_STATE_STICKY'", + "!I3_FLOATING_WINDOW@:c" ]; # Avoid drawing shadow on all shaped windows (see also: --detect-rounded-corners) shadow-ignore-shaped = false; @@ -111,16 +113,15 @@ blur-method = "kawase"; blur-strength = 15; opacity-rule = [ - "80:class_g = 'St' && focused", + "85:class_g = 'St' && focused", "60:class_g = 'St' && !focused", - "70:class_g = 'Code'", - "70:class_g = 'code-oss'" + "70:name *?= 'rofi'" ]; # Dim inactive windows. (0.0 - 1.0) -# inactive-dim = 0.2; +inactive-dim = 0.2; # Do not let dimness adjust based on window opacity. -# inactive-dim-fixed = true; +inactive-dim-fixed = true; # Blur background of transparent windows. Bad performance with X Render backend. GLX backend is preferred. blur-background = true; # Blur background of opaque windows with transparent frames as well. @@ -128,13 +129,14 @@ blur-background-frame = true; # Do not let blur radius adjust based on window opacity. blur-background-fixed = true; blur-background-exclude = [ -# "window_type = 'dock'", + "window_type = 'dock'", "window_type = 'desktop'", "name *= 'Chromium'", "name *= 'Chrome'", "name *= 'Firefox'", - "class_g = 'Synapse'", + "name = 'Polybar'", "class_g ?= 'Notify-osd'", + "class_g = 'mpv'", "_GTK_FRAME_EXTENTS@:c" ]; @@ -153,10 +155,11 @@ fade-in-step = 0.03; # Opacity change between steps while fading out. (default 0.03). fade-out-step = 0.03; # Fade windows in/out when opening/closing -# no-fading-openclose = true; +no-fading-openclose = false; # Specify a list of conditions of windows that should not be faded. -fade-exclude = [ ]; +fade-exclude = [ +]; ################################# # @@ -202,12 +205,12 @@ paint-on-overlay = true; # Limit compton to repaint at most once every 1 / refresh_rate second to boost performance. # This should not be used with --vsync drm/opengl/opengl-oml as they essentially does --sw-opti's job already, # unless you wish to specify a lower refresh rate than the actual value. -sw-opti = true; +sw-opti = false; # Unredirect all windows if a full-screen opaque window is detected, to maximize performance for full-screen windows, like games. # Known to cause flickering when redirecting/unredirecting windows. # paint-on-overlay may make the flickering less obvious. -unredir-if-possible = false; +unredir-if-possible = true; # Specify a list of conditions of windows that should always be considered focused. focus-exclude = [ ]; diff --git a/.config/i3/config b/.config/i3/config index aa98863..353f838 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -53,9 +53,9 @@ client.background $black ###---Starting External Scripts---### #Load .Xresources -exec --no-stsrtup-id xrdb -merge .Xresources +exec --no-startup-id xrdb -merge .Xresources #Restore wal colors -#exec --no-startup-id wal -R & +#exec_always --no-startup-id wal -i "$(< "${HOME}/.cache/wal/wal")" #Start mopidy #exec --no-startup-id mopidy & #Twmn diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index accb0db..f1bcf24 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -11,7 +11,9 @@ set autoindent " indent a new line the same amount as the line just set number " add line numbers set wildmode=longest,list " get bash-like tab completions set autoread " refresh file -set termguicolors +if (has("termguicolors")) + set termguicolors +endif syntax on " set the runtime path to include Vundle and initialize @@ -26,6 +28,7 @@ call plug#begin('~/.local/share/nvim/site/autoload') Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'dylanaraps/wal' +Plug 'PotatoesMaster/i3-vim-syntax' Plug 'Xuyuanp/nerdtree-git-plugin' Plug 'mhinz/vim-startify' Plug 'tpope/vim-fugitive' diff --git a/.config/polybar/config b/.config/polybar/config index d74d5bc..1c7ab3d 100644 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -5,14 +5,14 @@ ; [colors] ;Transparent background -background = #00FFFFFF +background = #00000000 ;background = ${xrdb:color12:#AD9161} ;background = #8a8061 -background-alt = ${xrdb:color2:#7B8349} +background-alt = #061E28 ;foreground = ${xrdb:color7} -foreground = #bdaf97 -foreground-alt = #264D4C -highlight = #1B4446 +foreground = #6C6044 +foreground-alt = #6C6044 +highlight = #bdaf97 ;error = ${xrdb:color9:#DD712E} error = #1B4446 red = #1B4446 @@ -62,7 +62,7 @@ format-muted-foreground = ${colors.highlight} label-muted =  muted ramp-volume-0 =  ramp-volume-1 =  -ramp-volume-foreground = ${colors.foreground-alt} +ramp-volume-foreground = ${colors.foreground} ramp-headphones-0 =  ramp-headphones-1 =  @@ -73,7 +73,7 @@ exec = ~/.config/Scripts/backlight.sh scroll-up = exec light -A 5 scroll-down = exec light -U 5 format-prefix = " " -format-prefix-foreground = ${colors.foreground-alt} +format-prefix-foreground = ${colors.foreground} label = %output% label-foreground = ${colors.foreground} format-padding = 1 @@ -112,7 +112,7 @@ interval = 256 format = "