From e5532752993f463524e0c89d5e82b5a84a77759b Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Mon, 3 Feb 2020 00:01:16 +0300 Subject: load gtk settings on sway start, vpn shortcut and waybar indicator --- dotfiles/.config/ranger/rc.conf | 4 ++-- dotfiles/.config/sway/config | 13 +++++++++++-- dotfiles/.config/waybar/config | 15 ++++++++++++--- dotfiles/.config/waybar/style.css | 3 ++- dotfiles/.local/bin/barrecstatus | 8 ++++++++ dotfiles/.local/bin/barvpnstatus | 9 +++++++++ dotfiles/.local/bin/barweather | 18 ++++++++++++++++++ dotfiles/.local/bin/i3barmusic | 18 ------------------ dotfiles/.local/bin/i3barrecstatus | 8 -------- dotfiles/.local/bin/i3barweather | 18 ------------------ dotfiles/.local/bin/swayrecord | 8 ++++---- dotfiles/.local/bin/swaystart | 12 ------------ dotfiles/.local/bin/togglevpn | 16 ++++++++++++++++ dotfiles/.profile | 5 +++-- install.sh | 4 +++- system/NetworkManager/NetworkManager.conf | 4 ++++ system/resolv.conf | 2 ++ system/sudoers | 8 ++++---- 18 files changed, 98 insertions(+), 75 deletions(-) create mode 100755 dotfiles/.local/bin/barrecstatus create mode 100755 dotfiles/.local/bin/barvpnstatus create mode 100755 dotfiles/.local/bin/barweather delete mode 100755 dotfiles/.local/bin/i3barmusic delete mode 100755 dotfiles/.local/bin/i3barrecstatus delete mode 100755 dotfiles/.local/bin/i3barweather delete mode 100755 dotfiles/.local/bin/swaystart create mode 100755 dotfiles/.local/bin/togglevpn create mode 100644 system/NetworkManager/NetworkManager.conf create mode 100644 system/resolv.conf diff --git a/dotfiles/.config/ranger/rc.conf b/dotfiles/.config/ranger/rc.conf index 5a56a0e..e775dfb 100644 --- a/dotfiles/.config/ranger/rc.conf +++ b/dotfiles/.config/ranger/rc.conf @@ -441,7 +441,7 @@ map om cd ~/Music map opp cd ~/Pictures map opw cd ~/Pictures/wallpapers map ops cd ~/Pictures/screenshots -map ovv cd ~/Video +map ovv cd ~/Videos map or cd ~/Repositories map os cd ~/.local/bin map ocf cd ~/.config @@ -456,7 +456,7 @@ map Omm tab_new ~/Music map Opp tab_new ~/Pictures map Opw tab_new ~/Pictures/wallpapers map Ops tab_new ~/Pictures/screenshots -map Ovv tab_new ~/Video +map Ovv tab_new ~/Videos map Or tab_new ~/Repositories map Os tab_new ~/.local/bin map Ocf tab_new ~/.config diff --git a/dotfiles/.config/sway/config b/dotfiles/.config/sway/config index 1cf4d43..94b0de9 100644 --- a/dotfiles/.config/sway/config +++ b/dotfiles/.config/sway/config @@ -24,6 +24,12 @@ font pango:BlexMono Nerd Font Mono 10 # Use Mouse+$mod to drag floating windows floating_modifier $mod +# GTK theme and icons +set $gnome-schema org.gnome.desktop.interface +exec_always { + gsettings set $gnome-schema gtk-theme 'oomox-materia-dark' + gsettings set $gnome-schema icon-theme 'Papirus-Dark' +} ##### Startup scripts and programs ##### # Waybar @@ -31,7 +37,6 @@ exec --no-startup-id waybar_launch # KDE Connect exec --no-startup-id kdeconnect-indicator # music daemon -# exec_always --no-startup-id ~/.scripts/mopidy_launch exec --no-startup-id mpd # Bluetooth adapter applet exec_always --no-startup-id blueman-applet @@ -113,7 +118,7 @@ input 2:10:TPPS/2_IBM_TrackPoint pointer_accel 1 # Outputs output "*" background ~/.config/wall1.png fill # Laptop display -output "eDP-1" scale 1.53 pos 0 0 +output "eDP-1" scale 1.6 pos 0 0 scale_filter smart # Keymaps input * xkb_layout "us,es,ru" @@ -186,6 +191,10 @@ bindsym --to-code { $mod+grave exec --no-startup-id menuducksearch $mod+Shift+grave exec --no-startup-id menuemoji $mod+F1 exec --no-startup-id zathura ~/.config/i3/i3guide.pdf + + # Network management + $mod+Shift+c exec togglevpn + # Network management $mod+Shift+n exec $term -e 'nmtui' # Screenshot and recording diff --git a/dotfiles/.config/waybar/config b/dotfiles/.config/waybar/config index c543e94..a0aa3a6 100644 --- a/dotfiles/.config/waybar/config +++ b/dotfiles/.config/waybar/config @@ -14,8 +14,10 @@ "custom/weather" ], "modules-right": [ + "custom/rec-status", "custom/swaykbd", "backlight", + "custom/vpn-status", "network", "battery#bat0", "battery#bat1", @@ -159,14 +161,21 @@ "on-click": "termite -e ncpamixer" }, "custom/rec-status": { - "format": "{}", + "format": "{}", "signal": 5, - "exec": "i3barrecstatus" + "interval": "once", + "exec": "barrecstatus" + }, + "custom/vpn-status": { + "format": "{}", + "signal": 6, + "interval": "once", + "exec": "barvpnstatus" }, "custom/weather": { "format": "{}", "interval": 900, - "exec": "i3barweather" + "exec": "barweather" }, "custom/swaykbd": { "format": " {}", diff --git a/dotfiles/.config/waybar/style.css b/dotfiles/.config/waybar/style.css index 44bae1e..e066c6a 100644 --- a/dotfiles/.config/waybar/style.css +++ b/dotfiles/.config/waybar/style.css @@ -63,8 +63,9 @@ window#waybar { #temperature, #custom-weather, #custom-rec-status, +#custom-vpn-status, #custom-swaykbd { - padding: 0 8px; + padding: 0 6px; } #custom-weather { color: #5b8277; diff --git a/dotfiles/.local/bin/barrecstatus b/dotfiles/.local/bin/barrecstatus new file mode 100755 index 0000000..b7bb8b4 --- /dev/null +++ b/dotfiles/.local/bin/barrecstatus @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ -f "$HOME/.cache/recordingpid" ]; then + printf "⏺ rec" + exit +fi + +printf "" diff --git a/dotfiles/.local/bin/barvpnstatus b/dotfiles/.local/bin/barvpnstatus new file mode 100755 index 0000000..1af57c4 --- /dev/null +++ b/dotfiles/.local/bin/barvpnstatus @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ -f "$HOME/.cache/openvpnpid" ]; then + printf "🔐 vpn" + exit +fi + +printf "" + diff --git a/dotfiles/.local/bin/barweather b/dotfiles/.local/bin/barweather new file mode 100755 index 0000000..0ae6d3c --- /dev/null +++ b/dotfiles/.local/bin/barweather @@ -0,0 +1,18 @@ +#!/bin/bash + +location="Saint Petersburg" + +if [[ "$location" != "" ]] +then + location="~${location// /+}" +fi + +forecast=$(curl -s wttr.in/$location?format=1) + +if [[ ${#forecast} -gt 30 ]] +then + exit +fi + +echo $forecast + diff --git a/dotfiles/.local/bin/i3barmusic b/dotfiles/.local/bin/i3barmusic deleted file mode 100755 index 5647a81..0000000 --- a/dotfiles/.local/bin/i3barmusic +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -filter() { - sed "/^volume:/d" | tac | sed -e "s/\\&/&/g;s/\\[paused\\].*//g;s/\\[playing\\].*//g" | tr -d '\n' | sed -e "s/$/<\\/span>/g" - } - -case $BLOCK_BUTTON in - 1) mpc toggle | filter ;; - 2) mpc status | filter && setsid "$TERMINAL" -e ncmpcpp & ;; - 3) mpc status | filter && notify-send "🎵 Music module" "\- Shows mpd song playing. -- Italic when paused. -- Left click opens ncmpcpp. -- Middle click pauses. -- Scroll changes track.";; # right click, pause/unpause - 4) mpc prev | filter ;; # scroll up, previous - 5) mpc next | filter ;; # scroll down, next - *) mpc status | filter ;; -esac; exit diff --git a/dotfiles/.local/bin/i3barrecstatus b/dotfiles/.local/bin/i3barrecstatus deleted file mode 100755 index 5c8160a..0000000 --- a/dotfiles/.local/bin/i3barrecstatus +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ -f "$HOME/.recordingpid" ]; then - printf "rec ⏺" - exit -fi - -printf "" diff --git a/dotfiles/.local/bin/i3barweather b/dotfiles/.local/bin/i3barweather deleted file mode 100755 index 0ae6d3c..0000000 --- a/dotfiles/.local/bin/i3barweather +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -location="Saint Petersburg" - -if [[ "$location" != "" ]] -then - location="~${location// /+}" -fi - -forecast=$(curl -s wttr.in/$location?format=1) - -if [[ ${#forecast} -gt 30 ]] -then - exit -fi - -echo $forecast - diff --git a/dotfiles/.local/bin/swayrecord b/dotfiles/.local/bin/swayrecord index 90ed24a..378b46f 100755 --- a/dotfiles/.local/bin/swayrecord +++ b/dotfiles/.local/bin/swayrecord @@ -1,14 +1,14 @@ #!/bin/sh -if [ -f "$HOME/.recordingpid" ]; then +if [ -f "$HOME/.cache/recordingpid" ]; then killall -SIGINT wf-recorder - rm -f ~/.recordingpid + rm -f ~/.cache/recordingpid notify-send "⏺ Screen recording" "Recording stopped" killall -39 waybar exit fi -wf-recorder -f "$HOME/Video/recordings/$(date '+%y%m%d-%H%M-%S').mp4" & -echo $! > ~/.recordingpid +wf-recorder -f "$HOME/Videos/recordings/$(date '+%y%m%d-%H%M-%S').mp4" & +echo $! > ~/.cache/recordingpid notify-send "⏺ Screen recording" "Recording started" killall -39 waybar diff --git a/dotfiles/.local/bin/swaystart b/dotfiles/.local/bin/swaystart deleted file mode 100755 index 46f6f0e..0000000 --- a/dotfiles/.local/bin/swaystart +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -export SCROT_DIR=$HOME/Pictures/screenshots/ -export GDK_BACKEND=wayland -export EGL_PLATFORM=wayland -export CLUTTER_PLATFORM=wayland -export SDL_VIDEODRIVER=wayland -export QT_QPA_PLATFORM=wayland-egl -export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 -export QT_QPA_PLATFORMTHEME="qt5ct" -export _JAVA_AWT_WM_NONREPARENTING=1 -sway --my-next-gpu-wont-be-nvidia diff --git a/dotfiles/.local/bin/togglevpn b/dotfiles/.local/bin/togglevpn new file mode 100755 index 0000000..f1a6bdb --- /dev/null +++ b/dotfiles/.local/bin/togglevpn @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ -f "$HOME/.cache/openvpnpid" ]; then + sudo killall -SIGINT openvpn + exit +fi + +sudo openvpn "$HOME/.config/ovpn/conf.ovpn" & +PID=$! +notify-send "🔐 OpenVPN" "VPN is being initialized" +echo $PID > ~/.cache/openvpnpid +killall -40 waybar +wait $PID +notify-send "🔐 OpenVPN" "VPN service has stopped with exit code $?" +rm ~/.cache/openvpnpid +killall -40 waybar diff --git a/dotfiles/.profile b/dotfiles/.profile index 28465da..5e37a2f 100644 --- a/dotfiles/.profile +++ b/dotfiles/.profile @@ -1,6 +1,6 @@ export PATH=$PATH:$HOME/.local/bin export SCROT_DIR=$HOME/Pictures/screenshots/ -export GDK_BACKEND=wayland +#export GDK_BACKEND=wayland export EGL_PLATFORM=wayland export CLUTTER_PLATFORM=wayland export SDL_VIDEODRIVER=wayland @@ -16,8 +16,9 @@ export TERMINAL=termite export EDITOR="nvim" export BROWSER=qutebrowser export ZDOTDIR="$HOME/.config/zsh" +export INPUTRC="$HOME/.config/zsh/inputrc" if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then - .scripts/swaystart + sway fi diff --git a/install.sh b/install.sh index b34fc8e..8799eee 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ # Install needed programs -pacman -Sy --noconfirm networkmanager networkmanager-openvpn neovim sway swaylock swayidle waybar egl-wayland imv swaybg xorg-server-xwayland qt5-wayland wl-clipboard dbus tmux htop bemenu mupdf mpd ncmpcpp mpc mpv mplayer mako cronie grim slop ffmpeg w3m youtube-dl youtube-viewer newsboat wget curl krita inkscape darktable gcc make fontconfig pkg-config fakeroot lxappearance papirus-icon-theme alsa-utils pulseaudio pulseaudio-bluetooth imagemagick ntfs-3g unzip unrar gnome-themes-standard gtk-engine-murrine telegram-desktop qt5ct r udisks2 perl-term-readline-gnu transmission-cli python-pynvim python-pip calcurse acpi acpid gnupg noto-fonts-cjk powerline-fonts python-pygit2 polkit polkit-gnome zathura zathura-pdf-mupdf zathura-djvu gst-libav vifm blueman bluez acpilight powertop lightdm xdg-user-dirs abook +pacman -Sy --noconfirm networkmanager openvpn systemd-resolveconf neovim sway swaylock swayidle waybar egl-wayland imv swaybg xorg-server-xwayland qt5-wayland wl-clipboard dbus tmux htop bemenu mupdf mpd ncmpcpp mpc mpv mplayer mako cronie grim slop ffmpeg w3m youtube-dl youtube-viewer newsboat wget curl krita inkscape darktable gcc make fontconfig pkg-config fakeroot lxappearance papirus-icon-theme alsa-utils pulseaudio pulseaudio-bluetooth imagemagick ntfs-3g unzip unrar gnome-themes-standard gtk-engine-murrine telegram-desktop qt5ct r udisks2 perl-term-readline-gnu transmission-cli python-pynvim python-pip calcurse acpi acpid gnupg noto-fonts-cjk powerline-fonts python-pygit2 polkit polkit-gnome zathura zathura-pdf-mupdf zathura-djvu gst-libav vifm blueman bluez acpilight powertop lightdm xdg-user-dirs abook ranger # Install AUR helper cd /tmp @@ -14,6 +14,8 @@ yay -S --noconfirm ttf-symbola stig pam-gnupg mutt-wizard-git ncmpamixer lightdm # Copy system config files cp system/sudoers /etc/ +cp system/resolv.conf /etc/ +cp system/NetworkManager/NetworkManager.conf /etc/NetworkManager/NetworkManager.conf cp system/mkinitcpio.conf /etc/ cp -r system/loader/ /boot/loader/ cp -r system/lightdm/ /etc/lightdm/ diff --git a/system/NetworkManager/NetworkManager.conf b/system/NetworkManager/NetworkManager.conf new file mode 100644 index 0000000..c48e647 --- /dev/null +++ b/system/NetworkManager/NetworkManager.conf @@ -0,0 +1,4 @@ +# Configuration file for NetworkManager. +# See "man 5 NetworkManager.conf" for details. +[main] +dns=none diff --git a/system/resolv.conf b/system/resolv.conf new file mode 100644 index 0000000..af9304d --- /dev/null +++ b/system/resolv.conf @@ -0,0 +1,2 @@ +nameserver 208.67.222.222 +nameserver 208.67.220.220 diff --git a/system/sudoers b/system/sudoers index 77c71b0..c7efcf6 100644 --- a/system/sudoers +++ b/system/sudoers @@ -81,12 +81,13 @@ root ALL=(ALL) ALL ## Uncomment to allow members of group wheel to execute any command %wheel ALL=(ALL) ALL -## Run some commands without a password -%wheel ALL=(ALL) NOPASSWD: /usr/bin/pacman -Sy - ## Same thing without a password # %wheel ALL=(ALL) NOPASSWD: ALL +## Run some commands without a password +%wheel ALL=(ALL) NOPASSWD: /usr/bin/pacman -Sy +%wheel ALL=(ALL) NOPASSWD: /usr/bin/openvpn + ## Uncomment to allow members of group sudo to execute any command # %sudo ALL=(ALL) ALL @@ -98,4 +99,3 @@ root ALL=(ALL) ALL ## Read drop-in files from /etc/sudoers.d ## (the '#' here does not indicate a comment) #includedir /etc/sudoers.d - -- cgit v1.2.3