This commit is contained in:
2026-08-09 01:52:54 +07:00
parent 811b94ed72
commit 1a0a59880b
13 changed files with 60 additions and 399 deletions
+2 -1
View File
@@ -36,6 +36,7 @@ exec --no-startup-id xset b off
exec --no-startup-id xset s 300 300
exec --no-startup-id xset dpms 300 600 900
exec --no-startup-id xss-lock -- ~/.config/i3/scripts/lock $wallpaper_dir
exec --no-startup-id ~/.config/i3/scripts/dpms-inhibit
bindsym $mod+l exec ~/.config/i3/scripts/lock-now $wallpaper_dir
bindsym $mod+Shift+o exec --no-startup-id ~/.config/i3/scripts/lock-then-suspend $wallpaper_dir
@@ -48,11 +49,11 @@ bindsym $mod+Print exec --no-startup-id bash -c 'f="$(xdg-user-dir PICTURES)/$(d
# applets
exec --no-startup-id snixembed --fork
exec --no-startup-id picom --config ~/.config/picom/picom.conf
exec --no-startup-id fcitx5 -d
exec --no-startup-id nm-applet
exec --no-startup-id blueman-applet
exec --no-startup-id /usr/bin/gnome-keyring-daemon --start --components=ssh,pkcs11
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec --no-startup-id ~/.config/i3/scripts/wallpaper-rotate $wallpaper_dir
#exec --no-startup-id pasystray
exec --no-startup-id polybar
-100
View File
@@ -1,100 +0,0 @@
#!/usr/bin/env bash
# audio-device-switch - audio device switch with a keybind
# Adapted from this:
# https://gist.githubusercontent.com/kbravh/1117a974f89cc53664e55823a55ac320/raw/9d04a10ae925074536047ae8100c6b0dbfc303d6/audio-device-switch.sh
# Readme: https://gist.github.com/kbravh/1117a974f89cc53664e55823a55ac320
# Creator: https://github.com/kbravh
# Audio Output Switcher
# This script will cycle to the next available audio output device.
# It can be tied to a hotkey to easily be triggered.
# This is handy, for example, for swapping between speakers and headphones.
# This script will work on systems running PulseAudio or Pipewire services.
# Check which sound server is running
if pgrep pulseaudio >/dev/null; then
sound_server="pulseaudio"
elif pgrep pipewire >/dev/null; then
sound_server="pipewire"
else
echo "Neither PulseAudio nor PipeWire is running."
exit 1
fi
# Grab a count of how many audio sinks we have
if [[ "$sound_server" == "pulseaudio" ]]; then
sink_count=$(pacmd list-sinks | grep -c "index:[[:space:]][[:digit:]]")
# Create an array of the actual sink IDs
sinks=()
mapfile -t sinks < <(pacmd list-sinks | grep 'index:[[:space:]][[:digit:]]' | sed -n -e 's/.*index:[[:space:]]\([[:digit:]]\)/\1/p')
# Get the ID of the active sink
active_sink=$(pacmd list-sinks | sed -n -e 's/[[:space:]]*\*[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p')
elif [[ "$sound_server" == "pipewire" ]]; then
sink_count=$(pactl list sinks | grep -c "Sink #[[:digit:]]")
# Create an array of the actual sink IDs
sinks=()
mapfile -t sinks < <(pactl list sinks | grep 'Sink #[[:digit:]]' | sed -n -e 's/.*Sink #\([[:digit:]]\)/\1/p')
# Get the ID of the active sink
active_sink_name=$(pactl info | grep 'Default Sink:' | sed -n -e 's/.*Default Sink:[[:space:]]\+\(.*\)/\1/p')
active_sink=$(pactl list sinks | grep -B 2 "$active_sink_name" | sed -n -e 's/Sink #\([[:digit:]]\)/\1/p' | head -n 1)
fi
# Get the ID of the last sink in the array
final_sink=${sinks[$((sink_count - 1))]}
# Find the index of the active sink
for index in "${!sinks[@]}"; do
if [[ "${sinks[$index]}" == "$active_sink" ]]; then
active_sink_index=$index
fi
done
# Default to the first sink in the list
next_sink=${sinks[0]}
next_sink_index=0
# If we're not at the end of the list, move up the list
if [[ $active_sink -ne $final_sink ]]; then
next_sink_index=$((active_sink_index + 1))
next_sink=${sinks[$next_sink_index]}
fi
#change the default sink
if [[ "$sound_server" == "pulseaudio" ]]; then
pacmd "set-default-sink ${next_sink}"
elif [[ "$sound_server" == "pipewire" ]]; then
# Get the name of the next sink
next_sink_name=$(pactl list sinks | grep -C 2 "Sink #$next_sink" | sed -n -e 's/.*Name:[[:space:]]\+\(.*\)/\1/p' | head -n 1)
pactl set-default-sink "$next_sink_name"
fi
#move all inputs to the new sink
if [[ "$sound_server" == "pulseaudio" ]]; then
for app in $(pacmd list-sink-inputs | sed -n -e 's/index:[[:space:]]\([[:digit:]]\)/\1/p'); do
pacmd "move-sink-input $app $next_sink"
done
elif [[ "$sound_server" == "pipewire" ]]; then
for app in $(pactl list sink-inputs | sed -n -e 's/.*Sink Input #\([[:digit:]]\)/\1/p'); do
pactl "move-sink-input $app $next_sink"
done
fi
# Create a list of the sink descriptions
sink_descriptions=()
if [[ "$sound_server" == "pulseaudio" ]]; then
mapfile -t sink_descriptions < <(pacmd list-sinks | sed -n -e 's/.*alsa.name[[:space:]]=[[:space:]]"\(.*\)"/\1/p')
elif [[ "$sound_server" == "pipewire" ]]; then
mapfile -t sink_descriptions < <(pactl list sinks | sed -n -e 's/.*Description:[[:space:]]\+\(.*\)/\1/p')
fi
# Find the index that matches our new active sink
for sink_index in "${!sink_descriptions[@]}"; do
if [[ "$sink_index" == "$next_sink_index" ]]; then
notify-send -i audio-volume-high "Sound output switched to:" "${sink_descriptions[$sink_index]}"
exit
fi
done
-17
View File
@@ -1,17 +0,0 @@
#!/usr/bin/env bash
# script to monitor temperatures in waybar/i3blocks e.t.c.
# example only use `sensors` to find your names to replace `Tdie|Tctl|Package`
# example output part from sensors:
# zenpower-pci-00c3
# Adapter: PCI adapter
# SVI2_Core: 1.03 V
# SVI2_SoC: 994.00 mV
# Tdie: +53.1°C
# Tctl: +53.1°C
# Tccd1: +42.5°C
# Tccd2: +43.2°C
temp=$(sensors 2>/dev/null | grep -E 'Tdie|Tctl|Package id 0' | grep -oP '\+?[0-9]+\.\d+(?=°C)' | tr -d '+' | head -n1)
echo "${temp}°C"
+54
View File
@@ -0,0 +1,54 @@
#!/bin/bash
# Suspends xset screensaver/DPMS blanking while any visible workspace has a
# fullscreen window (video, game, presentation), restores normal timeouts
# once nothing is fullscreen.
interval="${1:-5}"
# Single-instance lock: i3 restarts/reloads re-run our autostart exec, so
# without this, stray duplicate loops accumulate and race each other's state.
exec 9>"/tmp/.dpms-inhibit-$(id -u).lock"
flock -n 9 || exit 0
has_fullscreen() {
python3 - <<'EOF'
import json, subprocess, sys
def is_fullscreen(node):
if node.get('window') and node.get('fullscreen_mode', 0) > 0: return True
return any(is_fullscreen(c) for c in node.get('nodes', []) + node.get('floating_nodes', []))
def find_ws(node, name):
if node.get('type') == 'workspace' and node.get('name') == name: return node
for c in node.get('nodes', []) + node.get('floating_nodes', []):
r = find_ws(c, name)
if r: return r
try:
wss = json.loads(subprocess.check_output(['i3-msg', '-t', 'get_workspaces'], stderr=subprocess.DEVNULL))
tree = json.loads(subprocess.check_output(['i3-msg', '-t', 'get_tree'], stderr=subprocess.DEVNULL))
for ws in wss:
if ws.get('visible'):
node = find_ws(tree, ws['name'])
if node and is_fullscreen(node):
sys.exit(0)
except Exception:
pass
sys.exit(1)
EOF
}
inhibited=0
while true; do
if has_fullscreen; then
xset s off
xset -dpms
inhibited=1
else
if [ "$inhibited" -eq 1 ]; then
xset s 300 300
xset dpms 300 600 900
inhibited=0
fi
fi
sleep "$interval"
done
-16
View File
@@ -1,16 +0,0 @@
#!/usr/bin/env bash
# Copyright (C) 2025 Johannes Kamprad
# SPDX-License-Identifier: GPL-3.0-or-later
# empty_workspace - open a new workspace automatically named with next number on i3
MAX_DESKTOPS=20
WORKSPACES=$(seq -s '\n' 1 1 ${MAX_DESKTOPS})
EMPTY_WORKSPACE=$( (i3-msg -t get_workspaces | tr ',' '\n' | grep num | awk -F: '{print int($2)}' ; \
echo -e ${WORKSPACES} ) | sort -n | uniq -u | head -n 1)
i3-msg workspace ${EMPTY_WORKSPACE}
-17
View File
@@ -1,17 +0,0 @@
#!/usr/bin/env bash
# script to monitor temperatures in waybar/i3blocks e.t.c.
# example only use `sensors` to find your sensor to replace `i915-pci-0600`
# example output part from sensors:
# i915-pci-0600
# Adapter: PCI adapter
# in0: 630.00 mV
# fan1: 0 RPM
# temp1: +55.0°C
# energy1: 1.26 MJ
# examples using Nvidia tools:
#echo "$(nvidia-smi --format=csv,noheader --query-gpu=temperature.gpu) °C"
#echo "$(nvidia-settings -q gpucoretemp -t) °C"
# example using sensor name:
sensors 2>/dev/null | awk '/i915-pci-0600/{flag=1} flag && /temp1/ {gsub("\\+", "", $2); print $2, $3; exit}'
-16
View File
@@ -1,16 +0,0 @@
#!/bin/sh
# needed for nwg-looks
# usage: import-gsettings
config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini"
if [ ! -f "$config" ]; then exit 1; fi
gnome_schema="org.gnome.desktop.interface"
gtk_theme="$(grep 'gtk-theme-name' "$config" | cut -d'=' -f2)"
icon_theme="$(grep 'gtk-icon-theme-name' "$config" | cut -d'=' -f2)"
cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | cut -d'=' -f2)"
font_name="$(grep 'gtk-font-name' "$config" | cut -d'=' -f2)"
gsettings set "$gnome_schema" gtk-theme "$gtk_theme"
gsettings set "$gnome_schema" icon-theme "$icon_theme"
gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
gsettings set "$gnome_schema" font-name "$font_name"
-10
View File
@@ -1,10 +0,0 @@
#!/bin/sh
# keyhint rofi tool to search used keybindings in i3wm
I3_CONFIG=$HOME/.config/i3/config
mod_key=$(sed -nre 's/^set \$mod (.*)/\1/p' ${I3_CONFIG})
grep "^bindsym" ${I3_CONFIG} \
| sed "s/-\(-\w\+\)\+//g;s/\$mod/${mod_key}/g;s/Mod1/Alt/g;s/exec //;s/bindsym //;s/^\s\+//;s/^\([^ ]\+\) \(.\+\)$/\2: \1/;s/^\s\+//" \
| tr -s ' ' \
| rofi -dmenu -theme ~/.config/rofi/rofikeyhint.rasi
+3 -8
View File
@@ -1,10 +1,5 @@
#!/bin/bash
# Skip lock if a fullscreen window is active (game, video, etc.)
active=$(xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | awk '{print $NF}')
if [ -n "$active" ] && [ "$active" != "0x0" ]; then
state=$(xprop -id "$active" _NET_WM_STATE 2>/dev/null)
if echo "$state" | grep -q "_NET_WM_STATE_FULLSCREEN"; then
exit 0
fi
fi
# Idle-blanking during fullscreen is suppressed by dpms-inhibit, so this
# script (invoked by xss-lock) is only ever triggered for a real pre-suspend
# lock — always lock, regardless of fullscreen state.
exec ~/.config/i3/scripts/lock-now "$1"
-168
View File
@@ -1,168 +0,0 @@
#!/usr/bin/env bash
# original source: https://gitlab.com/Nmoleo/i3-volume-brightness-indicator
# alternative to volume_brightness.sh that uses brightnessctl for both keyboard & screen brightness
# See README.md for usage instructions
volume_step=1
keyboard_brightness_step=20
screen_brightness_step=1
max_volume=100
notification_timeout=1000
# Specify Icon Theme here:
volume_theme_icon="audio-volume-high"
screen_brightness_theme_icon="display-brightness"
keyboard_brightness_theme_icon="display-brightness"
# Keyboard Backlight device detection here:
device_cache="/tmp/kbd_backlight_device"
if [ -f "$device_cache" ]; then
# If there is cache, load it into device
device=$(cat "$device_cache")
else
# If there is no cache, create one
device=$(brightnessctl --list | grep -Po '\w+::kbd_backlight')
echo "$device" > "$device_cache"
fi
# Uses regex to get volume from pactl
function get_volume {
pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '[0-9]{1,3}(?=%)' | head -1
}
# Uses regex to get mute status from pactl
function get_mute {
pactl get-sink-mute @DEFAULT_SINK@ | grep -Po '(?<=Mute: )(yes|no)'
}
# Get keyboard_brightness from brightnessctl
function get_keyboard_brightness {
if [ -n "$device" ]; then
keyboard_curr=$(brightnessctl -d "$device" get)
keyboard_max=$(brightnessctl -d "$device" max)
echo $(( keyboard_curr * 100 / keyboard_max))
fi
}
# Grabs screen brightness and formats it out of 100
function get_screen_brightness {
screen_curr=$(brightnessctl -q get)
screen_max=$(brightnessctl -q max)
echo $(( screen_curr * 100 / screen_max ))
}
# Returns a mute icon, a volume-low icon, or a volume-high icon, depending on the volume
function get_volume_icon {
volume=$(get_volume)
mute=$(get_mute)
if [ "$volume" -eq 0 ] || [ "$mute" == "yes" ] ; then
volume_icon=""
elif [ "$volume" -lt 50 ] ; then
volume_icon=""
else
volume_icon=""
fi
}
# Always returns the same icon - I couldn't get the brightness-low icon to work with fontawesome
function get_keyboard_brightness_icon {
kb_brightness=$(get_keyboard_brightness)
if [ "$kb_brightness" -eq 0 ] ; then
keyboard_brightness_icon="" # unfilled circle
elif [ "$kb_brightness" -lt 50 ] ; then
keyboard_brightness_icon="" # fa-adjust (low brightness)
else
keyboard_brightness_icon="" # full circle (high brightness)
fi
}
function get_screen_brightness_icon {
sc_brightness=$(get_screen_brightness)
if [ "$sc_brightness" -eq 0 ] ; then
screen_brightness_icon="" # unfilled circle
elif [ "$sc_brightness" -lt 50 ] ; then
screen_brightness_icon="" # fa-adjust (low brightness)
else
screen_brightness_icon="" # full circle (high brightness)
fi
}
# Displays a volume notification using notify-send
function show_volume_notif {
mute=$(get_mute)
volume=$(get_volume)
get_volume_icon
notify-send -i $volume_theme_icon -t $notification_timeout "Volume" "$volume_icon $volume%" -h int:value:$volume -h string:x-canonical-private-synchronous:volume
}
# Displays a keyboard_brightness notification
function show_keyboard_brightness_notif {
keyboard_brightness=$(get_keyboard_brightness)
# Debug Purposes:
# echo $keyboard_brightness
get_keyboard_brightness_icon
notify-send -i $keyboard_brightness_theme_icon -t $notification_timeout "Keyboard Brightness" -h string:x-dunst-stack-tag:keyboard_brightness_notif -h int:value:$keyboard_brightness "$keyboard_brightness_icon $keyboard_brightness%"
}
# Displays a screen_brightness notification
function show_screen_brightness_notif {
screen_brightness=$(get_screen_brightness)
# Debug Purposes:
# echo $screen_brightness
get_screen_brightness_icon
notify-send -i $screen_brightness_theme_icon -t $notification_timeout "Screen Brightness" -h string:x-dunst-stack-tag:screen_brightness_notif -h int:value:$screen_brightness "$screen_brightness_icon $screen_brightness%"
}
# Main function - Takes user input, "volume_up", "volume_down", "keyboard_brightness_up", "keyboard_brightness_down", "brightness_up", or "brightness_down"
case $1 in
volume_up)
# Unmutes and increases volume, then displays the notification
pactl set-sink-mute @DEFAULT_SINK@ 0
volume=$(get_volume)
if [ $(( "$volume" + "$volume_step" )) -gt $max_volume ]; then
pactl set-sink-volume @DEFAULT_SINK@ $max_volume%
else
pactl set-sink-volume @DEFAULT_SINK@ +$volume_step%
fi
show_volume_notif
;;
volume_down)
# Raises volume and displays the notification
pactl set-sink-volume @DEFAULT_SINK@ -$volume_step%
show_volume_notif
;;
volume_mute)
# Toggles mute and displays the notification
pactl set-sink-mute @DEFAULT_SINK@ toggle
show_volume_notif
;;
keyboard_brightness_up)
# Increases keyboard brightness and displays the notification
brightnessctl -d "$device" set ${keyboard_brightness_step}+
show_keyboard_brightness_notif
;;
keyboard_brightness_down)
# Decreases keyboard brightness and displays the notification
brightnessctl -d "$device" set ${keyboard_brightness_step}-
show_keyboard_brightness_notif
;;
screen_brightness_up)
# Increases screen brightness and displays the notification
brightnessctl -q set ${screen_brightness_step}%+
show_screen_brightness_notif
;;
screen_brightness_down)
# Decreases screen brightness and displays the notification
brightnessctl -q set ${screen_brightness_step}%-
show_screen_brightness_notif
;;
esac
+1 -1
View File
@@ -13,7 +13,7 @@ has_fullscreen() {
import json, subprocess, sys
def is_fullscreen(node):
if node.get('fullscreen_mode', 0) > 0: return True
if node.get('window') and node.get('fullscreen_mode', 0) > 0: return True
return any(is_fullscreen(c) for c in node.get('nodes', []) + node.get('floating_nodes', []))
def find_ws(node, name):
-19
View File
@@ -1,19 +0,0 @@
vsync = true;
use-damage = true;
# no effects — featherweight
shadow = false;
fading = false;
blur-background = false;
corner-radius = 0;
detect-transient = true;
detect-client-leader = true;
unredir-if-possible = true;
# xrender avoids picom creating its own GL context, which conflicts
# with GTK4/WebKitGTK apps (e.g. Stremio) using their own GL context
# on NVIDIA — that conflict was rendering such windows transparent.
backend = "xrender";
-26
View File
@@ -1,26 +0,0 @@
local wezterm = require 'wezterm'
local config = wezterm.config_builder()
-- Font
config.font = wezterm.font '0xProto Nerd Font'
config.font_size = 14
-- Appearance
config.color_scheme = 'Gruvbox Material (Gogh)'
config.enable_tab_bar = false
config.window_padding = {
left = 4, right = 4, top = 4, bottom = 4,
}
-- IME (set to whatever you use)
config.use_ime = true
-- config.xim_im_name = 'fcitx' -- uncomment and adjust if needed
-- Scrollback
config.scrollback_lines = 10000
-- OSC 52 — on by default, but explicit is fine
config.enable_kitty_keyboard = false -- avoid surprising keybinds
return config