diff --git a/.bashrc b/.bashrc index bad8685..d1fa284 100644 --- a/.bashrc +++ b/.bashrc @@ -18,7 +18,10 @@ alias mkdir='mkdir -p' alias cd='z' # Edit this .bashrc file -alias ebrc='edit ~/.bashrc' +alias ebrc='nano ~/.bashrc' + +alias wgu='wg-quick up wg0' +alias wgd='wg-quick down wg0' # Change directory aliases alias home='cd ~' @@ -84,6 +87,12 @@ export ELECTRON_ENABLE_OZONE=1 export OZONE_PLATFORM=wayland export GDK_SCALE=1 export GDK_DPI_SCALE=1 +export QT_QPA_PLATFORM=wayland +export QT_AUTO_SCREEN_SCALE_FACTOR=1 +export QT_SCALE_FACTOR=1 + +# Force Wayland Anki +export ANKI_WAYLAND=1 # Force Firefox to run in wayland export MOZ_ENABLE_WAYLAND=1 diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc index 832cda0..1c6960a 100644 --- a/.config/waybar/config.jsonc +++ b/.config/waybar/config.jsonc @@ -43,6 +43,7 @@ "clock#date", // date "custom/right4", + "custom/wireguard", // wireguard "custom/wifi", // wi-fi "bluetooth", // bluetooth "custom/update", // system update @@ -178,6 +179,19 @@ "max-length": 8 }, + + // ──────────────────────────────────────────────────────────┤ wireguard ├─── + + "custom/wireguard": { + "exec": "~/.config/waybar/scripts/wireguard-status.sh", + "return-type": "json", + "format": "{}", + "on-click": "~/.config/waybar/scripts/wireguard-toggle.sh", + "interval": 3, + "min-length": 1, + "max-length": 1 + }, + // ──────────────────────────────────────────────────────────────┤ wi-fi ├─── "custom/wifi": { @@ -186,7 +200,7 @@ "format": "{}", "on-click": "~/.config/waybar/scripts/wifi-menu.sh", "on-click-right": "kitty --title '󰤨 Network Manager TUI' bash -c nmtui", - "interval": 1, + "interval": 3, "min-length": 1, "max-length": 1 }, @@ -212,7 +226,7 @@ "on-click": "~/.config/waybar/scripts/bluetooth-menu.sh", "on-click-right": "kitty --title '󰂯 Bluetooth TUI' bash -c bluetui", - "interval": 1, + "interval": 3, "min-length": 1, "max-length": 1 }, @@ -224,7 +238,7 @@ "return-type": "json", "format": "{}", "on-click": "~/.config/waybar/scripts/system-update.sh up", - "interval": 30, + "interval": 240, "min-length": 1, "max-length": 1 }, diff --git a/.config/waybar/scripts/askpass.sh b/.config/waybar/scripts/askpass.sh new file mode 100644 index 0000000..56f63c0 --- /dev/null +++ b/.config/waybar/scripts/askpass.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +rofi -dmenu -password -no-fixed-num-lines -p "Sudo password" diff --git a/.config/waybar/scripts/wireguard-status.sh b/.config/waybar/scripts/wireguard-status.sh new file mode 100755 index 0000000..f9077c3 --- /dev/null +++ b/.config/waybar/scripts/wireguard-status.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +SERVICE_NAME="wg-quick@wg0" +STATUS_CONNECTED_STR='{"text":"", "tooltip":"Tunnel connected."}' +STATUS_DISCONNECTED_STR='{"text":"", "tooltip":"Tunnel disconnected"}' + +function status_wireguard() { + systemctl is-active $SERVICE_NAME >/dev/null 2>&1 + return $? +} + +status_wireguard && echo $STATUS_CONNECTED_STR || echo $STATUS_DISCONNECTED_STR diff --git a/.config/waybar/scripts/wireguard-toggle.sh b/.config/waybar/scripts/wireguard-toggle.sh new file mode 100755 index 0000000..7531000 --- /dev/null +++ b/.config/waybar/scripts/wireguard-toggle.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +SERVICE_NAME="wg-quick@wg0" + +function status_wireguard() { + systemctl is-active $SERVICE_NAME >/dev/null 2>&1 + return $? +} + +function askpass() { + rofi -dmenu -password -no-fixed-num-lines -p "Sudo password" +} + +status_wireguard && \ +SUDO_ASKPASS=~/.config/waybar/scripts/askpass.sh sudo -A systemctl stop $SERVICE_NAME || \ +SUDO_ASKPASS=~/.config/waybar/scripts/askpass.sh sudo -A systemctl start $SERVICE_NAME diff --git a/.config/waybar/style.css b/.config/waybar/style.css index 46770ed..e435727 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -46,6 +46,7 @@ tooltip label { #idle_inhibitor, #clock, #custom-wifi, +#custom-wireguard, #bluetooth, #custom-update, #mpris, @@ -267,6 +268,17 @@ tooltip label { color: @hover-fg; } +/* ────────────────────────────────────────────────────────────────┤ wireguard ├─── +*/ +#custom-wireguard { + background: @tray; + padding: 0 8px 0 5px; +} + +#custom-wireguard:hover { + color: @hover-fg; +} + /* ────────────────────────────────────────────────────────────┤ bluetooth ├─── */ #bluetooth { diff --git a/install.bash b/install.bash index 2ab7331..16079df 100644 --- a/install.bash +++ b/install.bash @@ -57,15 +57,6 @@ pacman -S networkmanager wpa_supplicant echo '[Service]\nExecStart=\nExecStart=-/sbin/agetty --noreset --noclear --autologin alex %I $TERM' | sudo tee /etc/systemd/system/getty@tty1.service.d/override.conf > /dev/null && sudo systemctl enable getty@tty1 # Battery optimization -# https://github.com/AdnanHodzic/auto-cpufreq?tab=readme-ov-file#installing-auto-cpufreq -#git clone https://github.com/AdnanHodzic/auto-cpufreq.git -#cd auto-cpufreq && sudo ./auto-cpufreq-installer -#sudo auto-cpufreq --install -#sudo auto-cpufreq --update -#sudo auto-cpufreq --stats -# https://wiki.archlinux.org/title/Framework_Laptop_13#Battery_control -#yay -S fw-ectool-git -#ectool chargecontrol normal 80 80 cp ~/dotfiles/etc/tlp.conf /etc/ pacman -S tlp tlp-rdw systemctl enable --now tlp.service @@ -76,6 +67,9 @@ systemctl mask systemd-rfkill.socket # Also needed for auto-disable BT # Make wireguard connection persistent in /etc/wireguard echo "PersistentKeepalive = 25" >> /etc/wireguard/home.conf +# After installing Anki, force Anki to use Wayland by replacing Exec= in /usr/local/share/applications/anki.desktop +# Exec=env ANKI_WAYLAND=1 anki %f + ################################################################### # MANUAL CONFIGURATION REQUIRED ################################################################### @@ -86,7 +80,3 @@ echo "PersistentKeepalive = 25" >> /etc/wireguard/home.conf pacman -S cava bluez-utils bluez pipewire-pulse ttf-jetbrains-mono-nerd wireplumber yay -S rofi-lbonn-wayland-git bluetui systemctl enable --now bluetooth.service - -# Battery optimization: -sudo pacman -S tlp -