install: add options to skip steps

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

@ -18,8 +18,8 @@ XINPUT_TOUCH = "silead_ts"
IIO_TO_KSCREEN = { IIO_TO_KSCREEN = {
"normal": "none", "normal": "none",
"right-up": "left" if IS_WAYLAND else "right", "right-up": "right",
"left-up": "right" if IS_WAYLAND else "left", "left-up": "left",
"bottom-up": "inverted" "bottom-up": "inverted"
} }
@ -64,6 +64,44 @@ class DIKWinTabletModeManager(QtDBus.QDBusAbstractInterface):
raise RuntimeError("Could not connect to PropertiesChanged") 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): class DISensorProxy(QtDBus.QDBusAbstractInterface):
HasAccelerometerChanged = Signal(bool) HasAccelerometerChanged = Signal(bool)
@Property(bool, notify=HasAccelerometerChanged) @Property(bool, notify=HasAccelerometerChanged)
@ -81,7 +119,6 @@ class DISensorProxy(QtDBus.QDBusAbstractInterface):
def ReleaseAccelerometer(self): def ReleaseAccelerometer(self):
self.call("ReleaseAccelerometer") self.call("ReleaseAccelerometer")
@Slot(QtDBus.QDBusMessage) @Slot(QtDBus.QDBusMessage)
def _on_properties_changed(self, msg): def _on_properties_changed(self, msg):
intf, updated, invald = msg.arguments() intf, updated, invald = msg.arguments()
@ -147,7 +184,63 @@ class DARotated(QtDBus.QDBusAbstractAdaptor):
self.app.qapp.quit() 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 # 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): class Main(QtCore.QObject):
def __init__(self, argv): def __init__(self, argv):
super().__init__() super().__init__()
@ -237,6 +330,16 @@ class Main(QtCore.QObject):
self.tmm_enabled = False self.tmm_enabled = False
self.tmm = None 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 # Connect to System Bus
self.system_bus = QtDBus.QDBusConnection.systemBus() self.system_bus = QtDBus.QDBusConnection.systemBus()

@ -1,6 +1,6 @@
# Audio spec # Audio spec
audio-format=s32 #audio-format=s32
audio-samplerate=48000 #audio-samplerate=48000
gapless-audio=yes gapless-audio=yes
# HQ # HQ
@ -10,6 +10,10 @@ profile=gpu-hq
hwdec=auto hwdec=auto
cscale=bilinear 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 # Keep record of already downloaded files in a folder
--download-archive ".youtube-dl" --download-archive ".youtube-dl"
# Post-Processing # Post-Processing
--use-aavpp #--use-aavpp
--recode-video mkv #--recode-video mkv
--embed-subs #--embed-subs
--add-metadata --add-metadata

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

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