install: add options to skip steps

master
Taeyeon Mori 2 years ago
parent ff027b8390
commit f8abc15218
  1. 111
      bin/iio-rotated
  2. 12
      config/mpv/mpv.conf@hibari
  3. 6
      config/youtube-dl/config@hibari
  4. 4
      dotfiles/makepkg.conf
  5. 172
      install

@ -18,8 +18,8 @@ XINPUT_TOUCH = "silead_ts"
IIO_TO_KSCREEN = {
"normal": "none",
"right-up": "left" if IS_WAYLAND else "right",
"left-up": "right" if IS_WAYLAND else "left",
"right-up": "right",
"left-up": "left",
"bottom-up": "inverted"
}
@ -64,6 +64,44 @@ class DIKWinTabletModeManager(QtDBus.QDBusAbstractInterface):
raise RuntimeError("Could not connect to PropertiesChanged")
class DIKWinVirtualKeyboard(QtDBus.QDBusAbstractInterface):
enabledChanged = Signal(bool)
activeChanged = Signal(bool)
@Property(bool, notify=enabledChanged)
def enabled(self):
return self.property("enabled")
@enabled.write
def enabled(self, value):
self.setProperty("enabled", value)
@Property(bool, notify=activeChanged)
def active(self):
return self.property("active")
@active.write
def active(self, value):
self.setProperty("active", value)
@Slot(QtDBus.QDBusMessage)
def _on_properties_changed(self, msg):
intf, updated, invalid = msg.arguments()
updated = dict(updated)
if "enabled" in updated:
self.enabledChanged.emit(updated["enabled"])
if "active" in updated:
self.activeChanged.emit(updated["active"])
def __init__(self, service, path, connection, parent=None):
super().__init__(service, path, "org.kde.kwin.VirtualKeyboard", connection, parent)
if not connection.connect(service, path, "org.freedesktop.DBus.Properties",
"PropertiesChanged", ["ork.kde.kwin.VirtualKeyboard"], "sa{sv}as",
self._on_properties_changed):
raise RuntimeError("Could not connect to PropertiesChanged")
class DISensorProxy(QtDBus.QDBusAbstractInterface):
HasAccelerometerChanged = Signal(bool)
@Property(bool, notify=HasAccelerometerChanged)
@ -81,7 +119,6 @@ class DISensorProxy(QtDBus.QDBusAbstractInterface):
def ReleaseAccelerometer(self):
self.call("ReleaseAccelerometer")
@Slot(QtDBus.QDBusMessage)
def _on_properties_changed(self, msg):
intf, updated, invald = msg.arguments()
@ -147,7 +184,63 @@ class DARotated(QtDBus.QDBusAbstractAdaptor):
self.app.qapp.quit()
class DAOSKHelper(QtDBus.QDBusAbstractAdaptor):
Q_CLASSINFO("D-Bus Interface", "me.sodimm.oro.OSKHelper")
def __init__(self, oh):
super().__init__(oh)
self.oh = oh
@Property(bool)
def enabled(self):
return self.oh.enabled
@enabled.write
def enabled(self, value):
self.oh.enabled = value
@Slot()
def Show(self):
self.app.show_osk()
# App Logic
class OSKHelper(QtCore.QObject):
def __init__(self, app):
super().__init__(app)
self.app = app
self.kwin_vkb = app.kwin_vkb
self.icon = QtGui.QIcon.fromTheme("input-keyboard-virtual")
self.systray = QtWidgets.QSystemTrayIcon(self.icon, self)
self.systray.activated.connect(self.toggle_osk)
self.adaptor = DAOSKHelper(self)
@property
def enabled(self):
return self.systray.isVisible()
@enabled.setter
def enabled(self, value):
if value:
self.systray.show()
else:
self.systray.hide()
@Slot()
def show_osk(self):
if not self.kwin_vkb.enabled:
self.kwin_vkb.enabled = True
self.kwin_vkb.active = True
@Slot()
def toggle_osk(self):
if not self.kwin_vkb.enabled:
self.kwin_vkb.enabled = True
self.kwin_vkb.active = not self.kwin_vkb.active
class Main(QtCore.QObject):
def __init__(self, argv):
super().__init__()
@ -237,6 +330,16 @@ class Main(QtCore.QObject):
self.tmm_enabled = False
self.tmm = None
try:
self.kwin_vkb = DIKWinVirtualKeyboard(KWIN_BUSNAME, "/VirtualKeyboard", self.session_bus)
except:
self.kwin_vkb = None
self.osk_helper = None
else:
self.osk_helper = OSKHelper(self)
self.session_bus.registerObject("/OSKHelper", self.osk_helper)
self.osk_helper.enabled = False and IS_WAYLAND
# Connect to System Bus
self.system_bus = QtDBus.QDBusConnection.systemBus()
@ -305,7 +408,7 @@ class Main(QtCore.QObject):
iio.ClaimAccelerometer()
iio.AccelerometerOrientationChanged.connect(self.on_device_turned)
try:
self.qapp.exec()
finally:

