From: Plom Heller Date: Sat, 12 Sep 2026 20:52:16 +0000 (+0200) Subject: Split home skeletons into root and user, move aliases definitions into dotfile. X-Git-Url: https://plomlompom.com/repos/add_task?a=commitdiff_plain;h=4a706eabced186100c3fa5a61283f0ed54f10595;p=confplom Split home skeletons into root and user, move aliases definitions into dotfile. --- diff --git a/home/root/.aliases b/home/root/.aliases new file mode 100644 index 0000000..f0ff635 --- /dev/null +++ b/home/root/.aliases @@ -0,0 +1,2 @@ +alias ls="ls --color=auto" + diff --git a/home/user/.aliases b/home/user/.aliases new file mode 100644 index 0000000..fbd9533 --- /dev/null +++ b/home/user/.aliases @@ -0,0 +1 @@ +alias ls="ls --color=auto" diff --git a/home/user/.config/sway/config b/home/user/.config/sway/config new file mode 100644 index 0000000..f35e643 --- /dev/null +++ b/home/user/.config/sway/config @@ -0,0 +1,100 @@ +# because these are included by /etc/sway/config for probably good reason … +include /etc/sway/config-vars.d/* +include /etc/sway/config.d/* + +# font for wm text +font pango:Terminus 16px + +# force "tabbed" as default layout for new windows +workspace_layout tabbed + +# simple green background +output * background #559911 solid_color + +# keyboard layout +input * xkb_layout "us" + +# deactivate t490s touchpad +input 1267:47:Elan_Touchpad events disabled + +# status bar +bar { + position top + tray_output none + status_command ~/.config/sway/status.py +} + +# make Windows key modifier key for all wm actions +set $mod Mod4 +floating_modifier $mod + +# move pointer in 1px units +bindsym --no-repeat $mod+h seat * cursor move -1 0 +bindsym --no-repeat $mod+j seat * cursor move 0 1 +bindsym --no-repeat $mod+k seat * cursor move 0 -1 +bindsym --no-repeat $mod+l seat * cursor move 1 0 + +# program launcher +bindsym $mod+x exec wmenu-run + +# launch terminal emulator +bindsym $mod+Return exec foot --font="Courier New:size=14.5" + +# kill window +bindsym $mod+Shift+q kill + +# move focus between windows, but not by mouse +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right +focus_follows_mouse no + +# move windows +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# resize windows +bindsym $mod+Shift+h resize shrink width 1 ppt +bindsym $mod+Shift+j resize shrink height 1 ppt +bindsym $mod+Shift+k resize grow height 1 ppt +bindsym $mod+Shift+l resize grow width 1 ppt + +# toggle fullscreen for focused window +bindsym $mod+f fullscreen + +# toggle floating of window, focus on floating or tabbed windows. +bindsym $mod+Shift+space floating toggle +bindsym $mod+space focus mode_toggle + +# reload config file +bindsym $mod+Shift+c reload + +# stop wm +bindsym $mod+Shift+p exit + +# switch workspaces +bindsym $mod+1 workspace 1 +bindsym $mod+2 workspace 2 +bindsym $mod+3 workspace 3 +bindsym $mod+4 workspace 4 +bindsym $mod+5 workspace 5 +bindsym $mod+6 workspace 6 +bindsym $mod+7 workspace 7 +bindsym $mod+8 workspace 8 +bindsym $mod+9 workspace 9 +bindsym $mod+0 workspace 10 + +# move window to workspace +bindsym $mod+Shift+1 move workspace 1 +bindsym $mod+Shift+2 move workspace 2 +bindsym $mod+Shift+3 move workspace 3 +bindsym $mod+Shift+4 move workspace 4 +bindsym $mod+Shift+5 move workspace 5 +bindsym $mod+Shift+6 move workspace 6 +bindsym $mod+Shift+7 move workspace 7 +bindsym $mod+Shift+8 move workspace 8 +bindsym $mod+Shift+9 move workspace 9 +bindsym $mod+Shift+0 move workspace 10 diff --git a/home/user/.config/sway/status.py b/home/user/.config/sway/status.py new file mode 100755 index 0000000..187b602 --- /dev/null +++ b/home/user/.config/sway/status.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 +'Sway bar status line generator.' +from json import dumps as json_dumps +from datetime import datetime +from time import sleep + +METADATA = {'version': 1} + + +if __name__ == '__main__': + print(json_dumps(METADATA)) + print('[', end='') + while True: + print(json_dumps([ + {'full_text': str(datetime.now().isoformat(' ', 'seconds'))}, + ]), end=',\n', flush=True) + sleep(1) diff --git a/home/user/.gitconfig b/home/user/.gitconfig new file mode 100644 index 0000000..a34cbf4 --- /dev/null +++ b/home/user/.gitconfig @@ -0,0 +1,3 @@ +[user] + email = plom@plomlompom.com + name = Plom Heller diff --git a/home/user/.local/bin/backlight b/home/user/.local/bin/backlight new file mode 100755 index 0000000..6273512 --- /dev/null +++ b/home/user/.local/bin/backlight @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +'Simple wrapper for manipulating backlight device brightness file(s).' +from argparse import ArgumentError, ArgumentParser +from pathlib import Path + +FILENAME_MAX = 'max_brightness' +FILENAME_TARGET = 'brightness' +PATH_BACKLIGHTS = '/sys/class/backlight' +PERCENTAGE_MIN = 0 +PERCENTAGE_MAX = 100 + +APP_DESC = 'Set backlight strength.' +ARG_NAME = 'strength' +ARG_HELP = f'percentage of possible maximum (default: {PERCENTAGE_MAX})' +ARG_ERR_RANGE = f'must be >={PERCENTAGE_MIN}, <={PERCENTAGE_MAX}' + +if __name__ == '__main__': + parser = ArgumentParser(description=APP_DESC) + arg = parser.add_argument( + ARG_NAME, + metavar=ARG_NAME.upper(), + type=int, + nargs='?', + default=PERCENTAGE_MAX, + help=ARG_HELP + ) + args = parser.parse_args() + target_percentage = getattr(args, ARG_NAME) + if not PERCENTAGE_MIN <= target_percentage <= PERCENTAGE_MAX: + parser.error(str(ArgumentError(arg, ARG_ERR_RANGE))) + for path_backlight in Path(PATH_BACKLIGHTS).iterdir(): + path_max = Path(path_backlight).joinpath(FILENAME_MAX) + path_target = Path(path_backlight).joinpath(FILENAME_TARGET) + brightness_max = int(path_max.read_text(encoding='utf8')) + target_abs = int((target_percentage / 100) * brightness_max) + path_target.write_text(f'{target_abs}\n', encoding='utf8') + print(f'set {path_backlight} to {target_percentage}% ({target_abs})') diff --git a/home_user/.config/sway/config b/home_user/.config/sway/config deleted file mode 100644 index f35e643..0000000 --- a/home_user/.config/sway/config +++ /dev/null @@ -1,100 +0,0 @@ -# because these are included by /etc/sway/config for probably good reason … -include /etc/sway/config-vars.d/* -include /etc/sway/config.d/* - -# font for wm text -font pango:Terminus 16px - -# force "tabbed" as default layout for new windows -workspace_layout tabbed - -# simple green background -output * background #559911 solid_color - -# keyboard layout -input * xkb_layout "us" - -# deactivate t490s touchpad -input 1267:47:Elan_Touchpad events disabled - -# status bar -bar { - position top - tray_output none - status_command ~/.config/sway/status.py -} - -# make Windows key modifier key for all wm actions -set $mod Mod4 -floating_modifier $mod - -# move pointer in 1px units -bindsym --no-repeat $mod+h seat * cursor move -1 0 -bindsym --no-repeat $mod+j seat * cursor move 0 1 -bindsym --no-repeat $mod+k seat * cursor move 0 -1 -bindsym --no-repeat $mod+l seat * cursor move 1 0 - -# program launcher -bindsym $mod+x exec wmenu-run - -# launch terminal emulator -bindsym $mod+Return exec foot --font="Courier New:size=14.5" - -# kill window -bindsym $mod+Shift+q kill - -# move focus between windows, but not by mouse -bindsym $mod+Left focus left -bindsym $mod+Down focus down -bindsym $mod+Up focus up -bindsym $mod+Right focus right -focus_follows_mouse no - -# move windows -bindsym $mod+Shift+Left move left -bindsym $mod+Shift+Down move down -bindsym $mod+Shift+Up move up -bindsym $mod+Shift+Right move right - -# resize windows -bindsym $mod+Shift+h resize shrink width 1 ppt -bindsym $mod+Shift+j resize shrink height 1 ppt -bindsym $mod+Shift+k resize grow height 1 ppt -bindsym $mod+Shift+l resize grow width 1 ppt - -# toggle fullscreen for focused window -bindsym $mod+f fullscreen - -# toggle floating of window, focus on floating or tabbed windows. -bindsym $mod+Shift+space floating toggle -bindsym $mod+space focus mode_toggle - -# reload config file -bindsym $mod+Shift+c reload - -# stop wm -bindsym $mod+Shift+p exit - -# switch workspaces -bindsym $mod+1 workspace 1 -bindsym $mod+2 workspace 2 -bindsym $mod+3 workspace 3 -bindsym $mod+4 workspace 4 -bindsym $mod+5 workspace 5 -bindsym $mod+6 workspace 6 -bindsym $mod+7 workspace 7 -bindsym $mod+8 workspace 8 -bindsym $mod+9 workspace 9 -bindsym $mod+0 workspace 10 - -# move window to workspace -bindsym $mod+Shift+1 move workspace 1 -bindsym $mod+Shift+2 move workspace 2 -bindsym $mod+Shift+3 move workspace 3 -bindsym $mod+Shift+4 move workspace 4 -bindsym $mod+Shift+5 move workspace 5 -bindsym $mod+Shift+6 move workspace 6 -bindsym $mod+Shift+7 move workspace 7 -bindsym $mod+Shift+8 move workspace 8 -bindsym $mod+Shift+9 move workspace 9 -bindsym $mod+Shift+0 move workspace 10 diff --git a/home_user/.config/sway/status.py b/home_user/.config/sway/status.py deleted file mode 100755 index 187b602..0000000 --- a/home_user/.config/sway/status.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python3 -'Sway bar status line generator.' -from json import dumps as json_dumps -from datetime import datetime -from time import sleep - -METADATA = {'version': 1} - - -if __name__ == '__main__': - print(json_dumps(METADATA)) - print('[', end='') - while True: - print(json_dumps([ - {'full_text': str(datetime.now().isoformat(' ', 'seconds'))}, - ]), end=',\n', flush=True) - sleep(1) diff --git a/home_user/.gitconfig b/home_user/.gitconfig deleted file mode 100644 index a34cbf4..0000000 --- a/home_user/.gitconfig +++ /dev/null @@ -1,3 +0,0 @@ -[user] - email = plom@plomlompom.com - name = Plom Heller diff --git a/home_user/.local/bin/backlight b/home_user/.local/bin/backlight deleted file mode 100755 index 6273512..0000000 --- a/home_user/.local/bin/backlight +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env python3 -'Simple wrapper for manipulating backlight device brightness file(s).' -from argparse import ArgumentError, ArgumentParser -from pathlib import Path - -FILENAME_MAX = 'max_brightness' -FILENAME_TARGET = 'brightness' -PATH_BACKLIGHTS = '/sys/class/backlight' -PERCENTAGE_MIN = 0 -PERCENTAGE_MAX = 100 - -APP_DESC = 'Set backlight strength.' -ARG_NAME = 'strength' -ARG_HELP = f'percentage of possible maximum (default: {PERCENTAGE_MAX})' -ARG_ERR_RANGE = f'must be >={PERCENTAGE_MIN}, <={PERCENTAGE_MAX}' - -if __name__ == '__main__': - parser = ArgumentParser(description=APP_DESC) - arg = parser.add_argument( - ARG_NAME, - metavar=ARG_NAME.upper(), - type=int, - nargs='?', - default=PERCENTAGE_MAX, - help=ARG_HELP - ) - args = parser.parse_args() - target_percentage = getattr(args, ARG_NAME) - if not PERCENTAGE_MIN <= target_percentage <= PERCENTAGE_MAX: - parser.error(str(ArgumentError(arg, ARG_ERR_RANGE))) - for path_backlight in Path(PATH_BACKLIGHTS).iterdir(): - path_max = Path(path_backlight).joinpath(FILENAME_MAX) - path_target = Path(path_backlight).joinpath(FILENAME_TARGET) - brightness_max = int(path_max.read_text(encoding='utf8')) - target_abs = int((target_percentage / 100) * brightness_max) - path_target.write_text(f'{target_abs}\n', encoding='utf8') - print(f'set {path_backlight} to {target_percentage}% ({target_abs})') diff --git a/setup_scripts/lib/augment_profile.sh b/setup_scripts/lib/augment_profile.sh deleted file mode 100644 index d79f767..0000000 --- a/setup_scripts/lib/augment_profile.sh +++ /dev/null @@ -1,12 +0,0 @@ -include FNAME_PROFILE -include msg - -augment_profile() { - local ALIAS_LS='alias ls="ls --color=auto"' - local PATH_PROFILE="${HOME}/${FNAME_PROFILE}" - msg 'Augmenting user %s …' "${FNAME_PROFILE}" - # test ensures idempotency - grep -qxF "${ALIAS_LS}" "${PATH_PROFILE}" 2>/dev/null\ - || echo "${ALIAS_LS}" >> "${PATH_PROFILE}" -} - diff --git a/setup_scripts/lib/link_home.sh b/setup_scripts/lib/link_home.sh new file mode 100644 index 0000000..a3ad4ad --- /dev/null +++ b/setup_scripts/lib/link_home.sh @@ -0,0 +1,22 @@ +include FNAME_PROFILE +include PATH_REPO +include msg + +link_home() { + local PATH_SKEL="${PATH_REPO}/home/$1" + local DOT_ALIASFILE='. ${HOME}/.aliases' + local PATH_PROFILE="${HOME}/${FNAME_PROFILE}" + msg 'Linking %s files into home directory …' "${PATH_SKEL}" + find "${PATH_SKEL}" -mindepth 1 -maxdepth 1 | while IFS= read -r SRC; do + DEST="${HOME}/$(basename "${SRC}")" + if [ -e "${DEST}" ] || [ -L "${DEST}" ]; then + msg 'Skipping already-found %s …' "${DEST}" + else + ln -v -s "${SRC}" "${DEST}" + fi + done + msg 'Augmenting user %s …' "${FNAME_PROFILE}" + # test ensures idempotency + grep -qxF "${DOT_ALIASFILE}" "${PATH_PROFILE}" 2>/dev/null\ + || printf '\n%s\n' "${DOT_ALIASFILE}" >> "${PATH_PROFILE}" +} diff --git a/setup_scripts/lib/start_root.sh b/setup_scripts/lib/start_root.sh index b9ee529..6cd3afb 100644 --- a/setup_scripts/lib/start_root.sh +++ b/setup_scripts/lib/start_root.sh @@ -1,7 +1,7 @@ include DIRNAME_SCRIPTS include PATH_REPO include USERNAME -include augment_profile +include link_home include msg include retry_until_success include try_quiet @@ -37,5 +37,5 @@ start_root() { msg 'Setting system timezone to %s …' "${TIMEZONE}" timedatectl set-timezone "${TIMEZONE}" - augment_profile + link_home root } diff --git a/setup_scripts/start_user.sh b/setup_scripts/start_user.sh index e7c1284..7270cb1 100755 --- a/setup_scripts/start_user.sh +++ b/setup_scripts/start_user.sh @@ -1,22 +1,5 @@ #!/bin/sh . "$(dirname "$0")/_lib.sh" -include PATH_REPO -include augment_profile -include msg +include link_home -# constants we might want to change at some point -DIRNAME_HOME_USER=home_user - -# constants derived from changeables -PATH_SKEL_USER="${PATH_REPO}/${DIRNAME_HOME_USER}" - -augment_profile -msg 'Linking %s files into home directory …' "${PATH_SKEL_USER}" -find "${PATH_SKEL_USER}" -mindepth 1 -maxdepth 1 | while IFS= read -r SRC; do - DEST="${HOME}/$(basename "${SRC}")" - if [ -e "${DEST}" ] || [ -L "${DEST}" ]; then - msg 'Skipping already-found %s …' "${DEST}" - else - ln -v -s "${SRC}" "${DEST}" - fi -done +link_home user