1
0
mirror of https://github.com/artizirk/dotfiles.git synced 2025-07-01 01:40:21 +03:00

Compare commits

...

55 Commits

Author SHA1 Message Date
639e7cc444 Telegram changed names and earlyoom notify 2025-06-17 17:14:06 +03:00
bef9896118 fix sid laptop lid on/off 2025-05-30 00:21:12 +03:00
84ed0b01b8 Enable battery empty nag 2025-05-29 13:41:04 +03:00
44cb9c112e Move systemd-resolved configuration to the end 2025-05-29 13:39:43 +03:00
a607346209 NeoVim changed vless script location 2025-04-24 15:31:30 +03:00
16c9af02ff Snapshots to create_container 2025-04-14 15:09:09 +03:00
e26a30d88e Disable Minio CLI pager 2025-04-14 15:08:25 +03:00
0bb59ae237 Add sleep blocker script 2025-04-02 10:15:47 +03:00
9a19debb44 Don't record cursor when taking a screenshot 2025-02-17 15:33:54 +02:00
45a31ffdd0 We no longer use Drata 2025-02-17 15:33:32 +02:00
4f2775b4e4 Sway changed display naming 2025-02-17 15:32:59 +02:00
09883c3d40 Switch to dulcepan sway screenshot tool 2025-01-20 14:56:00 +02:00
9515ff6317 Fixup slack wayland patch script 2024-12-18 12:16:28 +02:00
d12e19aeb6 Add create_contaier script 2024-12-03 18:40:41 +02:00
d1cdea99af Force home-office monitor layout 2024-11-04 14:39:22 +02:00
3761124be7 Fix Wayland support for apps running under systemd 2024-11-04 14:38:36 +02:00
e50989e39a Always read custom venv prompt from config file
And ignore VIRTUAL_ENV_PROMPT variable for now as it is different
between venv and virtualenv implementations:

* https://github.com/python/cpython/pull/106726
* https://github.com/pypa/virtualenv/pull/2606
2024-10-29 16:21:14 +02:00
ee48d1a87a Switch from Krakul to Messente git config 2024-10-28 16:26:23 +02:00
8101774f52 Move global git config under XDG_CONFIG_HOME 2024-10-28 16:25:43 +02:00
7b13c2aca1 Make Evolution alarms/reminders window floating 2024-10-17 10:21:29 +03:00
7b1f76aa47 Force telegram to use GTK file dialogs 2024-10-08 22:58:41 +03:00
63d1b1b493 Swayosd-server as systemd service
for automatic restarts
2024-10-08 22:57:54 +03:00
293dabc125 Run things as systemd service and cleanup 2024-10-08 22:55:43 +03:00
6a63da1134 Add drata-agent autostart 2024-08-06 14:06:25 +03:00
08e0456290 Cleanup zshrc k8s krew config 2024-07-11 11:32:33 +03:00
f5dc53aa6d Add useful git options from blog post
* https://jvns.ca/blog/2024/02/16/popular-git-config-options/
2024-07-11 11:31:48 +03:00
7d816c971b Switch to tessen pass client 2024-06-20 16:38:15 +03:00
f42b5eb4ac Switch from tvolnoti to swayosd 2024-06-15 11:26:24 +03:00
b16c433a20 Avoid fancy chars to fix swaybar height fluctuations 2024-06-12 12:28:08 +03:00
1eabf5b21f Fix T14s scroll direction 2024-06-11 19:55:26 +03:00
df06a7af7b Try to fix xdg-desktop-portal-{gtk,wrl} 2024-06-11 16:22:43 +03:00
4a87e5957f Work PC config 2024-06-11 16:22:24 +03:00
9fe7853f49 Fix Firefox Profile switcher to use correct bin
https://github.com/null-dev/firefox-profile-switcher-connector/issues/14
2024-06-11 16:14:19 +03:00
d8954dd588 Allow arbitrary foot resize
This removes transparent border glitch on resize
2024-05-22 14:26:03 +03:00
6ff58c6916 Defaults already work well neough 2024-05-22 14:24:39 +03:00
16f7c0b069 Switch to clean PipeWire WirePlumber i3block
Old scripts were horrible hacks
2024-03-27 18:40:24 +02:00
9ce2930c6f Default to nicer git column view 2024-02-04 14:28:56 +01:00
8fc29bb93e Add slack wayland patcher 2023-12-15 15:22:47 +02:00
13c7bc29ba Turn on wayland support in slack 2023-12-15 15:20:34 +02:00
6cb276bff8 Switch to fzf based ClickUp tool 2023-12-12 18:03:46 +02:00
abbb1f8e1f Git push.autoSetupRemote=true 2023-11-13 17:29:07 +02:00
ce6ff23402 Set default xdg-desktop-portal to sway and then gtk 2023-10-17 19:33:08 +03:00
fe30aae0ba Configure zsh to emic OSC7 CWD updates to terminal 2023-09-27 17:16:47 +03:00
9359a4a193 Fx ssh TERM hack for foot term 2023-09-26 13:37:42 +03:00
c8cad40f75 Reduce number of render threads in foot
Disabling render threads has performance penalty
but more than 1 thread does not seem to help at all

default is to create `nproc` render threads
2023-09-26 13:20:48 +03:00
38b7ebcbfe Switch default terminal to foot
for that nice jump to previous prompt functinality
2023-09-26 13:03:56 +03:00
fd976244c5 Enable zsh semantic prompt 2023-09-26 13:02:47 +03:00
40a3e1571b Fixup foot terminal config 2023-09-26 12:41:51 +03:00
5d16610c57 More wezterm tweaks 2023-09-26 12:40:55 +03:00
94e8abf192 Add skeleton zsh sematntic prompt code 2023-09-26 12:02:04 +03:00
67ed4c20c9 Add note about zsh % end of line mark 2023-09-26 12:02:04 +03:00
f77b79d5e7 Add notes about always loading zprofile 2023-09-25 18:03:31 +03:00
539147433f No need to manually load vte.sh.
It's loaded by /etc/profile anyway and also it does nothing on non VTE
terminals
2023-09-25 16:19:35 +03:00
3aedfdb8ef Add basic wezterm config 2023-09-25 16:12:52 +03:00
e5c7719e37 Remove useless autoload fpath set from main .zshrc
It's already set in zshrc.pre file as required by grml-zsh-config
2023-09-25 16:10:18 +03:00
37 changed files with 517 additions and 529 deletions

136
.bin/create_container Executable file
View File