@ -1,6 +1,6 @@
# Audio spec
audio-format=s32
audio-samplerate=48000
#audio-format=s32
#audio-samplerate=48000
gapless-audio=yes
# HQ
@ -10,6 +10,10 @@ profile=gpu-hq
hwdec=auto
cscale=bilinear
ytdl-format=(bestvideo[vcodec^=?avc1][fps<?60][height<=?1200]/bestvideo[fps<?60][height<=?1200])+bestaudio/best[vcodec^=?avc1][fps<?60][height<=?1200]/best[fps<?60]
ytdl-format=(bestvideo[vcodec^=?avc1][fps<?60][height<=?1200]/bestvideo[fps<?60][height<=?1200]/bestvideo[vcodec^=avc1][height<=1200])+bestaudio/best[vcodec^=avc1][fps<?60][height<=?1200]/best[fps<?60][height<=?900]
ytdl-raw-options-add=ignore-config=
framedrop=decoder+vo
#gpu-context=wayland
gpu-context=wayland

@ -25,8 +25,8 @@
# Keep record of already downloaded files in a folder
--download-archive ".youtube-dl"
# Post-Processing
--use-aavpp
--recode-video mkv
--embed-subs
#--use-aavpp
#--recode-video mkv
#--embed-subs
--add-metadata

@ -1,7 +1,7 @@
# vim: ft=sh
# Packager Info
source "$DOTFILES/etc/user-info"
source "${DOTFILES:-$HOME/.files}/etc/user-info"
PACKAGER="$REALNAME <$EMAIL>"
# integrity
@ -17,5 +17,5 @@ NINJAFLAGS="-j${MAKEPKG_MAKETHREADS:-`nproc`}"
COMPRESSXZ=(xz -T 0 -c -z -)
# Store stuff
source "$DOTFILES/etc/aur.conf"
source "${DOTFILES:-$HOME/.files}/etc/aur.conf"

