diff options
author | B. Stack <bgstack15@gmail.com> | 2022-11-03 19:00:04 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-11-03 19:28:46 -0400 |
commit | ff8fb3958338891bc683b1ce510885f48eff4d17 (patch) | |
tree | 7142a4061d50de6475763e4b2443ee6c2ebe3f70 /src | |
download | stackrpms-acer-chromebook-ff8fb3958338891bc683b1ce510885f48eff4d17.tar.gz stackrpms-acer-chromebook-ff8fb3958338891bc683b1ce510885f48eff4d17.tar.bz2 stackrpms-acer-chromebook-ff8fb3958338891bc683b1ce510885f48eff4d17.zip |
initial commit
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/stackrpms-thinkpad-p50s/Xmodmap | 20 | ||||
-rw-r--r-- | src/etc/stackrpms-thinkpad-p50s/fluxbox.keys | 195 | ||||
-rw-r--r-- | src/etc/stackrpms-thinkpad-p50s/fluxbox.startup | 71 | ||||
-rwxr-xr-x | src/usr/bin/hwset-thinkpad-p50s | 379 | ||||
-rwxr-xr-x | src/usr/bin/netmounts-off | 3 | ||||
-rwxr-xr-x | src/usr/bin/netmounts-on | 2 | ||||
-rwxr-xr-x | src/usr/bin/netmounts-trayicon | 68 | ||||
-rwxr-xr-x | src/usr/bin/vpn-off | 2 | ||||
-rwxr-xr-x | src/usr/bin/vpn-on | 2 | ||||
-rwxr-xr-x | src/usr/bin/vpn-trayicon | 63 | ||||
-rw-r--r-- | src/usr/share/doc/stackrpms-thinkpad-p50s/README.md | 37 | ||||
-rw-r--r-- | src/usr/share/icons/hicolor/scalable/status/netmounts-off.svg | 4 | ||||
-rw-r--r-- | src/usr/share/icons/hicolor/scalable/status/netmounts-on.svg | 4 | ||||
-rw-r--r-- | src/usr/share/icons/hicolor/scalable/status/vpn-off.svg | 4 | ||||
-rw-r--r-- | src/usr/share/icons/hicolor/scalable/status/vpn-on.svg | 4 |
15 files changed, 858 insertions, 0 deletions
diff --git a/src/etc/stackrpms-thinkpad-p50s/Xmodmap b/src/etc/stackrpms-thinkpad-p50s/Xmodmap new file mode 100644 index 0000000..8d9cee6 --- /dev/null +++ b/src/etc/stackrpms-thinkpad-p50s/Xmodmap @@ -0,0 +1,20 @@ +! File: /etc/stackrpms-thinkpad-p50s/Xmodmap +! Location: stackrpms-thinkpad-p50s package +! Author: bgstack15 +! SPDX-License-Identifier: GPL-3.0 +! Startdate: 2019-12-26 +! Title: Common Xmodmap for Thinkpad P50s platform +! Package: stackrpms-thinkpad-p50s +! Purpose: custom Xmodmap for Thinkpad P50s +! History: +! 2022-11-03 adapted for package +! Usage: +! in ~/.fluxbox/startup (possibly symlinked to /etc/stackrpms-thinkpad-p50s/fluxbox.startup), run `xmodmap /etc/stackrpms-thinkpad-p50s/Xmodmap` +! Reference: +! xev +! Improve: +! Documentation: +! last modified: 2022-11-03-5 14:36 + +! turn calculator key into context menu key +keycode 148 = Menu diff --git a/src/etc/stackrpms-thinkpad-p50s/fluxbox.keys b/src/etc/stackrpms-thinkpad-p50s/fluxbox.keys new file mode 100644 index 0000000..20f0378 --- /dev/null +++ b/src/etc/stackrpms-thinkpad-p50s/fluxbox.keys @@ -0,0 +1,195 @@ +# File: /etc/stackrpms-thinkpad-p50s/fluxbox.keys +# Location: stackrpms-thinkpad-p50s package +# Author: bgstack15 +# Startdate: 2019-12-26 +# SPDX-License-Identifier: GPL-3.0 +# Title: Common fluxbox keys for Thinkpad P50s platform +# Package: stackrpms-thinkpad-p50s +# Purpose: standardize fluxbox config across systems +# History: +# 2019-12-26 started on ltb-018 +# 2022-11-03 adapted for this package +# Usage: +# symlink your ~/.fluxbox/keys to this file with: +# ln -sf /etc/stackrpms-thinkpad-p50s/fluxbox.keys ~/.fluxbox/keys +# Reference: +# ltb-018:~/.fluxbox/keys +# Improve: +# Documentation: +# last modified: 2022-11-03-5 14:28 + +# click on the desktop to get menus +OnDesktop Mouse1 :HideMenus +OnDesktop Mouse2 :WorkspaceMenu +OnDesktop Mouse3 :RootMenu + +Ctrl Shift Escape :RootMenu + +# scroll on the desktop to change workspaces +OnDesktop Mouse4 :PrevWorkspace +OnDesktop Mouse5 :NextWorkspace + +# scroll on the toolbar to change current window +# disabling these allows the alsa icon to work +#OnToolbar Mouse4 :PrevWindow {static groups} (iconhidden=no) +#OnToolbar Mouse5 :NextWindow {static groups} (iconhidden=no) + +# alt + left/right click to move/resize a window +OnWindow Mod1 Mouse1 :MacroCmd {Raise} {Focus} {StartMoving} +OnWindowBorder Move1 :StartMoving + +OnWindow Mod1 Mouse3 :MacroCmd {Raise} {Focus} {StartResizing NearestCorner} +OnLeftGrip Move1 :StartResizing bottomleft +OnRightGrip Move1 :StartResizing bottomright + +# alt + middle click to lower the window +OnWindow Mod1 Mouse2 :Lower + +# control-click a window's titlebar and drag to attach windows +OnTitlebar Ctrl Mouse1 :StartTabbing + +# double click on the titlebar to maximize instead of shade +OnTitlebar Double Mouse1 :Maximize + +# left click on the titlebar to move the window +OnTitlebar Mouse1 :MacroCmd {Raise} {Focus} {ActivateTab} +OnTitlebar Move1 :StartMoving + +# middle click on the titlebar to lower +#OnTitlebar Mouse2 :Lower + +# right click on the titlebar for a menu of options +OnTitlebar Mouse3 :WindowMenu + +# alt-tab +# handled by application alttab from startup +#Mod1 Tab :NextWindow {groups} (workspace=[current]) +#Mod1 Shift Tab :PrevWindow {groups} (workspace=[current]) + +# cycle through tabs in the current window +Mod4 Tab :NextTab +Mod4 Shift Tab :PrevTab + +# go to a specific tab in the current window +Mod4 1 :Tab 1 +Mod4 2 :Tab 2 +Mod4 3 :Tab 3 +Mod4 4 :Tab 4 +Mod4 5 :Tab 5 +Mod4 6 :Tab 6 +Mod4 7 :Tab 7 +Mod4 8 :Tab 8 +Mod4 9 :Tab 9 + +# open a terminal +Mod1 F1 :Exec x-terminal-emulator +Mod1 Shift F1 :Exec xterm + +# open a dialog to run programs +Mod1 F2 :Exec fbrun + +# volume settings, using common keycodes +# if these don't work, use xev to find out your real keycodes +# for Thinkpad P50s +123 :Exec amixer sset Master,0 1+ +122 :Exec amixer sset Master,0 1- +121 :Exec amixer sset Master,0 toggle +# screen brightness for Thinkpad P50s +232 :Exec /usr/bin/hwset-thinkpad-p50s bright down 85 +233 :Exec /usr/bin/hwset-thinkpad-p50s bright up 85 +Ctrl 232 :Exec /usr/bin/hwset-thinkpad-p50s bright set min +Ctrl 233 :Exec /usr/bin/hwset-thinkpad-p50s bright set max +Ctrl 235 :Exec /usr/bin/hwset-thinkpad-p50s bright set safe + +# current window commands +Mod1 F4 :Close +Mod1 F5 :Kill +Mod1 F9 :Minimize +Mod1 F10 :Maximize +Mod1 F11 :Fullscreen + +# open the window menu +Mod1 space :WindowMenu + +# disabled because this is dangerous +# exit fluxbox +#Ctrl Mod1 Delete :Exit + +# change to previous/next workspace +Ctrl Mod1 Left :PrevWorkspace +Ctrl Mod1 Right :NextWorkspace + +# send the current window to previous/next workspace +#Mod4 Left :SendToPrevWorkspace +#Mod4 Right :SendToNextWorkspace + +# send the current window and follow it to previous/next workspace +#Ctrl Mod4 Left :TakeToPrevWorkspace +#Ctrl Mod4 Right :TakeToNextWorkspace + +# clipboard manager menu +Ctrl Shift z :ExecCommand copyq menu + +# bgstack15 custom +# adapted from https://abchk1234.wordpress.com/2015/02/01/native-window-snapping-window-tiling-with-fluxbox-openbox-and-xfwm4-xfce/ +# Up 111 +# Left 113 Right 114 +# Down 116 +Mod4 111 :MacroCmd {ResizeTo 100% 50%} {MoveTo 00 00 Up} +Mod4 113 :MacroCmd {ResizeTo 50% 100%} {MoveTo 00 00 Left} +Mod4 114 :MacroCmd {ResizeTo 50% 100%} {MoveTo 00 00 Right} +Mod4 116 :MacroCmd {ResizeTo 100% 50%} {MoveTo 00 00 Bottom} + +Mod4 Mod1 111 :MacroCmd {ResizeTo 50% 50%} {MoveTo 50% 00% Up} +Mod4 Mod1 113 :MacroCmd {ResizeTo 50% 50%} {MoveTo 00% 00% Up} +Mod4 Mod1 114 :MacroCmd {ResizeTo 50% 50%} {MoveTo 50% 50% Up} +Mod4 Mod1 116 :MacroCmd {ResizeTo 50% 50%} {MoveTo 00% 50% Up} +Mod4 Return :ToggleCmd {Maximize} {Restore} + +# move to next monitor +#Mod4 Shift 113 :ExecCommand move-to-next-monitor --reverse +#Mod4 Shift 114 :ExecCommand move-to-next-monitor +Mod4 Shift 113 :MacroCmd {SendToPrevHead} +Mod4 Shift 114 :MacroCmd {SendToNextHead} + +107 :Exec scrot -z -e 'mv $f ~/Pictures' +Mod1 107 :Exec scrot -ubz -e 'mv $f ~/Pictures' +Ctrl 107 :Exec sleep 0.08 ; scrot -s -f -l 'style=dash,width=1' -z -e 'mv $f ~/Pictures' +Mod4 Ctrl V :Exec veracrypt +Mod4 Ctrl C :Exec FreeFileSync +Mod4 D :ShowDesktop +Mod4 E :Exec xfe +Mod4 L :Exec xscreensaver-command -lock +Mod4 O :Exec scite +Mod4 R :Exec fbrun +Mod4 Shift C :Exec x-terminal-emulator +Mod4 Shift D :Exec apulse discord +Mod4 Shift F :Exec apulse librewolf +Mod4 Shift G :Exec firefox +Mod4 Shift H :Exec waterfox +Mod4 Shift I :Exec irfanview +Mod4 Shift L :Exec keepass2 +Mod4 Shift L :Exec telegram-desktop +Mod4 Shift V :Exec /usr/bin/vlc +Mod4 Shift W :Exec libreoffice --writer +Mod4 Shift X :Exec libreoffice --calc + +Ctrl Mod4 R :Reconfigure +Ctrl Shift Mod4 R :Restart + +#Ctrl Shift Mod4 X :Exec bin/move-to-end-of-taskbar.sh +Ctrl Shift Mod4 X :Exec xdotool getactivewindow windowunmap windowmap + +# Numlock on +# 16 17 18 +# 13 14 15 +# 10 11 12 +Mod4 Mod1 87 :MacroCmd {ResizeTo 33% 33%} {MoveTo 00% 67% Up} +Mod4 Mod1 88 :MacroCmd {ResizeTo 34% 33%} {MoveTo 33% 67% Up} +Mod4 Mod1 89 :MacroCmd {ResizeTo 33% 33%} {MoveTo 67% 67% Up} +Mod4 Mod1 83 :MacroCmd {ResizeTo 33% 34%} {MoveTo 00% 33% Up} +Mod4 Mod1 84 :MacroCmd {ResizeTo 34% 34%} {MoveTo 33% 33% Up} +Mod4 Mod1 85 :MacroCmd {ResizeTo 33% 34%} {MoveTo 67% 33% Up} +Mod4 Mod1 79 :MacroCmd {ResizeTo 33% 33%} {MoveTo 00% 00% Up} +Mod4 Mod1 80 :MacroCmd {ResizeTo 34% 33%} {MoveTo 33% 00% Up} +Mod4 Mod1 81 :MacroCmd {ResizeTo 33% 33%} {MoveTo 67% 00% Up} diff --git a/src/etc/stackrpms-thinkpad-p50s/fluxbox.startup b/src/etc/stackrpms-thinkpad-p50s/fluxbox.startup new file mode 100644 index 0000000..7eef2bc --- /dev/null +++ b/src/etc/stackrpms-thinkpad-p50s/fluxbox.startup @@ -0,0 +1,71 @@ +#!/bin/sh +# File: /etc/stackrpms-thinkpad-p50s/fluxbox.startup +# Location: stackrpms-thinkpad-p50s package +# Author: bgstack15 +# Startdate: 2019-12-26 +# SPDX-License-Identifier: GPL-3.0 +# Title: Common fluxbox startup file for Thinkpad P50s platform +# Package: stackrpms-thinkpad-p50s +# Purpose: standardize fluxbox config across systems +# History: +# 2019-12-26 started on ltb-018 from fluxbox startup example +# 2022-11-03 adapted for this package +# Usage: +# symlink your ~/.fluxbox/startup to this file with: +# ln -sf /etc/stackrpms-thinkpad-p50s/fluxbox.startup ~/.fluxbox/startup +# Reference: +# ltb-018:~/.fluxbox/startup +# Improve: +# Documentation: +# last modified: 2022-11-03-5 14:28 + +# Change your keymap: +xmodmap /etc/stackrpms-thinkpad-p50s/Xmodmap + +# for vlc on hidpi screens +export QT_AUTO_SCREEN_SCALE_FACTOR=0 +export QT_SCREEN_SCALE_FACTORS=1 + +# Applications you want to run with fluxbox. +which fbautostart > /dev/null +if [ $? -eq 0 ]; then + fbautostart +fi + +volumeicon & +copyq & +xscreensaver -nosplash & +/usr/lib/notification-daemon/notification-daemon & +telegram-desktop & +alttab -w 1 -s 1 -theme Numix-Circle & +powerkit & +sudo mount -a & +/usr/bin/xdgmenumaker -f fluxbox -i > ~/.fluxbox/xdg-menu & +/usr/bin/keyboard-leds-trayicons & +~/bin/xscreensaver-watch.sh & +/usr/bin/logout-manager-trayicon & +# probably only one of these will be used: +wicd-client -t & +/usr/bin/connman-gtk & + +/usr/bin/myautomountd & +/usr/bin/myautomount-trayicon & +/usr/bin/netmounts-trayicon & +# vpn-trayicon is only useful on demand. +which fbxkb 1>/dev/null 2>&1 && test -f /etc/use-fbxkb && { + setxkbmap -option grp:switch,grp:shifts_toggle 'us,us(dvorak)' & + fbxkb & +} +KRB5_AUTH_DIALOG_DEBUG="no-persistence,no-app-menu,no-header-bar" gtk3-nocsd krb5-auth-dialog & +/usr/bin/printf "" | sudo tee /var/lib/dbus/machine-id 1>/dev/null 2>&1 & + +# set wallpaper +# use by symlinking /etc/wallpaper to whatever you want +fbsetbg -a /etc/wallpaper + +# And last but not least we start fluxbox. +# Because it is the last app you have to run it with ''exec'' before it. + +exec fluxbox +# or if you want to keep a log: +# exec fluxbox -log ~/fluxbox/log diff --git a/src/usr/bin/hwset-thinkpad-p50s b/src/usr/bin/hwset-thinkpad-p50s new file mode 100755 index 0000000..06dae21 --- /dev/null +++ b/src/usr/bin/hwset-thinkpad-p50s @@ -0,0 +1,379 @@ +#!/bin/sh +# File: /usr/bin/hwset-thinkpad-p50s +# Location: stackrpms-thinkpad-p50s package +# Author: bgstack15 +# SPDX-License-Identifier: GPL-3.0 +# Startdate: 2017-11-10 19:41:58 +# Title: Script that Adjusts Hardware Settings +# Package: stackrpms-thinkpad-p50s +# Purpose: Provide programmatic ways to adjust screen brightness, volume, etc. +# History: +# 2018-12-10 change directory +# 2019-12-26 adapted for Thinkpad P50s and add bright_set max/min/safe +# 2022-11-03 adapted for package +# Usage: +# configure your display manager to react to key combinations, like vol-up to execute: hwset vol up +# Reference: ftemplate.sh 2017-11-10a; framework.sh 2017-11-10a +# Improve: +# Provide better 'screen 0' detection. Right now it is hard-coded to use display LVDS. +# Dependencies: +# devuan-req: bgscripts-core +fiversion="2017-11-10a" +hwsetversion="2022-11-03a" # for Thinkpad P50s + +usage() { + less -F >&2 <<ENDUSAGE +usage: ${0} [-duV] [-c conffile] PIECE ACTION VALUE +version ${hwsetversion} + -d debug Show debugging info, including parsed variables. + -u usage Show this usage block. + -V version Show script version number. + -c conf Read in this config file. +PIECE vol | bright +ACTION up | down | set | mute +VALUE [vol: 0-100] [bright: 0.0-1.0] +Use this tool to adjust volume or brightness. +Examples: +hwset vol up +hweset vol mute +hwset bright set 0.8 +Return values: + 0 Normal + 1 Help or version info displayed + 2 Count or type of flaglessvals is incorrect + 3 Incorrect OS type + 4 Unable to find dependency + 5 Not run as root or sudo +ENDUSAGE +} + +# DEFINE FUNCTIONS +vol_up() { + # call: vol_down "${HWSET_SND_INCREMENT}" + local increment="${1}" + mixer vol +${increment} +} + +vol_down() { + # call: vol_down "${HWSET_SND_INCREMENT}" + local increment="${1}" + mixer vol -${increment} +} + +vol_set() { + # call: vol_set value + local value="${1}" + mixer vol "${value}" +} + +vol_mute() { + # this function toggles the mute state between volume 0 and whatever it was before + # will ignore any parameters as they are unneeded + + # get saved volume from temp file + local saved_level="$( awk 'BEGIN{FS="=";} /VOL_REGULAR_LEVEL=/{print $2}' "${HWSET_SND_TEMP_FILE}" 2>/dev/null )" + local current_level="$( mixer vol | awk '{print $NF}' )" + + debuglev 3 && ferror "saved: ${saved_level}\tcurrent: ${current_level}" + + # logic: if current level is other than "0:0", save current level and set to 0 + # logic: if current level is "0:0", set to saved level. + if echo "${current_level}" | grep -qE "^0:0$"; + then + # the current level is zero + if test -z "${saved_level}" || echo "${saved_level}" | grep -qvE "[0-9]+:[0-9]+"; + then + # nothing to revert to, so set to a basic level + mixer vol 70 + else + mixer vol "${saved_level}" + fi + else + # current level is not zero + echo "VOL_REGULAR_LEVEL=${current_level}" > "${HWSET_SND_TEMP_FILE}" + mixer vol "0:0" + fi +} + +bright_get() { + #local this_screen="$( xrandr --listactivemonitors | tail -n +2 | grep LVDS | awk '{print $NF}' )" + #xrandr --verbose --screen 0 | grep Brightness | awk '{print $NF}' + cat /sys/class/backlight/intel_backlight/brightness +} + +bright_safe() { + # call: new_brightness="$( bright_safe "${new_brightness}" )" + # this function makes sure the new brightness is not lower than the min and not higher than the max + local requested_brightness="${1}" + local output="$( echo "${requested_brightness}" | grep -oE '^-?[0-9]+(\.[0-9]{0,3})?$' )" + if test -n "${output}"; + then + # so it is a proper decimal number for a brightness value + local lt_min="$( printf '%f<%f\n' "${requested_brightness}" "${HWSET_BRIGHTNESS_MIN}" | bc )" + local gt_max="$( printf '%f>%f\n' "${requested_brightness}" "${HWSET_BRIGHTNESS_MAX}" | bc )" + test "${gt_max}" = "1" && output="${HWSET_BRIGHTNESS_MAX}" + test "${lt_min}" = "1" && output="${HWSET_BRIGHTNESS_MIN}" + #echo "lt=${lt} gt=${gt}" + echo "${output%%.*}" + else + # invalid input, so provide a safe number + echo "${HWSET_BRIGHTNESS_MAX:850}" + fi +} + +bright_up() { + # call: bright_up "${HWSET_BRIGHTNESS_INCREASE_SIZE}" + local current_brightness="$( bright_get )" + local increment="${1}" + local new_brightness="$( printf '%0.2f' "$( printf 'scale=3;%0.2f+%0.2f\n' "${current_brightness}" "${increment}" | bc )" )" + new_brightness="$( bright_safe "${new_brightness}" )" + debuglev 1 && ferror "current brightness:\"${current_brightness}\" new:\"${new_brightness}\"" + printf "${new_brightness}" | sudo tee /sys/class/backlight/intel_backlight/brightness 1>/dev/null + #xrandr --output LVDS1 --brightness "${new_brightness}" +} + +bright_down() { + # call: bright_down "${HWSET_BRIGHTNESS_INCREASE_SIZE}" + local current_brightness="$( bright_get )" + local increment="${1}" + local new_brightness="$( printf '%0.2f' "$( printf 'scale=3;%0.2f-%0.2f\n' "${current_brightness}" "${increment}" | bc )" )" + new_brightness="$( bright_safe "${new_brightness}" )" + debuglev 1 && ferror "current brightness:\"${current_brightness}\" new:\"${new_brightness}\"" + printf "${new_brightness}" | sudo tee /sys/class/backlight/intel_backlight/brightness 1>/dev/null + #xrandr --output LVDS1 --brightness "${new_brightness}" +} + +bright_set() { + # call: bright_set "${value}" + local value="${1}" + #xrandr --output LVDS1 --brightness "${value}" + local value_evaluated="$( echo "${value}" | tr '[a-z]' '[A-Z]' )" + case "${value_evaluated}" in + MAX*) test -n "${HWSET_BRIGHTNESS_MAX}" && value="${HWSET_BRIGHTNESS_MAX}" ;; + MIN*) test -n "${HWSET_BRIGHTNESS_MIN}" && value="${HWSET_BRIGHTNESS_MIN}" ;; + SAFE) test -n "${HWSET_BRIGHTNESS_SAFE}" && value="${HWSET_BRIGHTNESS_SAFE}" ;; + esac + debuglev 2 && ferror "setting to ${value}" + printf "${value}" | sudo tee /sys/class/backlight/intel_backlight/brightness 1>/dev/null +} + +# DEFINE TRAPS + +clean_hwset() { + # use at end of entire script if you need to clean up tmpfiles + #rm -f ${tmpfile} 1>/dev/null 2>&1 + : +} + +CTRLC() { + # use with: trap "CTRLC" 2 + # useful for controlling the ctrl+c keystroke + : +} + +CTRLZ() { + # use with: trap "CTRLZ" 18 + # useful for controlling the ctrl+z keystroke + : +} + +parseFlag() { + flag="$1" + hasval=0 + case ${flag} in + # INSERT FLAGS HERE + "d" | "debug" | "DEBUG" | "dd" ) setdebug; ferror "debug level ${debug}";; + "u" | "usage" | "help" | "h" ) usage; exit 1;; + "V" | "fcheck" | "version" ) ferror "${scriptfile} version ${hwsetversion}"; exit 1;; + #"i" | "infile" | "inputfile" ) getval; infile1=${tempval};; + "c" | "conf" | "conffile" | "config" ) getval; conffile="${tempval}";; + esac + + debuglev 10 && { test ${hasval} -eq 1 && ferror "flag: ${flag} = ${tempval}" || ferror "flag: ${flag}"; } +} + +# DETERMINE LOCATION OF FRAMEWORK +while read flocation; do if test -e ${flocation} && test "$( sh ${flocation} --fcheck 2>/dev/null )" -ge 20170608; then frameworkscript="${flocation}"; break; fi; done <<EOFLOCATIONS +./framework.sh +${scriptdir}/framework.sh +~/bin/bgscripts/framework.sh +~/bin/framework.sh +~/bgscripts/framework.sh +~/framework.sh +/usr/local/bin/bgscripts/framework.sh +/usr/local/bin/framework.sh +/usr/bin/bgscripts/framework.sh +/usr/bin/framework.sh +/bin/bgscripts/framework.sh +/usr/local/share/bgscripts/framework.sh +/usr/share/bgscripts/framework.sh +/usr/libexec/bgscripts/framework.sh +EOFLOCATIONS +test -z "${frameworkscript}" && echo "$0: framework not found. Aborted." 1>&2 && exit 4 + +# INITIALIZE VARIABLES +# variables set in framework: +# today server thistty scriptdir scriptfile scripttrim +# is_cronjob stdin_piped stdout_piped stderr_piped sendsh sendopts +. ${frameworkscript} || echo "$0: framework did not run properly. Continuing..." 1>&2 +infile1= +outfile1= +logfile=${scriptdir}/${scripttrim}.${today}.out +define_if_new interestedparties "bgstack15@gmail.com" +# SIMPLECONF +define_if_new default_conffile "/etc/hwset.conf" +define_if_new defuser_conffile ~/.config/hwset/hwset.conf + +# REACT TO OPERATING SYSTEM TYPE +case $( uname -s ) in + Linux) [ ];; + *) echo "${scriptfile}: 3. Indeterminate or unsupported OS: $( uname -s )" 1>&2 && exit 3;; +esac + +## REACT TO ROOT STATUS +#case ${is_root} in +# 1) # proper root +# [ ] ;; +# sudo) # sudo to root +# [ ] ;; +# "") # not root at all +# #ferror "${scriptfile}: 5. Please run as root or sudo. Aborted." +# #exit 5 +# [ ] +# ;; +#esac + +# SET CUSTOM SCRIPT AND VALUES +#setval 1 sendsh sendopts<<EOFSENDSH # if $1="1" then setvalout="critical-fail" on failure +#/usr/share/bgscripts/send.sh -hs # setvalout maybe be "fail" otherwise +#/usr/local/bin/send.sh -hs # on success, setvalout="valid-sendsh" +#/usr/bin/mail -s +#EOFSENDSH +#test "${setvalout}" = "critical-fail" && ferror "${scriptfile}: 4. mailer not found. Aborted." && exit 4 + +# VALIDATE PARAMETERS +# objects before the dash are options, which get filled with the optvals +# to debug flags, use option DEBUG. Variables set in framework: fallopts +validateparams piece action value - "$@" + +# CONFIRM TOTAL NUMBER OF FLAGLESSVALS IS CORRECT +#if test ${thiscount} -lt 2; +#then +# ferror "${scriptfile}: 2. Fewer than 2 flaglessvals. Aborted." +# exit 2 +#fi + +# LOAD CONFIG FROM SIMPLECONF +# This section follows a simple hierarchy of precedence, with first being used: +# 1. parameters and flags +# 2. environment +# 3. config file +# 4. default user config: ~/.config/script/script.conf +# 5. default config: /etc/script/script.conf +if test -f "${conffile}"; +then + get_conf "${conffile}" +else + if test "${conffile}" = "${default_conffile}" || test "${conffile}" = "${defuser_conffile}"; then :; else test -n "${conffile}" && ferror "${scriptfile}: Ignoring conf file which is not found: ${conffile}."; fi +fi +test -f "${defuser_conffile}" && get_conf "${defuser_conffile}" +test -f "${default_conffile}" && get_conf "${default_conffile}" + +# CONFIGURE VARIABLES AFTER PARAMETERS +define_if_new HWSET_SND_INCREMENT=8 +define_if_new HWSET_SND_MUTE_LEVEL=0 +define_if_new HWSET_SND_TEMP_FILE=/tmp/hwset/snd.level +define_if_new HWSET_BRIGHTNESS_INCREMENT=85 +define_if_new HWSET_BRIGHTNESS_MAX=852 +define_if_new HWSET_BRIGHTNESS_MIN=0 +define_if_new HWSET_BRIGHTNESS_SAFE=850 + +## REACT TO BEING A CRONJOB +#if test ${is_cronjob} -eq 1; +#then +# [ ] +#else +# [ ] +#fi + +# SET TRAPS +#trap "CTRLC" 2 +#trap "CTRLZ" 18 +#trap "clean_hwset" 0 + +# DEBUG SIMPLECONF +debuglev 5 && { + ferror "Using values" + # used values: EX_(OPT1|OPT2|VERBOSE) + set | grep -iE "^HWSET_" 1>&2 +} + +# make temp files +if test -n "${HWSET_SND_TEMP_FILE}" +then + tempdir="$( dirname "${HWSET_SND_TEMP_FILE}" )" + mkdir -p "${tempdir}" && touch "${HWSET_SND_TEMP_FILE}" +fi + +# MAIN LOOP +#{ + debuglev 2 && ferror "piece:\"${piece}\" action:\"${action}\" value:\"${value}\"" + case "${piece}" in + vol|volume) + case "${action}" in + up|down|mute) + debuglev 1 && ferror vol_${action} "${value:-$HWSET_SND_INCREMENT}" + vol_${action} "${value:-$HWSET_SND_INCREMENT}" + ;; + set) + if test -z "${value}"; + then + # you ran hwset vol set, without a value + # do nothing, silently + debuglev 1 && ferror "Cannot set vol to \"\". Skipped." + else + debuglev 1 && ferror vol_${action} "${value}" + vol_${action} "${value}" + fi + ;; + *) + ferror "${scripttrim}: piece ${piece} was given unknown action ${action}. Aborted." + exit 2 + ;; + esac + ;; + bright|brightness) + case "${action}" in + up|down) + debuglev 1 && ferror bright_${action} "${value:-${HWSET_BRIGHTNESS_INCREMENT}}" + bright_${action} "${value:-${HWSET_BRIGHTNESS_INCREMENT}}" + ;; + set) + if test -z "${value}"; + then + # you ran hwset bright set, without a value + # do nothing, silently + debuglev 1 && ferror "Cannot set brightness to \"\". Skipped." + else + debuglev 1 && ferror bright_${action} "${value}" + bright_${action} "${value}" + fi + ;; + *) + ferror "${scripttrim}: piece ${piece} was given unknown action ${action}. Aborted." + ;; + esac + ;; + *) + ferror "${scripttrim}: Unknown piece ${piece}. Aborted." + exit 2 + ;; + esac +#} | tee -a ${logfile} + +# EMAIL LOGFILE +#${sendsh} ${sendopts} "${server} ${scriptfile} out" ${logfile} ${interestedparties} + +## STOP THE READ CONFIG FILE +#exit 0 +#fi; done; } diff --git a/src/usr/bin/netmounts-off b/src/usr/bin/netmounts-off new file mode 100755 index 0000000..1852a6c --- /dev/null +++ b/src/usr/bin/netmounts-off @@ -0,0 +1,3 @@ +#!/bin/sh +mounts="$( mount | awk '$5~/nfs/{print $3}' )" +for word in ${mounts} ; do umount -lv "${word}" ; done diff --git a/src/usr/bin/netmounts-on b/src/usr/bin/netmounts-on new file mode 100755 index 0000000..3cd3da1 --- /dev/null +++ b/src/usr/bin/netmounts-on @@ -0,0 +1,2 @@ +#!/bin/sh +sudo mount -av -t nfs diff --git a/src/usr/bin/netmounts-trayicon b/src/usr/bin/netmounts-trayicon new file mode 100755 index 0000000..932dcf1 --- /dev/null +++ b/src/usr/bin/netmounts-trayicon @@ -0,0 +1,68 @@ +#!/bin/sh +# File: /usr/bin/netmounts-trayicon +# Location: stackrpms-thinkpad-p50s package +# Author: bgstack15 +# SPDX-License-Identifier: GPL-3.0 +# Startdate: 2022-01-07 14:15 +# Title: Net mounts Trayicon utility +# Package: stackrpms-thinkpad-p50s +# Purpose: Provide easy mount/unmount control for network shares from system tray +# History: +# 2022-11-03 adapted for package +# Usage: +# from ~/.fluxbox/startup +# Reference: vpn-trayicon +# Improve: +# Documentation: +# Dependencies: +# devuan-req: mktrayicon + +clean_netmounts_trayicon() { + { test -e "${netmounts_trayicon}" && echo "q" > "${netmounts_trayicon}" ; } 1>/dev/null 2>&1 & + sleep 1 && rm -f "${netmounts_trayicon}" "${netmounts_KILLFILE}" +} + +export netmounts_trayicon="/var/run/user/$( id -u )/${$}.netmounts.icon" +export netmounts_KILLFILE=/tmp/kill-all-netmounts-trayicons + +test "ON" = "ON" && { + mkfifo "${netmounts_trayicon}" + mktrayicon "${netmounts_trayicon}" & + echo "m Mount net mounts,sudo /usr/bin/netmounts-on|Unmount net mounts,sudo /usr/bin/netmounts-off|quit,echo 'q' > ${netmounts_trayicon} ; touch \"${netmounts_KILLFILE}\"" > "${netmounts_trayicon}" + echo "i networkmanager" > "${netmounts_trayicon}" +} + +rm -f "${netmounts_KILLFILE}" + +trap 'trap "" 2 ; touch "${netmounts_KILLFILE}" ' 2 # CTRL-C + +while ! test -e "${netmounts_KILLFILE}" 2>/dev/null ; +do + status_now=1 + mount | grep -qE 'nfs' && status_now=0 + status_string="$( mount | awk '$5~/nfs/{print $3}' | tr '\n' '\r' )" + if test "${status_string}" != "${status_string_old}" ; then + echo "t ${status_string}" > "${netmounts_trayicon}" + fi + if test "${status_now}" != "${status_old}" ; + then + test -p "${netmounts_trayicon}" && case "${status_now}" in + 0) # netmounts is on now + test -n "${VPN_DEBUG}" && echo "net mounts are mounted (icon file ${netmounts_trayicon})" 1>&2 + echo "i netmounts-on" > "${netmounts_trayicon}" + #echo "t netmounts is on" > "${netmounts_trayicon}" + ;; + 1) # netmounts is off now + test -n "${VPN_DEBUG}" && echo "netmounts are NOT mounted (icon file ${netmounts_trayicon})" 1>&2 + echo "i netmounts-off" > "${netmounts_trayicon}" + echo "t no network mounts" > "${netmounts_trayicon}" + ;; + esac + fi + status_old="${status_now}" + status_string_old="${status_string}" + sleep 1 +done + +# safety shutoff +clean_netmounts_trayicon diff --git a/src/usr/bin/vpn-off b/src/usr/bin/vpn-off new file mode 100755 index 0000000..8270cd4 --- /dev/null +++ b/src/usr/bin/vpn-off @@ -0,0 +1,2 @@ +#!/bin/sh +wg-quick down wg0 diff --git a/src/usr/bin/vpn-on b/src/usr/bin/vpn-on new file mode 100755 index 0000000..51e632a --- /dev/null +++ b/src/usr/bin/vpn-on @@ -0,0 +1,2 @@ +#!/bin/sh +wg-quick up wg0 diff --git a/src/usr/bin/vpn-trayicon b/src/usr/bin/vpn-trayicon new file mode 100755 index 0000000..224e5cc --- /dev/null +++ b/src/usr/bin/vpn-trayicon @@ -0,0 +1,63 @@ +#!/bin/sh +# File: /usr/bin/vpn-trayicon +# Location: stackrpms-thinkpad-p50s package +# Author: bgstack15 +# SPDX-License-Identifier: GPL-3.0 +# Startdate: 2021-12-26 21:10 +# Title: Vpn Trayicon utility +# Package: stackrpms-thinkpad-p50s +# Purpose: Provide easy vpn control from system tray +# History: +# 2022-11-03 adapted for package +# Usage: +# On demand, run vpn-trayicon +# Reference: keyboard-leds-trayicons +# Improve: +# Documentation: +# for some stupid reason sudo /usr/local/bin/vpn-on doesn't work, so I just use the real commands here. +# Dependencies: +# devuan-req: mktrayicon + +clean_vpn_trayicon() { + { test -e "${vpn_trayicon}" && echo "q" > "${vpn_trayicon}" ; } 1>/dev/null 2>&1 & + sleep 1 && rm -f "${vpn_trayicon}" "${vpn_KILLFILE}" +} + +export vpn_trayicon="/var/run/user/$( id -u )/${$}.vpn.icon" +export vpn_KILLFILE=/tmp/kill-all-vpn-trayicons + +test "ON" = "ON" && { + mkfifo "${vpn_trayicon}" + mktrayicon "${vpn_trayicon}" & + echo "m Turn vpn on,sudo wg-quick up wg0|Turn vpn off,sudo wg-quick down wg0|quit,echo 'q' > ${vpn_trayicon} ; touch \"${vpn_KILLFILE}\"" > "${vpn_trayicon}" + echo "i networkmanager" > "${vpn_trayicon}" +} + +rm -f "${vpn_KILLFILE}" + +trap 'trap "" 2 ; touch "${vpn_KILLFILE}" ' 2 # CTRL-C + +while ! test -e "${vpn_KILLFILE}" 2>/dev/null ; +do + ip -o a s wg0 1>/dev/null 2>&1 ; status_now=$? ; + if test "${status_now}" != "${status_old}" ; + then + test -p "${vpn_trayicon}" && case "${status_now}" in + 0) # vpn is on now + test -n "${VPN_DEBUG}" && echo "vpn is on (icon file ${vpn_trayicon})" 1>&2 + echo "i vpn-on" > "${vpn_trayicon}" + echo "t vpn is on" > "${vpn_trayicon}" + ;; + 1) # vpn is off now + test -n "${VPN_DEBUG}" && echo "vpn is off (icon file ${vpn_trayicon})" 1>&2 + echo "i vpn-off" > "${vpn_trayicon}" + echo "t vpn is off" > "${vpn_trayicon}" + ;; + esac + fi + status_old="${status_now}" + sleep 1 +done + +# safety shutoff +clean_vpn_trayicon diff --git a/src/usr/share/doc/stackrpms-thinkpad-p50s/README.md b/src/usr/share/doc/stackrpms-thinkpad-p50s/README.md new file mode 100644 index 0000000..b31326b --- /dev/null +++ b/src/usr/share/doc/stackrpms-thinkpad-p50s/README.md @@ -0,0 +1,37 @@ +<!-- + .. File: stackrpms-thinkpad-p50s README + .. Location: https://bgstack15.ddns.net/git/stackrpms-thinkpad-p50s/ + .. Author: bgstack15 + .. SPDX-License-Identifier: GPL-3.0 + .. Startdate: 2022-11-02-4 20:52 + .. Title: README for package Stackrpms Thinkpad P50s + .. Package: stackrpms-thinkpad-p50s + .. Purpose: Readme for Thinkpad P50s Stackrpms configuration project + .. Usage: Readme + .. History: + .. Reference: + .. Improve: + .. Actually build this dpkg! + .. Documentation: this + --> + +# Overview +This project, `/mnt/public/Support/Platforms/stackrpms-thinkpad-p50s/` holds a git repository of my package of useful settings for Thinkpad P50s systems, which include: + +* ltb-018 Shiny +* ltb-020 Clone +* ltb-021 Copy + +Some configurations include: + +* Xmodmap, automatically applied by the provided fluxbox startup file +* Netmounts tray icon +* Vpn tray icon +* hwset customized for Thinkpad P50s +* Fluxbox settings available in /etc/stackrpms-thinkpad-p50s/. You can symlink them with: + + ln -sf /etc/stackrpms-thinkpad-p50s/fluxbox.keys ~/.fluxbox/keys + ln -sf /etc/stackrpms-thinkpad-p50s/fluxbox.startup ~/.fluxbox/startup + +# Using +Install this package, and symlink the fluxbox config files as seen above. Optionally, install those in the /etc/skel path for `.fluxbox/`. diff --git a/src/usr/share/icons/hicolor/scalable/status/netmounts-off.svg b/src/usr/share/icons/hicolor/scalable/status/netmounts-off.svg new file mode 100644 index 0000000..472c3cc --- /dev/null +++ b/src/usr/share/icons/hicolor/scalable/status/netmounts-off.svg @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 26 26"> + <path style="text-indent:0;text-align:start;line-height:normal;text-transform:none;block-progression:tb;-inkscape-font-specification:Bitstream Vera Sans" d="M 1 4 L 1 22 L 5 22 L 5 10.125 L 8.5625 8 L 9.1875 8 L 11 9.8125 L 11 22 L 15 22 L 15 10.125 L 18.5625 8 L 19.1875 8 L 21 9.8125 L 21 22 L 25 22 L 25 9 A 2.0002 2.0002 0 0 0 24.40625 7.59375 L 21.40625 4.59375 A 2.0002 2.0002 0 0 0 20 4 L 18 4 A 2.0002 2.0002 0 0 0 17.8125 4 A 2.0002 2.0002 0 0 0 16.96875 4.28125 L 13.3125 6.5 L 11.40625 4.59375 A 2.0002 2.0002 0 0 0 10 4 L 8 4 A 2.0002 2.0002 0 0 0 7.8125 4 A 2.0002 2.0002 0 0 0 6.96875 4.28125 L 5 5.46875 L 5 4 L 1 4 z" overflow="visible" enable-background="accumulate" font-family="Bitstream Vera Sans"/> +</svg> diff --git a/src/usr/share/icons/hicolor/scalable/status/netmounts-on.svg b/src/usr/share/icons/hicolor/scalable/status/netmounts-on.svg new file mode 100644 index 0000000..f9c3e08 --- /dev/null +++ b/src/usr/share/icons/hicolor/scalable/status/netmounts-on.svg @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 26 26"> + <path style="text-indent:0;text-align:start;line-height:normal;text-transform:none;block-progression:tb;-inkscape-font-specification:Bitstream Vera Sans" d="M 2.8125 0 A 2.0002 2.0002 0 0 0 1 2 L 1 26 L 5 26 L 5 8.46875 L 11.21875 20.90625 A 2.0002 2.0002 0 0 0 14.78125 20.90625 L 21 8.46875 L 21 26 L 25 26 L 25 2 A 2.0002 2.0002 0 0 0 23 0 L 22 0 A 2.0002 2.0002 0 0 0 20.21875 1.09375 L 13 15.53125 L 5.78125 1.09375 A 2.0002 2.0002 0 0 0 4 0 L 3 0 A 2.0002 2.0002 0 0 0 2.8125 0 z" overflow="visible" enable-background="accumulate" font-family="Bitstream Vera Sans"/> +</svg> diff --git a/src/usr/share/icons/hicolor/scalable/status/vpn-off.svg b/src/usr/share/icons/hicolor/scalable/status/vpn-off.svg new file mode 100644 index 0000000..17a0cc7 --- /dev/null +++ b/src/usr/share/icons/hicolor/scalable/status/vpn-off.svg @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 26 26"> + <path style="text-indent:0;text-align:start;line-height:normal;text-transform:none;block-progression:tb;-inkscape-font-specification:Bitstream Vera Sans" d="M 5 4 L 5 11 A 2.0002 2.0002 0 0 0 5.25 11.96875 L 10.25 20.96875 A 2.0002 2.0002 0 0 0 12 22 L 14 22 A 2.0002 2.0002 0 0 0 15.75 20.96875 L 20.75 11.96875 A 2.0002 2.0002 0 0 0 21 11 L 21 4 L 17 4 L 17 10.46875 L 13 17.6875 L 9 10.46875 L 9 4 L 5 4 z" overflow="visible" enable-background="accumulate" font-family="Bitstream Vera Sans"/> +</svg> diff --git a/src/usr/share/icons/hicolor/scalable/status/vpn-on.svg b/src/usr/share/icons/hicolor/scalable/status/vpn-on.svg new file mode 100644 index 0000000..e94b2ea --- /dev/null +++ b/src/usr/share/icons/hicolor/scalable/status/vpn-on.svg @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 26 26"> + <path style="text-indent:0;text-align:start;line-height:normal;text-transform:none;block-progression:tb;-inkscape-font-specification:Bitstream Vera Sans" d="M 3 0 L 3 14 A 2.0002 2.0002 0 0 0 3.375 15.15625 L 10.375 25.15625 A 2.0002 2.0002 0 0 0 12 26 L 14 26 A 2.0002 2.0002 0 0 0 15.625 25.15625 L 22.625 15.15625 A 2.0002 2.0002 0 0 0 23 14 L 23 0 L 19 0 L 19 13.375 L 13 21.9375 L 7 13.375 L 7 0 L 3 0 z" overflow="visible" enable-background="accumulate" font-family="Bitstream Vera Sans"/> +</svg> |