@ -0,0 +1,136 @@
#!/bin/bash
set -euo pipefail
DEFAULT_SUITE="bookworm"
BASE="/var/lib/machines"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
function show_help {
cat <<-EOF
Usage: $0 -h | -n NAME [-s SUITE] [-t [SNAPSHOT_NAME] -r] [-d]
Create a nspanw container called NAME
-h help
-n container name
-s debian suite (default: ${DEFAULT_SUITE})
-t snapshot container
-r rollback to snapshot
-d delete container
EOF
}
while getopts 'hn:s:t:rd' flag; do
case "${flag}" in
h) show_help; exit 0;;
n) name="${OPTARG}" ;;
s) suite="${OPTARG}" ;;
t) snapshot="${OPTARG}" ;;
r) rollback=1 ;;
d) delete=1 ;;
*) echo "Unexpected option ${flag}" ;;
esac
done
SUITE=${suite:-$DEFAULT_SUITE}
if [[ -z ${name:-} ]]; then
echo "Container name is unset"
echo
show_help
exit;
else
echo "Container name is $name and suite is ${SUITE}"
fi
if [[ -n ${snapshot:-} ]]; then
dest_snapshot_name="${BASE}/.${name}_${snapshot}"
if [[ -n ${rollback:-} ]]; then
if [[ -d ${dest_snapshot_name} ]]; then
btrfs subvolume delete "${BASE}/${name}"
btrfs subvolume snapshot "${dest_snapshot_name}" "${BASE}/${name}"
exit 0
else
echo "Can't rollback as '${snapshot}' does not exist"
exit 1
fi
else
btrfs subvolume snapshot -r "${BASE}/${name}" "${dest_snapshot_name}"
exit 0
fi
fi
if [[ -n ${delete:-} ]]; then
btrfs subvolume delete "${BASE}/${name}" "${BASE}/.${name}_"*
exit 0
fi
btrfs subvolume create "${BASE}/${name}"
APT_CACHE_DIR="/var/cache/apt/archives"
if [[ -d ${APT_CACHE_DIR} ]]; then
CACHE_ARGS="--cache-dir=${APT_CACHE_DIR}"
else
CACHE_ARGS=""
fi
debootstrap ${CACHE_ARGS} "${SUITE}" "${BASE}/${name}"
mkdir -p "$BASE/$name/root/.ssh"
chmod 700 "$BASE/$name/root/.ssh"
if [ -f "/root/.ssh/authorized_keys" ]; then
cp -v /root/.ssh/authorized_keys "$BASE/$name/root/.ssh/authorized_keys"
chmod 600 "$BASE/$name/root/.ssh/authorized_keys"
echo "added ssh keys to root"
fi
if [[ -e "$BASE/$name/etc/resolv.conf" ]]; then
rm "$BASE/$name/etc/resolv.conf"
fi
if [[ -e "$BASE/$name/etc/hostname" ]]; then
rm "$BASE/$name/etc/hostname"
fi
systemd-nspawn --console=pipe -D "$BASE/$name" /bin/bash <<'EOF'
echo "Now running inside nspawn $(pwd)"
source /etc/os-release
if [[ "$ID" == "ubuntu" ]]; then
sed -i '1 s/$/ restricted universe multiverse/' /etc/apt/sources.list
elif [[ "$ID" == "debian" ]]; then
if [[ $VERSION_ID -le 11 ]]; then
sed -i '1 s/$/ contrib non-free/' /etc/apt/sources.list
else
sed -i '1 s/$/ contrib non-free non-free-firmware/' /etc/apt/sources.list
fi
fi
apt-get update
apt-get install --yes --no-install-recommends locales dbus ssh python3
echo "locales locales/default_environment_locale select en_US.UTF-8" | debconf-set-selections
echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8, et_EE.UTF-8 UTF-8" | debconf-set-selections
rm /etc/locale.gen
dpkg-reconfigure --frontend noninteractive locales
ln -fs /usr/share/zoneinfo/Europe/Tallinn /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
apt install --yes --no-install-recommends neovim
update-alternatives --set editor /usr/bin/nvim
ln -sf /usr/share/nvim/runtime/macros/less.sh /usr/local/bin/vless
systemctl enable systemd-networkd
# systemd-resolved package also replaces /etc/resolv.conf with a symlink that breaks DNS in our current pre setup environment
apt install --yes --no-install-recommends libnss-resolve
# Needed by libnss-resolve config in /etc/nsswitch.conf
systemctl enable systemd-resolved
EOF

3
.bin/no-sleep Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
systemd-inhibit --what=sleep:idle --mode=block bash -c 'while true; do sleep 1; done'

2
.bin/patch-slack-wayland Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
sudo sed -i -e 's#^Exec=/usr/bin/slack -s %U$#Exec=/usr/bin/slack\ -s\ %U --enable-features=WebRTCPipeWireCapturer,UseOzonePlatform --ozone-platform=wayland#' /usr/share/applications/slack.desktop

View File

@ -1,19 +0,0 @@
#!/bin/sh
# src: https://codeberg.org/trill/dotfiles/src/branch/master/.local/bin/i3blocks/pipewire-sink.sh
# `pactl list sinks` shows sink properties with a mix of english language and local language
# defined by LANG env var, so we unset the var to guarantee only the fallback language is used
unset LANG;
sink_list="$(wpctl status | sed -n '/^Audio/,/Sink endpoints:/p' | sed -n '/Sinks:/,/|\s*$/p' | head -n -2 | tail -n +2 | tr -d '│')"
CONTENT="$sink_list"
OPTION_SELECTED=$(echo "$CONTENT" \
| rofi -dmenu -location 2 \
| sed -e 's/[^0-9]*\([0-9]*\).*/\1/g')
echo ""
if ! [[ -z "$OPTION_SELECTED" ]]; then
wpctl set-default "$OPTION_SELECTED"
fi

View File

@ -1,11 +0,0 @@
#!/bin/bash
SELECTED=$(pactl list short sinks |\
awk '{print $1 " " $2 " " $7}' |\
column -t |\
sort -k3 -r |\
rofi -dmenu -i |\
awk '{print $2}'
)
echo $SELECTED
pactl set-default-sink $SELECTED

View File

@ -4,7 +4,7 @@ pactl subscribe | grep --line-buffered "sink" |
while read; do
VOL=$(amixer get Master | grep -Po "[0-9]+(?=%)" | tail -1)
if [[ $VOL != $OLD_VOL ]]; then
tvolnoti-show $VOL
swayosd-client --output-volume=+0
OLD_VOL=$VOL
fi
done

View File

@ -1,4 +1,18 @@
#!/usr/bin/env python3
"""
Sway screenshot tool. Saved screenshots are also added to GTK recents list for easy access.
Uses following tools
* grim
* slurp
* https://codeberg.org/vyivel/dulcepan
* jq
Region selection uses dulcepan. It works by first freezing the screen so that popups sway visible.
Then it allows selection of the region you want to screenshot.
"""
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib
@ -28,16 +42,7 @@ else:
sys.exit(0)
elif sys.argv[1] == '--region':
outputs = run(['swaymsg', '-t', 'get_outputs'], check=True, capture_output=True)
for output in json.loads(outputs.stdout):
if not output.get("focused"):
continue
image = Popen(["grim", "-o", f"{output.get('name')}", '-'], stdout=PIPE)
viewer = Popen(['swayimg', '-f', '-o', f'{output.get("name")}','-'], stdin=image.stdout)
image_viewers.append(viewer)
region = run('slurp', check=True, capture_output=True)
run(["grim", '-g', '-', file_name], check=True, input=region.stdout)
run(["dulcepan", "-o", file_name], check=True)
elif sys.argv[1] == '--window':
tree = run(['swaymsg', '-t', 'get_tree'], check=True, capture_output=True)