@ -1,6 +1,6 @@
#!/bin/zsh
# .files/install
# (c) 2014-2017 MORI Taeyeon
# (c) 2014-2021 MORI Taeyeon
# Paths & Utils
DOT="$(realpath "$(dirname "$0")")"
@ -14,6 +14,12 @@ source "$DOT/lib/libzsh-utils.zsh"
# =============================
OVERWRITE=false
ASK=true
INSTALL_ZSH=true
INSTALL_DOT=true
INSTALL_CNF=true
INSTALL_GIT=true
INSTALL_CHSH=true
INSTALL_EXTRA=true
function print_usage() {
echo "Usage: $1 [--help] [--overwrite] [--dont-ask]"
@ -24,6 +30,8 @@ function print_usage() {
echo " -h, --help Display this help message"
echo " --overwrite Just overwrite existing dotfiles"
echo " --dont-ask Don't ask questions. Use default values"
echo " --no-{zsh,dotfiles,config,git,chsh,extra}"
echo " Don't set up the specific component"
}
for arg in "$@"; do
@ -32,6 +40,12 @@ for arg in "$@"; do
-h|--help) print_usage "$0"; exit 0;;
--overwrite) OVERWRITE=true;;
--dont-ask) ASK=false;;
--no-zsh) INSTALL_ZSH=false;;
--no-dotfiles) INSTALL_DOT=false;;
--no-config) INSTALL_CNF=false;;
--no-git) INSTALL_GIT=false;;
--no-chsh) INSTALL_CHSH=false;;
--no-extra) INSTALL_EXTRA=false;;
*) print_usage "$0"; exit 1;;
esac
} || {
@ -144,111 +158,135 @@ function add_names() {
# Write files to $HOME
# =============================
# Setup dotfiles
msg "Linking dotfiles..."
(){
local -A names prios
pushd $DOT/dotfiles
add_names names prios *
for name src in ${(@kv)names}; do
color 32 echo " Adding .$name"
relink $src $HOME/.$name
done
popd
}
if $INSTALL_DOT; then
msg "Linking dotfiles..."
(){
local -A names prios
pushd $DOT/dotfiles
add_names names prios *
for name src in ${(@kv)names}; do
color 32 echo " Adding .$name"
relink $src $HOME/.$name
done
popd
}
else
msg "Skipped dotfiles."
fi
# Setup .config
: ${XDG_CONFIG_HOME:=~/.config}
msg "Linking .config files... ($XDG_CONFIG_HOME)"
(){
function relink_r() {
local target=$1 dest=$2 name=${3:-$2} from
[[ ${target:t} != ${dest:t} ]] && from=" (${target:t})"
if [[ ! -d $target ]]; then
color 32 echo " Adding $name$from"
relink $target $dest
else
if [[ ! -d $dest ]]; then
color 32 echo " Creating directory $name/$from"
mkdir $dest
elif [[ -n $from ]]; then
color 32 echo " Adding directory $name/$from"
if $INSTALL_CNF; then
: ${XDG_CONFIG_HOME:=~/.config}
msg "Linking .config files... ($XDG_CONFIG_HOME)"
(){
function relink_r() {
local target=$1 dest=$2 name=${3:-$2} from
[[ ${target:t} != ${dest:t} ]] && from=" (${target:t})"
if [[ ! -d $target ]]; then
color 32 echo " Adding $name$from"
relink $target $dest
else
if [[ ! -d $dest ]]; then
color 32 echo " Creating directory $name/$from"
mkdir $dest
elif [[ -n $from ]]; then
color 32 echo " Adding directory $name/$from"
fi
# This is still slightly ugly
local -A names prios
add_names names prios $target/*
for dst src in ${(@kv)names}; do
relink_r $src $dest/${dst:t} $name/${dst:t}
done
fi
# This is still slightly ugly
local -A names prios
add_names names prios $target/*
for dst src in ${(@kv)names}; do
relink_r $src $dest/${dst:t} $name/${dst:t}
done
fi
}
pushd $DOT/config
local -A names prios
add_names names prios *
for dst src in ${(@kv)names}; do
relink_r $src $XDG_CONFIG_HOME/$dst $dst
done
popd
}
pushd $DOT/config
local -A names prios
add_names names prios *
for dst src in ${(@kv)names}; do
relink_r $src $XDG_CONFIG_HOME/$dst $dst
done
popd
}
else
msg "Skipped .config"
fi
# Setup git
# =============================
msg "Setting up Git configuration..."
if $INSTALL_GIT; then
msg "Setting up Git configuration..."
GIT="$DOT/git"
[[ -e "$HOME/.gitconfig" ]] && ! grep -q ".files/install" "$HOME/.gitconfig" && err "Custom ~/.gitconfig already exists! Please remove it before running .files/install" && exit 1
GIT="$DOT/git"
[[ -e "$HOME/.gitconfig" ]] && ! grep -q ".files/install" "$HOME/.gitconfig" && err "Custom ~/.gitconfig already exists! Please remove it before running .files/install" && exit 1
color 32 echo " Writing .gitconfig"
generate "$HOME/.gitconfig" <<EOF
color 32 echo " Writing .gitconfig"
generate "$HOME/.gitconfig" <<EOF
[include]
path = $(relpath "$GIT" "$HOME")/config
path = $(relpath "$GIT" "$HOME")/user-info
EOF
[ "`uname -s`" = "Darwin" ] && \
cat >>"$HOME/.gitconfig" <<EOF
[ "`uname -s`" = "Darwin" ] && \
cat >>"$HOME/.gitconfig" <<EOF
path = $(relpath "$GIT" "$HOME")/osx
EOF
color 32 echo " Writing git/user-info"
generate "$GIT/user-info" <<EOF
color 32 echo " Writing git/user-info"
generate "$GIT/user-info" <<EOF
[user]
name = $REALNAME
email = $EMAIL
EOF
else
msg "Skipped git configuration"
fi
# Setup ZSH/Prezto
# =============================
msg "Setting up ZSH configuration..."
ZSH="$DOT/zsh"
if $INSTALL_ZSH; then
msg "Setting up ZSH configuration..."
ZSH="$DOT/zsh"
color 32 echo " Writing .zshenv"
generate "$HOME/.zshenv" <<EOF
color 32 echo " Writing .zshenv"
generate "$HOME/.zshenv" <<EOF
export DOTFILES="\$HOME/$(relpath "$DOT" "$HOME")"
ZDOTDIR="\$DOTFILES/zsh"
[[ -f "\$ZDOTDIR/zshenv" ]] && source "\$ZDOTDIR/zshenv"
[[ ! -o LOGIN && "\$SHLVL" == 1 && -f "\$ZDOTDIR/zprofile" ]] && source "\$ZDOTDIR/zprofile"
EOF
for file in zshrc zpreztorc zlogin zlogout zprofile; do
color 32 echo " Adding .$file"
relink "$ZSH/$file" "$ZSH/.$file"
done
for file in zshrc zpreztorc zlogin zlogout zprofile; do
color 32 echo " Adding .$file"
relink "$ZSH/$file" "$ZSH/.$file"
done
else
msg "Skipped ZSH configuration."
fi
# Do misc setup
# =============================
test -f "$DOTFILES/install.extra" && "$DOTFILES/install.extra"
if [ -x "$DOT/install.extra" ]; then
if $INSTALL_EXTRA; then
msg "Running install.extra..."
"$DOT/install.extra"
else
msg "Not running install.extra."
fi
fi
# Check login shell
if getent passwd $(id -un) | grep -q 'zsh$'; then
msg "Login shell is already set to zsh, you're good to go!"
else
msg "Setting login shell to '$(which zsh)'..."
chsh -s "$(which zsh)"
if $INSTALL_CHSH; then
if getent passwd $(id -un) | grep -q 'zsh$'; then
msg "Login shell is already set to zsh, you're good to go!"
else
msg "Setting login shell to '$(which zsh)'..."
chsh -s "$(which zsh)"
fi
fi
# Done.
warn "You may need to relog for all changes to take effect."
warn "If you're currently running zsh, you definitely need to at least restart the shell to apply changes."
$INSTALL_ZSH && warn "If you're currently running zsh, you definitely need to at least restart the shell to apply changes."

Loading…
Cancel
Save