Compare commits

...

5 Commits

Author SHA1 Message Date
Sheldon Lee
4feed1672f Added function to set working directory.
If a working directory is set with wdir(), bashrc will cd into the
path stored in a file written in /tmp. A new terminal will then
have a shell in that directory.

cwdir() deletes the file in /tmp and pwdir() prints the working
directory from said file if it exists.
2022-06-18 19:48:34 +08:00
Sheldon Lee
9ae8541b92 Bash profile now checks if IS_LAPTOP is set and launches i3 instead. 2022-06-17 20:20:03 +08:00
Sheldon Lee
7ce14fea34 Changed launch execs. 2022-06-13 22:45:04 +08:00
Sheldon Lee
cbf8de66c6 Corrected spelling. 2022-06-13 22:44:02 +08:00
Sheldon Lee
75172b7bc3 Color tweaks to avoid invisible text. 2022-06-12 21:09:27 +08:00
5 changed files with 46 additions and 6 deletions

View File

@ -5,7 +5,10 @@
[[ -f ~/.bashrc ]] && . ~/.bashrc [[ -f ~/.bashrc ]] && . ~/.bashrc
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
XDG_CURRENT_DESKTOP=sway exec dbus-run-session sway if [[ ! -z "$IS_LAPTOP" ]]; then
exec startx exec startx
else
exec start-sway.sh
fi
fi fi

View File

@ -35,6 +35,9 @@ if grep "arch-laptop" /etc/hostname &> /dev/null ; then
export IS_LAPTOP=1 export IS_LAPTOP=1
fi fi
# Path to store working directory
export WDIR_PATH="/tmp/$(id -u).wdir"
# include bash aliases # include bash aliases
if [ -f ~/.bash_aliases ] if [ -f ~/.bash_aliases ]
then then
@ -53,3 +56,9 @@ then
source ~/.nnn_bookmarks source ~/.nnn_bookmarks
fi fi
if [ -f $WDIR_PATH ]
then
wdir="$(cat $WDIR_PATH)"
echo "Working directory from $WDIR_PATH"
cd "$wdir"
fi

View File

@ -50,7 +50,7 @@ schemes:
# Normal colors # Normal colors
normal: normal:
black: '#073642' # base02 black: '#002b36' # base03
red: '#dc322f' # red red: '#dc322f' # red
green: '#859900' # green green: '#859900' # green
yellow: '#b58900' # yellow yellow: '#b58900' # yellow
@ -61,7 +61,7 @@ schemes:
# Bright colors # Bright colors
bright: bright:
black: '#002b36' # base03 black: '#073642' # base02
red: '#cb4b16' # orange red: '#cb4b16' # orange
green: '#586e75' # base01 green: '#586e75' # base01
yellow: '#657b83' # base00 yellow: '#657b83' # base00

View File

@ -3,8 +3,9 @@
# Copy this to ~/.config/sway/config and edit it to your liking. # Copy this to ~/.config/sway/config and edit it to your liking.
# #
# Read `man 5 sway` for a complete reference. # Read `man 5 sway` for a complete reference.
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway exec --no-startup-id dbus-update-activation-environment --all
exec /usr/libexec/polkit-gnome-authentication-agent-1 exec /usr/libexec/polkit-gnome-authentication-agent-1
exec gentoo-pipewire-launcher
### Variables ### Variables
# #

View File

@ -89,7 +89,7 @@ makemd()
pandoc -t pdf $1 -o $(basename $1 .md).pdf pandoc -t pdf $1 -o $(basename $1 .md).pdf
} }
# view zathrua in tabbed # view zathura in tabbed
tzathura() tzathura()
{ {
# rm tabbbed.xid if not running # rm tabbbed.xid if not running
@ -99,3 +99,30 @@ tzathura()
fi fi
zathura "$@" -e $(</tmp/tabbed.xid) & disown zathura "$@" -e $(</tmp/tabbed.xid) & disown
} }
wdir()
{
wdir="$PWD/$1"
[ -d "$wdir" ] && echo "$wdir" > "$WDIR_PATH" && echo "set $wdir"
}
pwdir()
{
if [ -f "$WDIR_PATH" ]
then
cat "$WDIR_PATH"
else
echo "Working directory not set."
fi
}
cwdir()
{
if [ -f "$WDIR_PATH" ]
then
rm -f "$WDIR_PATH"
echo "Cleared working directory."
else
echo "Working directory not set."
fi
}