47
.config/dulcepan.cfg Normal file
View File

@ -0,0 +1,47 @@
# An example configuration.
# RRGGBB or RRGGBBAA
unselected-color = ffffff40
selected-color = 00000000
#border-color = ffffff
border-color = 000000
#border-secondary-color = 000000
border-secondary-color = ffffff
# 0 to disable borders
border-size = 2
# Border gradient type:
# - none: only the primary border color is used
# - linear: uses a linear gradient relative to the selection
# - loop: uses a repeated linear gradient
border-gradient = none
# For "linear" gradient mode
# Counterclockwise, in degrees
gradient-angle = 45
# For "loop" gradient mode
# The distance between gradient stops
loop-step = 100
# For "linear" and "loop" gradient modes
# In milliseconds, 0 to disable animation
# With "linear" mode: the time it takes for the pattern to make one full turn
# With "loop" mode: the time it takes for the pattern to move by double the loop step
animation-duration = 1000
# If true, dulcepan will save immediately when interactive selection is stopped
# or when a whole output is selected with a mouse button.
quick-select = true
# If true, dulcepan will remember selection between runs.
# The state is stored at $XDG_CACHE_HOME/dulcepan.
persistence = false
# PNG (zlib) compression level, 0-9
png-compression = 6
# Key bindings
quit-key = Escape
save-key = Space

View File

@ -0,0 +1,2 @@
--enable-features=WaylandWindowDecorations
--ozone-platform-hint=auto

View File

@ -0,0 +1 @@
ELECTRON_OZONE_PLATFORM_HINT="auto"

View File

@ -0,0 +1 @@
LIBVA_DRIVER_NAME=i965

View File

@ -0,0 +1,2 @@
QT_QPA_PLATFORM="wayland;xcb"
QT_QPA_PLATFORMTHEME="qt5ct"

View File

@ -0,0 +1 @@
XCURSOR_SIZE=24

View File

@ -1,2 +1,3 @@
XDG_CURRENT_DESKTOP=sway
GDK_BACKEND=wayland
GDK_DEBUG=portals

View File

@ -0,0 +1 @@
{"browser_binary": "/usr/bin/firefox-developer-edition"}

View File

@ -1,9 +1,23 @@
# -*- conf -*-
[main]
font=Terminus:size=12
resize-by-cells=no
workers=1
font=Terminus:size=10
include=/usr/share/foot/themes/tango
[colors]
foreground=ffffff
[scrollback]
lines=10000
[url]
osc8-underline=always
[tweak]
#render-timer=osd
#delayed-render-lower=0
#delayed-render-upper=0
# vim: ft=dosini

View File

@ -4,6 +4,7 @@
[merge]
tool = meld
conflictStyle = zdiff3
keepbackup = false
[alias]
plog = log --graph --pretty=format:'%h -%d %s %n' --abbrev-commit --date=relative --branches
@ -27,10 +28,12 @@
smtpServerPort = 587
[diff]
wsErrorHighlight = all
algorithm = histogram
[cola]
spellcheck = false
[push]
followTags = true
autoSetupRemote = true
[gui]
spellingdictionary = en
[pull]
@ -51,7 +54,15 @@
fixes = Fixes: %h (\"%s\")
[tag]
sort = v:refname
[url "ssh://git@github.com/krakul"]
insteadOf = https://github.com/krakul
[protocol "file"]
allow = always
[column]
ui = auto
[rebase]
autosquash = true
[branch]
sort = -committerdate
[fetch]
prune = true
[includeIf "gitdir:~/code/messente/"]
path = ~/code/messente/gitconfig

View File

@ -46,11 +46,7 @@ signal=10
# The second parameter overrides the mixer selection
# See the script for details.
[volume]
command=~/.config/i3blocks/volume-pipewire -d -i 1 -H '' -M '' -L '' -X 'm'
#label=VOL
label=♪
#instance=Master
#instance=PCM
command=~/.config/i3blocks/sb-volume
interval=1
signal=10

View File

@ -7,9 +7,9 @@ if [[ "${INSTANCE}" != "" ]]; then
ARGUMENTS="--player ${INSTANCE}"
fi
ICON_PLAY=""
ICON_PAUSE=""
ICON_STOP="[]"
ICON_PLAY="( |> )"
ICON_PAUSE="( II )"
ICON_STOP="( [] )"
CUR_ICON=""
if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then

49
.config/i3blocks/sb-volume Executable file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env bash
# Borrowed from
# https://github.com/LukeSmithxyz/voidrice/blob/7a96fb100cf385e05c211937b509d2bf166299e6/.local/bin/statusbar/sb-volume
# Prints the current volume or 🔇 if muted.
function select_output {
local NEW_OUTPUT SINKS
NEW_OUTPUT=$(pw-dump | jq -r '.[] | select(.info.props."media.class"=="Audio/Sink") | "\(.id)\t\(.info.props."node.description")"' | rofi -dmenu -display-columns 2 -p "Select Audio Output" -location 2 | sed -e 's/[^0-9]*\([0-9]*\).*/\1/g')
if ! [[ -z "$NEW_OUTPUT" ]]; then
wpctl set-default "$NEW_OUTPUT"
fi
}
case $BLOCK_BUTTON in
1) select_output ;;
2) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;;
4) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ ;;
5) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- ;;
3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
- Middle click to mute.
- Scroll to change." ;;
6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
# If muted, print 🔇 and exit.
[ "$vol" != "${vol%\[MUTED\]}" ] && echo 🔇 && exit
vol="${vol#Volume: }"
split() {
# For ommiting the . without calling and external program.
IFS=$2
set -- $1
printf '%s' "$@"
}
vol="$(printf "%.0f" "$(split "$vol" ".")")"
case 1 in
$((vol >= 70)) ) icon="🔊" ;;
$((vol >= 30)) ) icon="🔉" ;;
$((vol >= 1)) ) icon="🔈" ;;
* ) echo 🔇 && exit ;;
esac
echo "$icon$vol%"

View File

