Skip to content

Instantly share code, notes, and snippets.

@shawngmc
Last active May 26, 2026 00:53
Show Gist options
  • Select an option

  • Save shawngmc/401420c108f99fb937600424a86ac34a to your computer and use it in GitHub Desktop.

Select an option

Save shawngmc/401420c108f99fb937600424a86ac34a to your computer and use it in GitHub Desktop.
Lenovo 300w w/Fedora Sway, etc.

Using the 300w in an effective way

  • Use Fedora Sway Spin - very lightweight
  • Fix Touchpad
#!/bin/bash
# Install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo '' >> ~/.bashrc
echo '# brew init' >> ~/.bashrc
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)"' >> ~/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)"
sudo dnf group install development-tools -y
# Install Starship
brew install starship
echo '' >> ~/.bashrc
echo '# Starship init' >> ~/.bashrc
echo 'eval "$(starship init bash)"' >> ~/.bashrc
source ~/.bashrc
# Set up bitwarden
brew install bitwarden-cli
bw config server https://bitwarden.hitoma.com
bw login
echo '' >> ~/.bashrc
echo '# Bitwarden Alias' >> ~/.bashrc
echo "alias bw-unlock='export BW_SESSION=\$(bw unlock --raw)'" >> ~/.bashrc
source ~/.bashrc
bw-unlock
# Set up aerc for gmail
brew install aerc w3m
mkdir -pv ~/.config/aerc
cp "$(brew --prefix)/share/aerc/binds.conf" ~/.config/aerc/binds.conf
cp "$(brew --prefix)/share/aerc/aerc.conf" ~/.config/aerc/aerc.conf
sed -i 's|^text/html=! html$|text/html=/home/linuxbrew/.linuxbrew/bin/w3m -T text/html -o display_link_number=1|' ~/.config/aerc/aerc.conf
sed -i 's|^#alternatives=text/plain,text/html$|alternatives=text/html,text/plain|' ~/.config/aerc/aerc.conf
echo <<EOF > ~/.config/aerc/accounts.conf
[Gmail]
source = imaps://shawngmc@gmail.com@imap.gmail.com:993
outgoing = smtps+plain://shawngmc@gmail.com@smtp.gmail.com:465
from = Shawn McNaughton <shawngmc@gmail.com>
default = INBOX
folders-sort = INBOX
postpone = [Gmail]/Drafts
cache-headers = true
source-cred-cmd = bw get password 79b829cb-8236-4c14-a7df-d3d1344759c8
outgoing-cred-cmd = bw get password 79b829cb-8236-4c14-a7df-d3d1344759c8
carddav-source = https://shawngmc@gmail.com@www.googleapis.com/carddav/v1/principals/shawngmc@gmail.com/lists/default
carddav-source-cred-cmd = bw get password 79b829cb-8236-4c14-a7df-d3d1344759c8
address-book-cmd = carddav-query %s
EOF
# Set up calcurse NOT YET WORKING
# Problem 1: Google only allows Oauth2 for calendar
# Problem 2: Calcurse has no 'command' equiv to store clientid/clientsecret
#brew install calcurse
#pip3 install --user httplib2 --break-system-packages
#mkdir -pv ~/.config/calcurse/caldav
#echo <<EOF >~/.config/calcurse/caldav/config
#[General]
#Binary = calcurse
#Hostname = apidata.googleusercontent.com
#Path = /caldav/v2/shawngmc@gmail.com/events/
#AuthMethod = basic
#HTTPS = Yes
#SyncFilter = cal
#
#[Auth]
#Username = shawngmc@gmail.com
#PasswordCommand = bw get password 79b829cb-8236-4c14-a7df-d3d1344759c8
#EOF
# Set up FZF
brew install fzf
echo '' >> ~/.bashrc
echo '# FZF init' >> ~/.bashrc
echo 'source <(fzf --bash)' >> ~/.bashrc
source <(fzf --bash)
# Install NVM/Node/NPM
brew install nvm
mkdir -pv ~/.nvm
echo '' >> ~/.bashrc
echo '# NVM init' >> ~/.bashrc
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc
echo '[ -s "/home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh" ] && \. "/home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh" # This loads nvm' >> ~/.bashrc
echo '[ -s "/home/linuxbrew/.linuxbrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/home/linuxbrew/.linuxbrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion' >> ~/.bashrc
source ~/.bashrc
nvm install --lts
# Set up fastfetch
brew install fastfetch
echo '' >> ~/.bashrc
echo '# Fastfetch' >> ~/.bashrc
echo 'fastfetch' >> ~/.bashrc
# Install Python
brew install uv
uv python install
uv python pin $(uv python list | grep 'cpython' | grep -v 'freethreaded' | grep -v 'a[0-9]' | head -1 | grep -o '3\.[0-9]*' | head -1)
# Set up wego weather
brew install wego
wego
sed -i "s/^owm-api-key=.*/owm-api-key=$(bw get password c4f51d8a-7671-4006-9d7a-3785f32c06bc)/" ~/.wegorc
HOME_CITY="Herndon"
HOME_STATE="VA"
HOME_RESPONSE=$(curl -G https://nominatim.openstreetmap.org/search -d "city=${HOME_CITY}" -d "state=${HOME_STATE}" -d "format=json")
HOME_LAT=$(echo $HOME_RESPONSE | jq -r .[0].lat)
HOME_LON=$(echo $HOME_RESPONSE | jq -r .[0].lon)
sed -i "s/^location=.*/location=${HOME_LAT},${HOME_LON}/" ~/.wegorc
# Set up Pittsburgh Alias
#PITT_CITY="Pittsburgh"
#PITT_STATE="PA"
#PITT_RESPONSE=$(curl -G https://nominatim.openstreetmap.org/search -d "city=${HOME_CITY}" -d "state=${HOME_STATE}" -d "format=json")
#PITT_LAT=$(echo $PITT_RESPONSE | jq -r .[0].lat)
#PITT_LON=$(echo $PITT_RESPONSE | jq -r .[0].lon)
echo '' >> ~/.bashrc
echo '# WeGo aliases' >> ~/.bashrc
echo "alias wego-pitt='wego -location Pittsburgh'" >> ~/.bashrc
echo "alias wego-herndon='wego -location Herndon'" >> ~/.bashrc
# Bulk installs
# Network
brew install iftop bandwhich termshark doggo nload
# Containers
brew install k9s kubernetes-cli crane dive
# Disk
brew install diskonaut dua-cli
# Data visualization and transformation
brew install 7zip ripgrep ripgrep-all dhex nushell yq fx q ugrep
# CLI help
brew install tealdeer tmux tuios
# Security
brew install testssl ssh-audit gpg-tui
# Process Management
brew install btop procs
# Misc.
brew install asciinema bat neovim gemini-cli yt-dlp git-flow-next pspg hyperfine
# Install Claude Code
curl -fsSL https://claude.ai/install.sh | bash
#!/bin/bash
sudo dnf install -y acpica-tools patch
# Unpack DSDT
mkdir ~/touchpad
cd ~/touchpad/
sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.aml
iasl -d dsdt.aml
# Patch from https://askubuntu.com/questions/1557460/lenovo-300w-gen3-cant-install-ubuntu-no-trackpad
patch dsdt.dsl <<EOF
--- a/dsdt.dsl
+++ b/dsdt.dsl
@@ -18,7 +18,7 @@
* Compiler ID "INTL"
* Compiler Version 0x20180313 (538444563)
*/
-DefinitionBlock ("", "DSDT", 1, "LENOVO", "AMD", 0x00001000)
+DefinitionBlock ("", "DSDT", 1, "LENOVO", "AMD", 0x00001001)
{
External (_PR_.C000, DeviceObj)
External (_PR_.C000.PPCV, IntObj)
@@ -7906,7 +7906,8 @@
Return (ConcatenateResTemplate (SBFB, SBFG))
}
- If ((^^^PCI0.LPC0.H_EC.ECRD (RefOf (^^^PCI0.LPC0.H_EC.TPTY)) == 0x02))
+ // If ((^^^PCI0.LPC0.H_EC.ECRD (RefOf (^^^PCI0.LPC0.H_EC.TPTY)) == 0x02))
+ Else
{
Name (SBFC, ResourceTemplate ()
{
@@ -10393,7 +10394,7 @@
Field (CMIO, ByteAcc, Lock, Preserve)
{
CINX, 8,
- CDAT, 8
+ // CDAT, 8
}
IndexField (CINX, CDAT, ByteAcc, NoLock, Preserve)
EOF
# Compile and stage
iasl -sa dsdt.dsl
sudo mkdir -p /usr/local/lib/firmware/acpi
sudo cp dsdt.aml /usr/local/lib/firmware/acpi/
# Add dracut config and build
cat <<EOF | sudo tee /etc/dracut.conf.d/acpi-fix.conf > /dev/null
acpi_override="yes"
acpi_table_dir="/usr/local/lib/firmware/acpi"
EOF
sudo dracut --force
# Reboot
sudo reboot
#!/bin/bash
# VSCode
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo tee /etc/yum.repos.d/vscode.repo > /dev/null << 'EOF'
[code]
name=Visual Studio Code
baseurl=https://packages.microsoft.com/yumrepos/vscode
enabled=1
autorefresh=1
type=rpm-md
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
EOF
dnf check-update && sudo dnf install code
#!/bin/bash
# Install Font
mkdir -p ~/.local/share/fonts
cd ~/.local/share/fonts
curl -L "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/RobotoMono.zip" -o RobotoMono.zip
unzip RobotoMono.zip
rm RobotoMono.zip
fc-cache -f
mkdir -pv ~/.config/sway
cp /etc/sway/config ~/.config/sway/config
cat <<EOF >> ~/.config/sway/config
# Gaps for that floating UI look
gaps inner 6
gaps outer 4
# Sharp borders
default_border pixel 2
# Color scheme: class border bg text indicator child_border
client.focused #00FFFF #0A0A0F #00FFFF #FF00FF #00FFFF
client.focused_inactive #1A1A2E #0A0A0F #444466 #1A1A2E #1A1A2E
client.unfocused #0D0D1A #0A0A0F #333355 #0D0D1A #0D0D1A
client.urgent #FF00FF #0A0A0F #FF00FF #FF00FF #FF00FF
# Custom keybinds
bindsym $mod+l exec swaylock
EOF
# Disable ijkl keybinds
sed -i 's/^\(\s*bindsym \$mod+\$\(left\|right\|up\|down\)\)/ #\1/' ~/.config/sway/config
sed -i 's/^\(\s*bindsym \$mod+Shift+\$\(left\|right\|up\|down\)\)/ #\1/' ~/.config/sway/config
mkdir -pv ~/.config/waybar
cat <<EOF >~/.config/waybar/style.css
* {
font-family: "RobotoMono Nerd Font", monospace;
font-size: 13px;
}
window#waybar {
background: rgba(5, 5, 15, 0.92);
border-bottom: 1px solid #00FFFF;
color: #00FFFF;
}
#workspaces button {
color: #444466;
border-bottom: 2px solid transparent;
}
#workspaces button.focused {
color: #00FFFF;
border-bottom: 2px solid #00FFFF;
}
#clock, #battery, #cpu, #memory, #network {
color: #00FF88;
padding: 0 12px;
border-left: 1px solid #1A1A3A;
}
#battery.critical {
color: #FF00FF;
animation: blink 1s infinite;
}
@keyframes blink {
to { color: #FF4488; }
}
* {
font-family: "RobotoMono Nerd Font", monospace;
font-size: 13px;
}
window#waybar {
background: rgba(5, 5, 15, 0.92);
border-bottom: 1px solid #00FFFF;
color: #00FFFF;
}
#workspaces button {
color: #444466;
border-bottom: 2px solid transparent;
}
#workspaces button.focused {
color: #00FFFF;
border-bottom: 2px solid #00FFFF;
}
#clock, #battery, #cpu, #memory, #network {
color: #00FF88;
padding: 0 12px;
border-left: 1px solid #1A1A3A;
}
#battery.critical {
color: #FF00FF;
animation: blink 1s infinite;
}
@keyframes blink {
to { color: #FF4488; }
}
EOF
# Prettify Foot Terminal
mkdir -pv ~/.config/foot/
cat <<EOF >~/.config/foot/foot.ini
[main]
font=RobotoMono Nerd Font:size=12
[colors-dark]
background=05050f
foreground=00ffcc
regular0=0a0a1a # black
regular1=ff005f # red
regular2=00ff88 # green
regular3=ffcc00 # yellow
regular4=0088ff # blue
regular5=ff00ff # magenta
regular6=00ffff # cyan
regular7=ccccdd # white
EOF
sudo dnf install fuzzel
sed -i 's/^set \$menu/# set \$menu/; /^# set \$menu/a set \$menu fuzzel' ~/.config/sway/config
mkdir -pv ~/.config/fuzzel
cat <<EOF > ~/.config/fuzzel/fuzzel.ini
[main]
font=RobotoMono Nerd Font:size=13
prompt=❯
terminal=foot
[colors]
background=05050fee
text=00ffccff
match=ff00ffff
selection=00ffff22
selection-text=00ffff ff
border=00ffff ff
[border]
width=2
radius=0
[dmenu]
# if using as dmenu replacement
exit-immediately-if-empty=true
EOF
# Sway Notification Center
sudo dnf install swaync
cat <<EOF >> ~/.config/sway/config
exec swaync
bindsym \$mod+Shift+n exec swaync-client -t
EOF
mkdir -pv ~/.config/swaync/
cat <<EOF > ~/.config/swaync/style.css
* {
font-family: "RobotoMono Nerd Font";
font-size: 13px;
}
.notification-row .notification {
background: #05050f;
border: 1px solid #00ffff;
border-radius: 0;
color: #00ffcc;
margin: 4px;
}
.notification-row .notification .summary {
color: #00ffff;
font-weight: 500;
}
.notification-row .notification .body {
color: #00ffcc;
}
.notification-row .notification .time {
color: #444466;
}
.notification-row .notification.critical {
border-color: #ff00ff;
color: #ff00ff;
}
.control-center {
background: #05050fee;
border: 1px solid #00ffff;
border-radius: 0;
}
.control-center .notification {
background: #0a0a1e;
border: 1px solid #1a1a3a;
border-radius: 0;
}
EOF
# Background
# TODO: Pull the background neon poly tiger.jpg from my gdrive and save in location
cp ~/Downloads/neon\ poly\ tiger.jpg ~/.config/sway/neon_poly_tiger.jpg
sed -i 's|output \* bg .*|output * bg ~/.config/sway/neon_poly_tiger.jpg fill|' ~/.config/sway/config
# Firefox
# TODO: Enable userchrome in about:config
# toolkit.legacyUserProfileCustomizations.stylesheets = true
# browser.tabs.inTitlebar = 0
PROFILE_DIR="$HOME/.config/mozilla/firefox/$(grep Path ~/.config/mozilla/firefox/profiles.ini | grep default-release | cut -d= -f2)"
mkdir -pv ${PROFILE_DIR}/chrome/
cat <<EOF > ${PROFILE_DIR}/chrome/userChrome.css
* {
font-family: "RobotoMono Nerd Font", monospace !important;
}
:root {
--cyberpunk-bg: #05050f;
--cyberpunk-bg2: #0a0a1e;
--cyberpunk-cyan: #00ffcc;
--cyberpunk-border: #00ffff;
--cyberpunk-muted: #444466;
}
/* main toolbar */
#nav-bar {
background: var(--cyberpunk-bg) !important;
border-bottom: 1px solid var(--cyberpunk-border) !important;
}
/* tabs */
.tabbrowser-tab {
background: var(--cyberpunk-bg) !important;
color: var(--cyberpunk-muted) !important;
}
.tabbrowser-tab[selected] {
background: var(--cyberpunk-bg2) !important;
color: var(--cyberpunk-cyan) !important;
border-top: 2px solid var(--cyberpunk-border) !important;
}
/* url bar */
#urlbar {
background: var(--cyberpunk-bg2) !important;
border: 1px solid var(--cyberpunk-border) !important;
color: var(--cyberpunk-cyan) !important;
border-radius: 0 !important;
}
/* title bar and window background */
:root {
--toolbar-bgcolor: #05050f !important;
--toolbar-color: #00ffcc !important;
}
#titlebar {
background: #05050f !important;
}
/* selected tab - override more specifically */
.tabbrowser-tab[selected="true"] .tab-background {
background: #0a0a1e !important;
border-top: 2px solid #00ffff !important;
}
/* tab text */
.tabbrowser-tab[selected="true"] .tab-label {
color: #00ffcc !important;
}
/* unselected tabs */
.tabbrowser-tab:not([selected]) .tab-background {
background: #05050f !important;
}
/* toolbar icons - brighten them */
#nav-bar .toolbarbutton-1 {
color: #00ffcc !important;
fill: #00ffcc !important;
}
/* icon hover */
#nav-bar .toolbarbutton-1:hover {
color: #00ffff !important;
fill: #00ffff !important;
background: #0a0a1e !important;
}
/* context icons (extensions etc) */
#unified-extensions-button,
#PanelUI-menu-button {
color: #00ffcc !important;
fill: #00ffcc !important;
}
#titlebar,
#titlebar-buttonbox,
.titlebar-buttonbox-container,
#TabsToolbar,
#TabsToolbar .toolbar-items {
background: #05050f !important;
background-color: #05050f !important;
color: #00ffcc !important;
}
/* tabs bar specifically */
#TabsToolbar {
background-color: #05050f !important;
}
/* unselected tab titles */
.tabbrowser-tab:not([selected]) .tab-label {
color: #00ffcc !important;
}
/* selected tab title */
.tabbrowser-tab[selected="true"] .tab-label {
color: #ff00ff !important;
}
/* address bar focused background */
#urlbar[focused="true"],
#urlbar[open="true"] {
background: #0a0a1e !important;
color: #00ffcc !important;
}
/* address bar background - all states */
#urlbar-background {
background-color: #0a0a1e !important;
border-color: #00ffff !important;
}
#urlbar[focused="true"] #urlbar-background {
background-color: #0a0a1e !important;
border-color: #00ffff !important;
}
:root[inactivetitlebar] .tab-label {
opacity: 1 !important;
color: #00ffcc !important;
}
:root[inactivetitlebar] .tabbrowser-tab[selected] .tab-label {
color: #ff00ff !important;
}
#toolbar-menubar[inactive="true"] {
opacity: 1 !important;
}
#toolbar-menubar[inactive] .tab-label {
color: #00ffcc !important;
}
#toolbar-menubar[inactive] .tabbrowser-tab[selected] .tab-label {
color: #ff00ff !important;
}
#urlbar-input {
background-color: #0a0a1e !important;
color: #00ffcc !important;
}
/* the actual background element */
.urlbar-background {
background-color: #0a0a1e !important;
border-color: #00ffff !important;
}
#urlbar[focused] .urlbar-background {
background-color: #0a0a1e !important;
border-color: #00ffff !important;
}
/* input container */
.urlbar-input-container {
background-color: #0a0a1e !important;
}
/* the input itself */
#urlbar-input {
background-color: transparent !important;
color: #00ffcc !important;
}
#urlbar-input::selection {
background-color: #00ffff44 !important;
color: #00ffcc !important;
}
:root[inactivetitlebar] *,
#toolbar-menubar[inactive] *,
#toolbar-menubar[inactive="true"] * {
opacity: 1 !important;
color: inherit !important;
}
#toolbar-menubar[inactive="true"] {
opacity: 1 !important;
background-color: #05050f !important;
}
#toolbar-menubar[inactive="true"] * {
opacity: 1 !important;
color: #00ffcc !important;
}
#TabsToolbar:-moz-window-inactive .tab-label,
#TabsToolbar:-moz-window-inactive .tab-text,
#TabsToolbar:-moz-window-inactive .tab-close-button,
#TabsToolbar:-moz-window-inactive #firefox-view-button {
opacity: 1 !important;
color: #00ffcc !important;
}
#TabsToolbar:-moz-window-inactive .tabbrowser-tab[selected="true"] .tab-label {
color: #ff00ff !important;
}
EOF
# Swaylock
SWAYLOCK_CONFIG="$HOME/.config/swaylock/config"
SWAYLOCK_DIR="$(dirname "$SWAYLOCK_CONFIG")"
SYSTEM_CONFIG="/etc/swaylock/config"
WALLPAPER="$HOME/.config/sway/neon_poly_tiger.jpg"
# Create directory if needed
mkdir -p "$SWAYLOCK_DIR"
# Copy system config if user config doesn't exist
if [[ ! -f "$SWAYLOCK_CONFIG" ]]; then
if [[ -f "$SYSTEM_CONFIG" ]]; then
echo "Copying system config to $SWAYLOCK_CONFIG"
cp "$SYSTEM_CONFIG" "$SWAYLOCK_CONFIG"
else
echo "No system config found — creating default config at $SWAYLOCK_CONFIG"
touch "$SWAYLOCK_CONFIG"
fi
else
echo "Config already exists at $SWAYLOCK_CONFIG — leaving in place"
fi
# Helper: set or replace a key in the config
set_key() {
local key="$1"
local value="$2"
if grep -qE "^#?[[:space:]]*${key}=" "$SWAYLOCK_CONFIG" 2>/dev/null; then
sed -i "s|^#\?[[:space:]]*${key}=.*|${key}=${value}|" "$SWAYLOCK_CONFIG"
else
echo "${key}=${value}" >> "$SWAYLOCK_CONFIG"
fi
}
# --- Wallpaper ---
set_key "image" "$WALLPAPER"
set_key "scaling" "fill"
# --- Font ---
set_key "font" "RobotoMono Nerd Font"
# --- Ring (neon black/blue-teal theme) ---
# Normal state
set_key "color" "000000ff" # background fill when no image
set_key "ring-color" "000000ff" # ring base: black
set_key "key-hl-color" "00f5ffff" # neon teal keypress highlight
set_key "line-color" "00000000" # line between ring layers: transparent
set_key "inside-color" "00000088" # inside fill: semi-transparent black
set_key "separator-color" "00000000" # separator: transparent
# Verifying state (typing)
set_key "ring-ver-color" "00e5ffcc" # neon teal/blue while verifying
set_key "line-ver-color" "00000000"
set_key "inside-ver-color" "00000088"
# Wrong password
set_key "ring-wrong-color" "ff00aaff" # neon pink on wrong
set_key "line-wrong-color" "00000000"
set_key "inside-wrong-color" "1a001088" # dark pink-tinted inside
# Cleared state
set_key "ring-clear-color" "00f5ff88"
set_key "line-clear-color" "00000000"
set_key "inside-clear-color" "00000088"
# --- Text ---
set_key "text-color" "00f5ffff" # neon teal text
set_key "text-ver-color" "00e5ffff"
set_key "text-wrong-color" "ff00aaff" # neon pink for wrong
set_key "text-clear-color" "00f5ffcc"
set_key "bs-hl-color" "ff00aaff" # neon pink backspace highlight
# File Manager
sudo dnf install nemo nemo-fileroller adw-gtk3-theme -y
sudo dnf remove Thunar
mkdir -p ~/.themes
git clone https://git.disroot.org/eudaimon/CyberHack.git ~/.themes/CyberHack
mkdir -pv ~/.config/gtk-3.0/
cat <<EOF >>~/.config/gtk-3.0/settings.ini
[Settings]
gtk-theme-name=CyberHack
gtk-application-prefer-dark-theme=1
EOF
cat <<EOF >> ~/.config/sway/config
exec_always gsettings set org.gnome.desktop.interface gtk-theme 'CyberHack'
exec_always gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
EOF
cat <<EOF >> ~/.bashrc
# Force GTK Theme
export GTK_THEME=CyberHack
EOF
# Login Manager SDDM
# Test Command
# swaylock -f
# (exit with Mod-Shift-Q)
# TODO: This is only background - add font, colors, etc.
# Probably just clone the theme
# Then expose font and colors as config. vars
sudo mkdir -p /etc/sddm.conf.d/
cat <<EOF | sudo tee /etc/sddm.conf.d/theme.conf > /dev/null
[Theme]
Current=03-sway-fedora
EOF
mkdir -pv /usr/share/sddm/themes/03-sway-fedora/
sudo cp ~/.config/sway/neon_poly_tiger.jpg /usr/share/sddm/themes/03-sway-fedora/neon_poly_tiger.jpg
cat <<EOF | sudo tee /usr/share/sddm/themes/03-sway-fedora/theme.conf.user > /dev/null
[General]
background=/usr/share/sddm/themes/03-sway-fedora/neon_poly_tiger.jpg
EOF
# Swaynag
# Test Commands
# swaynag -t warning -m 'Test message' -B 'Test button' 'echo test'
# swaynag -t error -m 'Test message' -B 'Test button' 'echo test'
mkdir -pv ~/.config/swaynag
cat <<EOF >> ~/.config/swaynag/config
[warning]
font=RobotoMono Nerd Font Bold 13
background=00FFFF
text=0A0A0F
border=00FFFF
button-background=000000
button-text=00FFFF
button-border=00FFFF
border-bottom=00FF00
border-bottom-size=8
[error]
font=RobotoMono Nerd Font Bold 13
background=FF00FF
text=0A0A0F
border=FF00FF
button-background=000000
button-text=FF00FF
button-border=FF00FF
border-bottom=00FF00
border-bottom-size=8
EOF
!#/bin/bash
sudo dnf install wireguard-tools
sudo cp ~/Downloads/MY_WG_CONF.conf /etc/wireguard/wg0.conf
sudo nmcli connection import type wireguard file /etc/wireguard/wg0.conf
WAYBAR_CONFIG="$HOME/.config/waybar/config.jsonc"
DEFAULT_CONFIG="/etc/xdg/waybar/config.jsonc"
# Disable autoconnect
nmcli connection modify "wg0" connection.autoconnect no
mkdir -p "$HOME/.config/waybar"
if [ ! -f "$WAYBAR_CONFIG" ]; then
if [ -f "$DEFAULT_CONFIG" ]; then
cp "$DEFAULT_CONFIG" "$WAYBAR_CONFIG"
echo "Copied default config from $DEFAULT_CONFIG"
else
echo "No default config found at $DEFAULT_CONFIG"
exit 1
fi
else
cp "$WAYBAR_CONFIG" "${WAYBAR_CONFIG}.bak"
echo "Backed up existing config to ${WAYBAR_CONFIG}.bak"
fi
# TODO: Skip the waybar mod for now - it doesn't work unless the ip interface exists, and the interface kills connectivity
# Look at https://github.com/Klafyvel/wireguard-manager
# node -e "
# const fs = require('fs');
# let src = fs.readFileSync('$WAYBAR_CONFIG', 'utf8');
# const moduleEntry = \`
# \"custom/vpn\": {
# \"exec\": \"nmcli -t -f NAME,TYPE,STATE con show --active | grep wireguard | cut -d: -f1 || echo 'off'\",
# \"interval\": 5,
# \"format\": \"🔒 {}\",
# \"tooltip\": false
# },\`;
# src = src.replace(/}(\s*)$/, moduleEntry + '\n}\$1');
# src = src.replace(
# /(\"modules-right\"\s*:\s*\[)([^\]]*?)(\])/,
# (_, open, contents, close) => {
# const trimmed = contents.trimEnd();
# const sep = trimmed.endsWith(',') ? ' ' : ', ';
# return open + trimmed + sep + '\"custom/vpn\"' + close;
# }
# );
# fs.writeFileSync('$WAYBAR_CONFIG', src);
# console.log('Patched config successfully');
# " || { echo "node patch failed"; exit 1; }
# Reload Waybar
if pgrep -x waybar > /dev/null; then
pkill -x waybar
sleep 0.5
swaymsg exec waybar
echo "Waybar restarted"
else
echo "Waybar not running — start it manually"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment