Compare commits

...

2 commits

Author SHA1 Message Date
95dada6c38
Autostart zsh 2025-09-16 00:34:57 +02:00
9550260b13
Merge pull request 'Add flake.nix' (#1) from flake into master
Reviewed-on: #1
2025-09-16 00:34:10 +02:00
12 changed files with 6 additions and 124 deletions

View file

@ -24,6 +24,10 @@ mkcd() {
cd "$1"
}
if [ "$PREFERRED_SHELL" = zsh ] && command -v ls > /dev/null; then
exec zsh
fi
export PS1="
$(tput bold)$(tput setaf 1)[$(tput setaf 3)\u$(tput setaf 2)@$(tput setaf 4)\H $(tput setaf 5)\w$(tput setaf 1)]$(tput setaf 7)
$ $(tput sgr0)"

View file

@ -1,6 +0,0 @@
#!/bin/sh
# select a command with dmenu_run but run it in the terminal emulator
command=$(dmenu_path | dmenu "$@")
[[ $command != "" ]] && exec urxvt -e $command

View file

@ -1,19 +0,0 @@
#!/usr/bin/python
import sys
import re
import string
alphabet = "0" + string.ascii_lowercase
goodRe = re.compile("^[0a-z]*$")
for s in [s.lower() for s in sys.argv[1:]]:
if not goodRe.match(s):
print(f"failed to decode {s}: wrong format", file=sys.stderr)
continue
result = 0
for c in s:
result *= 26
result += alphabet.index(c)
print(f"{s} = {result-1}")

View file

@ -1,3 +0,0 @@
#!/bin/sh
python ~/Documents/fi_fos $@

View file

@ -1,6 +0,0 @@
#!/bin/sh
bg_file=/tmp/$(dd if=/dev/urandom bs=8 count=1 2> /dev/null | base32).png
scrot $bg_file -q 30
convert $bg_file -blur 8x8 $bg_file
exec i3lock -i $bg_file

View file

@ -1,22 +0,0 @@
#!/bin/sh
case $1 in
same)
xrandr --output VGA-1 --same-as LVDS-1
;;
right)
xrandr --output VGA-1 --right-of LVDS-1
;;
left)
xrandr --output VGA-1 --left-of LVDS-1
;;
*)
echo $0 "same|right|left"
exit 1
;;
esac

View file

@ -1,24 +0,0 @@
#!/usr/bin/python
# runs dmenu with the first value of $@ as promt, each even value of $@ as option and the following odd value as command for that option
# for example $ ./multipromt "Power Button Pressed?" "Shutdown" "sudo shutdown now" "Reboot" "sudo reboot now" "Exit I3wm" "i3-msg exit"
import subprocess
from sys import argv
def pairs(iterable):
return zip(iterable[::2], iterable[1::2])
def demnu_select(options, promt=""):
return subprocess.run(["dmenu", "-p", promt], stdout=subprocess.PIPE, input="\n".join(options).encode("UTF-8")).stdout.decode().strip()
def main():
cmds = dict(pairs(["Abort", ""] + argv[2:]))
selected = demnu_select(cmds, argv[1])
cmd = cmds.get(selected, "").split()
if len(cmd) > 0:
subprocess.run(cmd)
if __name__ == "__main__":
main()

View file

@ -1,5 +0,0 @@
#!/bin/sh
cd ~/.programs/processing
./processing

View file

@ -1,11 +0,0 @@
#!/bin/sh
# Use dmenu to promt no or yes with $1 as promt. If the use clickes yes run $2"
# example: promt "Shutdown?" "sudo shutdown now"
posRep="Yes"
negRep="No"
choosen=$(echo -e "$negRep\n$posRep" | dmenu -p "$1")
[[ "$choosen" == "$posRep" ]] && $2

View file

@ -1,28 +0,0 @@
#!/bin/bash
# i3 thread: https://faq.i3wm.org/question/150/how-to-launch-a-terminal-from-here/?answer=152#post-id-152
CMD=$TERMINAL
CWD=''
# Get window ID
ID=$(xdpyinfo | grep focus | cut -f4 -d " ")
# Get PID of process whose window this is
PID=$(xprop -id $ID | grep -m 1 PID | cut -d " " -f 3)
# Get last child process (shell, vim, etc)
if [ -n "$PID" ]; then
TREE=$(pstree -lpA $PID | tail -n 1)
PID=$(echo $TREE | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')
# If we find the working directory, run the command in that directory
if [ -e "/proc/$PID/cwd" ]; then
CWD=$(readlink /proc/$PID/cwd)
fi
fi
if [ -n "$CWD" ]; then
cd $CWD && $CMD
else
$CMD
fi

1
_zshrc
View file

@ -30,6 +30,7 @@ function zle-keymap-select {
}
zle -N zle-keymap-select
unset PREFERRED_SHELL
[ -f "$HOME/./config/bashrc" ] && emulate sh -c "source $HOME/./config/bashrc"
[ -f "$HOME/.bashrc" ] && emulate sh -c "source $HOME/.bashrc"

View file

@ -114,6 +114,7 @@
# Environment variables only for this user/session
home.sessionVariables = {
EDITOR = "nvim";
PREFERRED_SHELL = "zsh";
};
# Good HM hygiene