@ -1,71 +0,0 @@
#!/bin/bash
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
# Copyright (C) 2014 Alexander Keller <github@nycroth.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------
# The second parameter overrides the mixer selection
# For PulseAudio users, use "pulse"
# For Jack/Jack2 users, use "jackplug"
# For ALSA users, you may use "default" for your primary card
# or you may use hw:# where # is the number of the card desired
MIXER="default"
[ -n "$(lsmod | grep pulse)" ] && MIXER="pulse"
[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug"
MIXER="${2:-$MIXER}"
# The instance option sets the control to report and configure
# This defaults to the first control of your selected mixer
# For a list of the available, use `amixer -D $Your_Mixer scontrols`
SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols |
sed -n "s/Simple mixer control '\([A-Za-z ]*\)',0/\1/p" |
head -n1
)}"
# The first parameter sets the step to change the volume by (and units to display)
# This may be in in % or dB (eg. 5% or 3dB)
STEP="${1:-5%}"
#------------------------------------------------------------------------
capability() { # Return "Capture" if the device is a capture device
amixer -D $MIXER get $SCONTROL |
sed -n "s/ Capabilities:.*cvolume.*/Capture/p"
}
volume() {
amixer -D $MIXER get $SCONTROL $(capability)
}
format() {
perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)'
perl_filter+='{CORE::say $4 eq "off" ? "MUTE" : "'
# If dB was selected, print that instead
perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
perl_filter+='"; exit}'
perl -ne "$perl_filter"
}
#------------------------------------------------------------------------
case $BLOCK_BUTTON in
1) ~/.bin/rofi_set_default_sink.sh ;;
3) amixer -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute
4) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;; # scroll up, increase
5) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease
esac
volume | format

View File

@ -1,171 +0,0 @@
#!/bin/bash
# Displays the default device, volume, and mute status for i3blocks
set -a
AUDIO_HIGH_SYMBOL=${AUDIO_HIGH_SYMBOL:-' '}
AUDIO_MED_THRESH=${AUDIO_MED_THRESH:-50}
AUDIO_MED_SYMBOL=${AUDIO_MED_SYMBOL:-' '}
AUDIO_LOW_THRESH=${AUDIO_LOW_THRESH:-0}
AUDIO_LOW_SYMBOL=${AUDIO_LOW_SYMBOL:-' '}
AUDIO_MUTED_SYMBOL=${AUDIO_MUTED_SYMBOL:-' '}
AUDIO_DELTA=${AUDIO_DELTA:-1}
DEFAULT_COLOR=${DEFAULT_COLOR:-"#ffffff"}
MUTED_COLOR=${MUTED_COLOR:-"#a0a0a0"}
LONG_FORMAT=${LONG_FORMAT:-'${SYMB} ${VOL}% [${INDEX}:${NAME}]'}
SHORT_FORMAT=${SHORT_FORMAT:-'${SYMB} ${VOL}% [${INDEX}]'}
USE_ALSA_NAME=${USE_ALSA_NAME:-0}
USE_DESCRIPTION=${USE_DESCRIPTION:-0}
SUBSCRIBE=${SUBSCRIBE:-0}
MIXER=${MIXER:-""}
SCONTROL=${SCONTROL:-""}
while getopts F:Sf:adH:M:L:X:T:t:C:c:i:m:s:h opt; do
case "$opt" in
S) SUBSCRIBE=1 ;;
F) LONG_FORMAT="$OPTARG" ;;
f) SHORT_FORMAT="$OPTARG" ;;
a) USE_ALSA_NAME=1 ;;
d) USE_DESCRIPTION=1 ;;
H) AUDIO_HIGH_SYMBOL="$OPTARG" ;;
M) AUDIO_MED_SYMBOL="$OPTARG" ;;
L) AUDIO_LOW_SYMBOL="$OPTARG" ;;
X) AUDIO_MUTED_SYMBOL="$OPTARG" ;;
T) AUDIO_MED_THRESH="$OPTARG" ;;
t) AUDIO_LOW_THRESH="$OPTARG" ;;
C) DEFAULT_COLOR="$OPTARG" ;;
c) MUTED_COLOR="$OPTARG" ;;
i) AUDIO_INTERVAL="$OPTARG" ;;
m) MIXER="$OPTARG" ;;
s) SCONTROL="$OPTARG" ;;
h) printf \
"Usage: volume-pulseaudio [-S] [-F format] [-f format] [-p] [-a|-d] [-H symb] [-M symb]
[-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-i inter]
[-m mixer] [-s scontrol] [-h]
Options:
-F, -f\tOutput format (-F long format, -f short format) to use, with exposed variables:
\${SYMB}, \${VOL}, \${INDEX}, \${NAME}
-S\tSubscribe to volume events (requires persistent block, always uses long format)
-a\tUse ALSA name if possible
-d\tUse device description instead of name if possible
-H\tSymbol to use when audio level is high. Default: '$AUDIO_HIGH_SYMBOL'
-M\tSymbol to use when audio level is medium. Default: '$AUDIO_MED_SYMBOL'
-L\tSymbol to use when audio level is low. Default: '$AUDIO_LOW_SYMBOL'
-X\tSymbol to use when audio is muted. Default: '$AUDIO_MUTED_SYMBOL'
-T\tThreshold for medium audio level. Default: $AUDIO_MED_THRESH
-t\tThreshold for low audio level. Default: $AUDIO_LOW_THRESH
-C\tColor for non-muted audio. Default: $DEFAULT_COLOR
-c\tColor for muted audio. Default: $MUTED_COLOR
-i\tInterval size of volume increase/decrease. Default: $AUDIO_DELTA
-m\tUse the given mixer.
-s\tUse the given scontrol.
-h\tShow this help text
" && exit 0;;
esac
done
if [[ -z "$MIXER" ]] ; then
MIXER="default"
if amixer -D pulse info >/dev/null 2>&1 ; then
MIXER="pulse"
fi
fi
if [[ -z "$SCONTROL" ]] ; then
SCONTROL=$(amixer -D "$MIXER" scontrols | sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | head -n1)
fi
CAPABILITY=$(amixer -D $MIXER get $SCONTROL | sed -n "s/ Capabilities:.*cvolume.*/Capture/p")
function move_sinks_to_new_default {
DEFAULT_SINK=$1
pactl list sink-inputs | grep index: | grep -o '[0-9]\+' | while read SINK
do
pactl move-sink-input $SINK $DEFAULT_SINK
done
}
function set_default_playback_device_next {
inc=${1:-1}
num_devices=$(pactl list sinks | grep -c 'Sink #')
sink_arr=($(pactl list sinks | grep 'Sink #' | grep -o '[0-9]\+'))
default_sink_index=$(( $(pactl list sinks | grep 'Sink #' | grep -no '*' | grep -o '^[0-9]\+') - 1 ))
default_sink_index=$(( ($default_sink_index + $num_devices + $inc) % $num_devices ))
default_sink=${sink_arr[$default_sink_index]}
pactl set-default-sink $default_sink
move_sinks_to_new_default $default_sink
}
case "$BLOCK_BUTTON" in
1) ~/.bin/pipewire-sink.sh ;;
2) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY toggle ;;
3) set_default_playback_device_next -1 ;;
4) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%+ ;;
5) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%- ;;
esac
function print_format {
echo "$1" | envsubst '${SYMB}${VOL}${INDEX}${NAME}'
}
function print_block {
ACTIVE=$(pactl list sinks | grep "State: RUNNING" -B4 -A55 | grep "Name:\|Volume: \(front-left\|mono\)\|Mute:\|api.alsa.pcm.card = \|node.nick = ")
for Name in NAME MUTED VOL INDEX NICK; do
read $Name
done < <(echo "$ACTIVE")
INDEX=$(echo "$INDEX" | grep -o '".*"' | sed 's/"//g')
VOL=$(echo "$VOL" | grep -o "[0-9]*%" | head -1 )
VOL="${VOL%?}"
NAME=$(echo "$NICK" | grep -o '".*"' | sed 's/"//g')
if [[ $USE_ALSA_NAME == 1 ]] ; then
ALSA_NAME=$(pactl list sinks |\
awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
grep "alsa.name\|alsa.mixer_name" |\
head -n1 |\
sed 's/.*= "\(.*\)".*/\1/')
NAME=${ALSA_NAME:-$NAME}
elif [[ $USE_DESCRIPTION == 1 ]] ; then
DESCRIPTION=$(pactl list sinks | grep "State: RUNNING" -B4 -A55 | grep 'Description: ' | sed 's/^.*: //')
NAME=${DESCRIPTION:-$NAME}
fi
if [[ $MUTED =~ "no" ]] ; then
SYMB=$AUDIO_HIGH_SYMBOL
[[ $VOL -le $AUDIO_MED_THRESH ]] && SYMB=$AUDIO_MED_SYMBOL
[[ $VOL -le $AUDIO_LOW_THRESH ]] && SYMB=$AUDIO_LOW_SYMBOL
COLOR=$DEFAULT_COLOR
else
SYMB=$AUDIO_MUTED_SYMBOL
COLOR=$MUTED_COLOR
fi
if [[ $ACTIVE = "" ]] ; then
echo "Sound inactive"
COLOR='#222225'
fi
if [[ $SUBSCRIBE == 1 ]] ; then
print_format "$LONG_FORMAT"
else
print_format "$LONG_FORMAT"
print_format "$SHORT_FORMAT"
echo "$COLOR"
fi
}
print_block
if [[ $SUBSCRIBE == 1 ]] ; then
while read -r EVENT; do
print_block
done < <(pactl subscribe | stdbuf -oL grep change)
fi

View File

@ -1,180 +0,0 @@
#!/usr/bin/env bash
# Displays the default device, volume, and mute status for i3blocks
set -a
AUDIO_HIGH_SYMBOL=${AUDIO_HIGH_SYMBOL:-' '}
AUDIO_MED_THRESH=${AUDIO_MED_THRESH:-50}
AUDIO_MED_SYMBOL=${AUDIO_MED_SYMBOL:-' '}
AUDIO_LOW_THRESH=${AUDIO_LOW_THRESH:-0}
AUDIO_LOW_SYMBOL=${AUDIO_LOW_SYMBOL:-' '}
AUDIO_MUTED_SYMBOL=${AUDIO_MUTED_SYMBOL:-' '}
AUDIO_DELTA=${AUDIO_DELTA:-5}
DEFAULT_COLOR=${DEFAULT_COLOR:-"#ffffff"}
MUTED_COLOR=${MUTED_COLOR:-"#a0a0a0"}
LONG_FORMAT=${LONG_FORMAT:-'${SYMB} ${VOL}% [${INDEX}:${NAME}]'}
SHORT_FORMAT=${SHORT_FORMAT:-'${SYMB} ${VOL}% [${INDEX}]'}
USE_ALSA_NAME=${USE_ALSA_NAME:-0}
USE_DESCRIPTION=${USE_DESCRIPTION:-0}
SUBSCRIBE=${SUBSCRIBE:-0}
MIXER=${MIXER:-""}
SCONTROL=${SCONTROL:-""}
while getopts F:Sf:adH:M:L:X:T:t:C:c:i:m:s:h opt; do
case "$opt" in
S) SUBSCRIBE=1 ;;
F) LONG_FORMAT="$OPTARG" ;;
f) SHORT_FORMAT="$OPTARG" ;;
a) USE_ALSA_NAME=1 ;;
d) USE_DESCRIPTION=1 ;;
H) AUDIO_HIGH_SYMBOL="$OPTARG" ;;
M) AUDIO_MED_SYMBOL="$OPTARG" ;;
L) AUDIO_LOW_SYMBOL="$OPTARG" ;;
X) AUDIO_MUTED_SYMBOL="$OPTARG" ;;
T) AUDIO_MED_THRESH="$OPTARG" ;;
t) AUDIO_LOW_THRESH="$OPTARG" ;;
C) DEFAULT_COLOR="$OPTARG" ;;
c) MUTED_COLOR="$OPTARG" ;;
i) AUDIO_DELTA="$OPTARG" ;;
m) MIXER="$OPTARG" ;;
s) SCONTROL="$OPTARG" ;;
h) printf \
"Usage: volume-pulseaudio [-S] [-F format] [-f format] [-p] [-a|-d] [-H symb] [-M symb]
[-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-i inter]
[-m mixer] [-s scontrol] [-j] [-h]
Options:
-F, -f\tOutput format (-F long format, -f short format) to use, with exposed variables:
\${SYMB}, \${VOL}, \${INDEX}, \${NAME}
-S\tSubscribe to volume events (requires persistent block, always uses long format)
-a\tUse ALSA name if possible
-d\tUse device description instead of name if possible
-H\tSymbol to use when audio level is high. Default: '$AUDIO_HIGH_SYMBOL'
-M\tSymbol to use when audio level is medium. Default: '$AUDIO_MED_SYMBOL'
-L\tSymbol to use when audio level is low. Default: '$AUDIO_LOW_SYMBOL'
-X\tSymbol to use when audio is muted. Default: '$AUDIO_MUTED_SYMBOL'
-T\tThreshold for medium audio level. Default: $AUDIO_MED_THRESH
-t\tThreshold for low audio level. Default: $AUDIO_LOW_THRESH
-C\tColor for non-muted audio. Default: $DEFAULT_COLOR
-c\tColor for muted audio. Default: $MUTED_COLOR
-i\tInterval size of volume increase/decrease. Default: $AUDIO_DELTA
-m\tUse the given mixer.
-s\tUse the given scontrol.
-h\tShow this help text
" && exit 0;;
esac
done
if [[ -z "$MIXER" ]] ; then
MIXER="default"
if amixer -D pulse info >/dev/null 2>&1 ; then
MIXER="pulse"
fi
fi
if [[ -z "$SCONTROL" ]] ; then
SCONTROL=$(amixer -D "$MIXER" scontrols | sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | head -n1)
fi
CAPABILITY=$(amixer -D $MIXER get $SCONTROL | sed -n "s/ Capabilities:.*cvolume.*/Capture/p")
function move_sinks_to_new_default {
DEFAULT_SINK=$1
pacmd list-sink-inputs | grep index: | grep -o '[0-9]\+' | while read SINK
do
pacmd move-sink-input $SINK $DEFAULT_SINK
done
}
function set_default_playback_device_next {
inc=${1:-1}
num_devices=$(pacmd list-sinks | grep -c index:)
sink_arr=($(pacmd list-sinks | grep index: | grep -o '[0-9]\+'))
default_sink_index=$(( $(pacmd list-sinks | grep index: | grep -no '*' | grep -o '^[0-9]\+') - 1 ))
default_sink_index=$(( ($default_sink_index + $num_devices + $inc) % $num_devices ))
default_sink=${sink_arr[$default_sink_index]}
pacmd set-default-sink $default_sink
move_sinks_to_new_default $default_sink
}
case "$BLOCK_BUTTON" in
1) set_default_playback_device_next ;;
2) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY toggle ;;
3) set_default_playback_device_next -1 ;;
4) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%+ ;;
5) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%- ;;
esac
function print_format {
if [[ $markup == "pango" ]] ; then
output="<span color=\"$2\">$1</span>"
else
output=$1
fi
echo "$output" | envsubst '${SYMB}${VOL}${INDEX}${NAME}'
}
function print_block {
ACTIVE=$(pacmd list-sinks | grep "state: RUNNING" -B4 -A7 | grep "index:\|name:\|volume: \(front\|mono\)\|muted:")
[ -z "$ACTIVE" ] && ACTIVE=$(pacmd list-sinks | grep "index:\|name:\|volume: \(front\|mono\)\|muted:" | grep -A3 '*')
for name in INDEX NAME VOL MUTED; do
read $name
done < <(echo "$ACTIVE")
INDEX=$(echo "$INDEX" | grep -o '[0-9]\+')
VOL=$(echo "$VOL" | grep -o "[0-9]*%" | head -1 )
VOL="${VOL%?}"
NAME=$(echo "$NAME" | sed \
's/.*<.*\.\(.*\)>.*/\1/; t;'\
's/.*<\(.*\)>.*/\1/; t;'\
's/.*/unknown/')
if [[ $USE_ALSA_NAME == 1 ]] ; then
ALSA_NAME=$(pacmd list-sinks |\
awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
grep "alsa.name\|alsa.mixer_name" |\
head -n1 |\
sed 's/.*= "\(.*\)".*/\1/')
NAME=${ALSA_NAME:-$NAME}
elif [[ $USE_DESCRIPTION == 1 ]] ; then
DESCRIPTION=$(pacmd list-sinks |\
awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
grep "device.description" |\
head -n1 |\
sed 's/.*= "\(.*\)".*/\1/')
NAME=${DESCRIPTION:-$NAME}
fi
if [[ $MUTED =~ "no" ]] ; then
SYMB=$AUDIO_HIGH_SYMBOL
[[ $VOL -le $AUDIO_MED_THRESH ]] && SYMB=$AUDIO_MED_SYMBOL
[[ $VOL -le $AUDIO_LOW_THRESH ]] && SYMB=$AUDIO_LOW_SYMBOL
COLOR=$DEFAULT_COLOR
else
SYMB=$AUDIO_MUTED_SYMBOL
COLOR=$MUTED_COLOR
fi
print_format "$LONG_FORMAT" $COLOR
if [[ $SUBSCRIBE != 1 ]] ; then
print_format "$SHORT_FORMAT" $COLOR
echo $COLOR
fi
}
print_block
if [[ $SUBSCRIBE == 1 ]] ; then
while read -r EVENT; do
print_block
done < <(pactl subscribe | stdbuf -oL grep change)
fi

View File

@ -1,4 +1,5 @@
configuration {
font: "Terminus 12";
run-command: "bash -c 'systemd-run --user --unit=app-rofi-\$(systemd-escape \"{cmd}\")-\$RANDOM {cmd}'";
}
@theme "/usr/share/rofi/themes/android_notification.rasi"

View File

@ -2,20 +2,25 @@
for_window [workspace=$chat_workspace] layout tabbed
for_window [app_id="evolution"] move to workspace $chat_workspace
exec evolution
for_window [app_id="org.gnome.Evolution"] move to workspace $chat_workspace
exec systemd-run --user --unit=evolution /usr/bin/evolution
for_window [app_id="org.kde.quassel"] move to workspace $chat_workspace
for_window [app_id="quasselclient"] move to workspace $chat_workspace
exec quasselclient
exec systemd-run --user --unit=quasselclient /usr/bin/quasselclient
for_window [class="Element"] move to workspace $chat_workspace
exec element-desktop
for_window [app_id="Element"] move to workspace $chat_workspace
exec systemd-run --user --unit=element-desktop /usr/bin/element-desktop
for_window [class="Slack"] move to workspace $chat_workspace
for_window [app_id="Slack"] move to workspace $chat_workspace
exec slack --enable-features=WebRTCPipeWireCapturer
exec flatpak run com.slack.Slack
exec systemd-run --user --unit=slack /usr/bin/slack --enable-features=WaylandWindowDecorations,WebRTCPipeWireCapturer --ozone-platform-hint=auto
exec systemd-run --user --unit=slack-flatpak /usr/bin/flatpak run com.slack.Slack
for_window [app_id="telegramdesktop"] move to workspace $chat_workspace
for_window [app_id="org.telegram.desktop"] move to workspace $chat_workspace
exec telegram-desktop
exec systemd-run --user --unit=telegram /usr/bin/env XDG_CURRENT_DESKTOP=GNOME Telegram
# for earlyoom notifications
exec systemd-run --user --unit=systembus-notify /usr/bin/systembus-notify

View File

@ -1,12 +0,0 @@
# Work computer
set $left_disp "Dell Inc. DELL U2719D 3PFNP83"
set $right_disp "Dell Inc. DELL U2719D JNFNP83"
set $chat_workspace 10
output $left_disp pos 0 0
output $right_disp pos 2560 0
input * {
xkb_numlock disabled
}

View File

@ -24,8 +24,7 @@ set $bg "~/Pildid/background.png"
set $lockcmd ~/.bin/swaylock.sh $bg
# Your preferred terminal emulator
#set $term gnome-terminal
set $term alacritty
set $term foot
# Your preferred application launcher
# None: it's recommended that you pass the final command to sway
set $menu rofi -show combi -modes combi -combi-modes "drun,run" -show-icons -normal-window
@ -54,7 +53,7 @@ exec xrdb -load ~/.Xresources
exec mako
# Volume and Brightness notification
exec tvolnoti -n -T dark
#exec swayosd-server # started via systemd for Restart=always
# Monitor volume changes
exec ~/.bin/volume_subscribe.sh
@ -76,7 +75,8 @@ exec card_eventmgr config_file=.config/pam_pkcs11/card_eventmgr.conf
exec swayidle \
timeout 300 '$lockcmd' \
timeout 600 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
resume 'swaymsg "output * dpms on"' \
after-resume 'swaymsg "output * enable"' \
before-sleep '$lockcmd' \
lock '$lockcmd' \
unlock 'pkill -9 swaylock'
@ -87,17 +87,13 @@ for_window [class="Firefox"] inhibit_idle fullscreen
# wayland vesion
for_window [app_id="firefox"] inhibit_idle fullscreen
# Start autotiling script
#exec autotiling
# Lock screen with scroll lock button
bindsym Scroll_Lock exec $lockcmd
# Alt+Tab window switcher
bindsym Alt+Tab exec ~/.bin/switch_window.py
bindsym $mod+c exec ~/code/krakul/internal/cutool-rofi/contrib/rofi_time_tracker.py
bindsym $mod+p exec tessen
# Hack that adds a emoji to all window titles so that title height is somewhat constant
# You can read mode about this here https://github.com/swaywm/sway/issues/3114
@ -261,8 +257,8 @@ bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
#brightness control
bindsym XF86MonBrightnessUp exec brightnessctl -m set +5% | cut -d',' -f4 | cut -d'%' -f1 | xargs -n1 tvolnoti-show -s ~/.config/tvolnoti/themes/dark/display_brightness.svg
bindsym XF86MonBrightnessDown exec brightnessctl -m set 5%- | cut -d',' -f4 | cut -d'%' -f1 | xargs -n1 tvolnoti-show -s ~/.config/tvolnoti/themes/dark/display_brightness.svg
bindsym XF86MonBrightnessUp exec swayosd-client --brightness=+5
bindsym XF86MonBrightnessDown exec swayosd-client --brightness=-5
# Authy 2FA window
for_window [title="^Authy$"] floating enable
@ -277,9 +273,8 @@ for_window [class="Rofi"] floating enable
for_window [instance="Browser" window_role="About"] floating enable
for_window [title="Firefox - Jagamise indikaator"] floating enable
# Work TK app
for_window [title="Device Programmer"] floating enable
for_window [app_id="eu.krakul.SportScientiaTool"] floating enable
# Evolution Alarms window
for_window [app_id="evolution-alarm-notify"] floating enable
# JetBrains
@ -299,6 +294,7 @@ for_window [title="Microsoft Teams Notification"] move absolute position 0 px 0
for_window [title="Slack \| mini panel"] move scratchpad
for_window [class="Simplicity Studio™" title="Find\/Replace "] floating enable
for_window [app_id="gnome-calculator"] floating enable
for_window [class="drata-agent"] move absolute position 2160 px 0 px
# screenshots
bindsym Print exec ~/.bin/wscreenshot.py
@ -358,6 +354,10 @@ input 1267:32:Elan_TrackPoint {
accel_profile "flat"
}
input 1267:12693:ELAN0676:00_04F3:3195_Touchpad {
natural_scroll enabled
}
input 1133:16534:Logitech_ERGO_M575 {
pointer_accel 0.5
scroll_method on_button_down
@ -365,4 +365,8 @@ input 1133:16534:Logitech_ERGO_M575 {
}
include /etc/sway/config.d/*
exec systemctl --user set-environment XDG_CURRENT_DESKTOP=sway
exec systemctl --user set-environment DESKTOP_SESSION=sway
exec systemctl --user set-environment XDG_SESSION_DESKTOP=sway
exec systemctl --user set-environment XDG_SESSION_TYPE=wayland
include autostart

25
.config/sway/hiir Normal file
View File

@ -0,0 +1,25 @@
# Work computer
exec /usr/bin/swaynag-battery --threshold 5
set $left_disp "Dell Inc. DELL U2724DE C9YPBP3"
set $right_disp "Dell Inc. DELL U2724D J3XFCP3"
#set $left_disp "Dell Inc. DELL S2721DGF 8SVBP83"
output "Dell Inc. DELL S2721DGF 8SVBP83" pos 0 0
#set $right_disp "Dell Inc. DELL U2715H GH85D66Q08QS"
output "Dell Inc. DELL U2715H GH85D66Q08QS" pos 2560 0
set $chat_workspace 10
output $left_disp pos 0 0
output $left_disp mode 2560x1440@120.000Hz
output $right_disp pos 2560 0
output $right_disp mode 2560x1440@120.000Hz
set $laptop eDP-1
bindswitch lid:on output $laptop disable
bindswitch lid:off output $laptop enable
input * {
xkb_numlock disabled
}

View File

@ -5,5 +5,10 @@ exec /usr/bin/swaynag-battery --threshold 5
#set $right_disp "Unknown 0x0791 0x00000000"
set $chat_workspace 10
set $laptop eDP-1
bindswitch lid:on output $laptop disable
bindswitch lid:off output $laptop enable
output $left_disp pos 0 0
output $right_disp pos 370 1440

View File

@ -0,0 +1 @@
/home/arti/.config/systemd/user/swayosd-server.service

View File

@ -0,0 +1,11 @@
[Unit]
Description=SwayOSD Server
[Service]
Type=simple
ExecStart=/usr/bin/swayosd-server
Restart=always
RestartSec=10s
[Install]
WantedBy=default.target

View File

@ -0,0 +1,49 @@
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This table will hold the configuration.
local config = {}
-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
config = wezterm.config_builder()
end
-- This is where you actually apply your config choices
config.font = wezterm.font 'Terminus'
config.adjust_window_size_when_changing_font_size = false
config.color_scheme = 'Tango (base16)'
config.colors = {
-- The default text color
foreground = 'white',
-- The default background color
background = 'black',
}
config.use_fancy_tab_bar = false
config.hide_tab_bar_if_only_one_tab = true
config.window_padding = {
left = 0,
right = 0,
top = 0,
bottom = 0,
}
front_end = "WebGpu"
config.enable_kitty_keyboard = true
local act = wezterm.action
config.keys = {
{ key = 'Z', mods = 'CTRL|SHIFT', action = act.ScrollToPrompt(-1) },
{ key = 'X', mods = 'CTRL|SHIFT', action = act.ScrollToPrompt(1) },
}
-- and finally, return the configuration to wezterm
return config

View File

@ -0,0 +1,12 @@
function osc7-pwd() {
emulate -L zsh # also sets localoptions for us
setopt extendedglob
local LC_ALL=C
printf '\e]7;file://%s%s\e\' $HOST ${PWD//(#m)([^@-Za-z&-;_~])/%${(l:2::0:)$(([##16]#MATCH))}}
}
function chpwd-osc7-pwd() {
(( ZSH_SUBSHELL )) || osc7-pwd
}
add-zsh-hook -Uz chpwd chpwd-osc7-pwd

View File

@ -0,0 +1,25 @@
_prompt_executing=""
function __prompt_precmd() {
local ret="$?"
if test "$_prompt_executing" != "0"
then
_PROMPT_SAVE_PS1="$PS1"
_PROMPT_SAVE_PS2="$PS2"
PS1=$'%{\e]133;P;k=i\a%}'$PS1$'%{\e]133;B\a\e]122;> \a%}'
PS2=$'%{\e]133;P;k=s\a%}'$PS2$'%{\e]133;B\a%}'
fi
if test "$_prompt_executing" != ""
then
printf "\033]133;D;%s;aid=%s\007" "$ret" "$$"
fi
printf "\033]133;A;cl=m;aid=%s\007" "$$"
_prompt_executing=0
}
function __prompt_preexec() {
PS1="$_PROMPT_SAVE_PS1"
PS2="$_PROMPT_SAVE_PS2"
printf "\033]133;C;\007"
_prompt_executing=1
}
preexec_functions+=(__prompt_preexec)
precmd_functions+=(__prompt_precmd)

View File

@ -0,0 +1,22 @@
[Desktop Entry]
Name=Telegram Desktop
Comment=Official desktop version of Telegram messaging app
TryExec=env XDG_CURRENT_DESKTOP=GNOME telegram-desktop
Exec=env XDG_CURRENT_DESKTOP=GNOME telegram-desktop -- %u
Icon=telegram
Terminal=false
StartupWMClass=TelegramDesktop
Type=Application
Categories=Chat;Network;InstantMessaging;Qt;
MimeType=x-scheme-handler/tg;x-scheme-handler/tonsite;
Keywords=tg;chat;im;messaging;messenger;sms;tdesktop;
Actions=quit;
DBusActivatable=true
SingleMainWindow=true
X-GNOME-UsesNotifications=true
X-GNOME-SingleWindow=true
[Desktop Action quit]
Exec=env XDG_CURRENT_DESKTOP=GNOME telegram-desktop -quit
Name=Quit Telegram
Icon=application-exit

60
.zshrc
View File

@ -1,18 +1,12 @@
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
# so that i can autoload -Uz local functions
fpath=( ~/.config/zsh/functions $fpath)
# Use a REAL regex engine
zmodload zsh/pcre
# Virtualenv support
function _virtual_env_prompt () {
# new pyvenv has a seperate variable for custom prompt value
REPLY=${VIRTUAL_ENV_PROMPT+${VIRTUAL_ENV_PROMPT}}
# Try to read the prompt name form pyvenv.cfg
if [[ -z "${REPLY}" && -f "$VIRTUAL_ENV/pyvenv.cfg" ]]; then
if [[ -f "$VIRTUAL_ENV/pyvenv.cfg" ]]; then
# Matches lines with following syntax
# prompt = 'cool prompt'
# prompt = "cool prompt"
@ -35,7 +29,7 @@ function _virtual_env_prompt () {
fi
fi
# support old-school virtualenv
# fall back to using venv folder name as prompt name
if [[ -z "${REPLY}" ]]; then
REPLY=${VIRTUAL_ENV+(${VIRTUAL_ENV:t}) }
fi
@ -52,6 +46,18 @@ zstyle ':prompt:grml:left:setup' items rc config-env virtual-env change-root use
# Disable right side sad smiley, works nicer with resized terminal
zstyle ':prompt:grml:right:setup' use-rprompt false
# disable PROMPT_EOL_MARK or also known as % on end of line
# https://unix.stackexchange.com/a/302710
#set +o prompt_cr +o prompt_sp
# Tell to the terminal about our current working directory
# NB: turns out that alacritty snopps that info from /proc/PID/cwd
xsource ~/.config/zsh/functions/osc7-pwd.zsh
# enable OSC 133 shell prompt start/end reporting
# so that the terminal can scroll jump between prompts
xsource ~/.config/zsh/functions/semantic-prompt.zsh
# Git based dotfiles setup start
function _config_activate {
export GIT_DIR=$HOME/.cfg/
@ -89,14 +95,14 @@ function config {
# git based dotfiles setup end
# GRML profiles
zstyle ':chpwd:profiles:/home/arti/code/krakul(|/|/*)' profile krakul
function chpwd_profile_krakul() {
zstyle ':chpwd:profiles:/home/arti/code/messente(|/|/*)' profile messente
function chpwd_profile_messente() {
[[ ${profile} == ${CHPWD_PROFILE} ]] && return 1
export GIT_AUTHOR_EMAIL="arti@krakul.eu"
export GIT_COMMITTER_EMAIL="arti@krakul.eu"
export GIT_AUTHOR_EMAIL="arti.zirk@messente.com"
export GIT_COMMITTER_EMAIL="arti.zirk@messente.com"
}
function chpwd_leave_profile_krakul() {
function chpwd_leave_profile_messente() {
[[ ${profile} == ${CHPWD_PROFILE} ]] && return 1
unset GIT_AUTHOR_EMAIL \
@ -112,11 +118,11 @@ zstyle ':completion:*:*:git:*' user-commands subrepo:'perform git-subrepo operat
# First clear grml-zsh-config provided directory hashes
hash -d -r
# shorten dir name in prompt
hash -d krakul=~/code/krakul
hash -d messente=~/code/messente
function hash_projects() {
# hash everything under krakul projects
# hash everything under messente projects
local project_folder
for project_folder in ~/code/krakul/*; do
for project_folder in ~/code/messente/*; do
hash -d "${project_folder:t}"="${project_folder}"
done
unset project_folder
@ -144,8 +150,6 @@ chpwd_auto_python_venv # Try to enter venv on shell startup
# https://github.com/Tarrasch/zsh-autoenv
xsource ~/.config/zsh/zsh-autoenv/autoenv.zsh
# Set gnome-terminal and other vte terminal title to current dir
xsource /etc/profile.d/vte.sh
# gitflow-zshcompletion-avh
xsource /usr/share/zsh/site-functions/git-flow-completion.zsh
# pkg not found
@ -244,19 +248,27 @@ else
ruby_gem_user_dir=''
fi
# kubectl plugin manager Krew
export KREW_ROOT="~/.config/krew"
if [[ -d "${KREW_ROOT}/bin" ]]; then
krew_bin_path="${KREW_ROOT}/bin"
else
krew_bin_path=''
fi
# ZSH allows $PATH to be used as an array
path=(
~/.bin
~/.local/bin
${ruby_gem_user_dir}
${krew_bin_path}
/usr/bin/site_perl
/usr/bin/vendor_perl
/usr/bin/core_perl
"${ruby_gem_user_dir}"
$path
)
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
HISTSIZE=100000
SAVEHIST=100000
@ -298,7 +310,7 @@ function npm {
function ssh {
(
if [[ "$TERM" == "alacritty" ]]; then
if [[ "$TERM" == "foot" ]]; then
export TERM=xterm-256color
fi
exec /usr/bin/ssh $@
@ -307,6 +319,8 @@ function ssh {
# i don't like that systemd by default uses a pager
export SYSTEMD_PAGER=''
# Minio CLI is also stupid
export MC_DISABLE_PAGER=1
# set man max width
export MANWIDTH=80
@ -321,7 +335,7 @@ fi
# https://neovim.io/doc/user/various.html#less
function vless {
/usr/share/nvim/runtime/macros/less.sh $@
/usr/share/nvim/runtime/scripts/less.sh $@
}
# If running under windows with pageagent then use it

View File

@ -1,2 +1,8 @@
# Load zprofile for interactive prompts
# Some packages configure environment variables via this way
#if [[ ! -o login && -o interactive ]]; then
# source /etc/zsh/zprofile
#fi
# so that i can autoload -Uz local functions
fpath=( ~/.config/zsh/functions $fpath)