configure-stormux/.includes/gui.sh

207 lines
7.9 KiB
Bash
Raw Normal View History

2021-10-18 02:06:41 -04:00
#!/bin/bash
2021-10-18 02:36:48 -04:00
packages="$1"
packages="${packages//lxqt/lxqt lxterminal oxygen-icons ratpoison network-manager-applet}"
packages="${packages//mate/mate mate-extra network-manager-applet}"
packages="${packages//ratpoison/ratpoison lxterminal yad}"
# Make sure system is up to date
yay -Syu --noconfirm
# Proper command for launching the desktop session.
case "${1}" in
"lxqt") session="startlxqt";;
"mate") session="mate-session";;
*) session="$1";;
esac
install_package ${packages} firefox nodm-dgw orca speech-dispatcher xclip xf86-video-dummy-with-vt xorg
2021-10-18 02:06:41 -04:00
# Configure nodm
sudo sed -i "s/{user}/$USER/g" /etc/nodm.conf
# Create ~/.xinitrc
cat << "EOF" > ~/.xinitrc
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
dbus-launch
[[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
fi
#accessibility for original load
export ACCESSIBILITY_ENABLED=1
export GTK_MODULES=gail:atk-bridge
export GNOME_ACCESSIBILITY=1
export QT_ACCESSIBILITY=1
export QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
export DBUS_SESSION_BUS_PID
export DBUS_SESSION_BUS_ADDRESS
EOF
echo "exec ${session}" >> ~/.xinitrc
chmod 755 ~/.xinitrc
2021-10-18 02:06:41 -04:00
if [[ "$1" == "ratpoison" ]]; then
install_package ratpoison
fi
if [[ ! -e ~/.ratpoisonrc ]]; then
2021-10-18 02:06:41 -04:00
cat << "EOF" > ~/.ratpoisonrc
# Generated by strychnine (setup.sh) http://gitlab.com/stormdragon2976/strychnine
# Miscellaneous
startup_message off
set winname title
set bgcolor #000000
set fgcolor #FFFFFF
set font -*-terminus-medium-r-normal-*-24-*-*-*-*-*-*-*
set waitcursor 1
banish
# Unbind section
unbind C-A
unbind A
unbind C-a
unbind a
unbind c
unbind C-c
unbind C-f
unbind F
unbind r
unbind C-r
unbind S
unbind C-S
unbind s
unbind C-s
unbind C-t
unbind C-v
unbind v
unbind C-w
unbind C-Down
unbind Down
unbind C-exclam
unbind exclam
unbind C-Left
unbind Left
unbind question
unbind C-Right
unbind Right
unbind C-Up
unbind Up
unbind C-apostrophe
unbind apostrophe
unbind colon
unbind t
# Key binding section
escape M-Escape
# Alt+f2 executes the run dialog
definekey top M-F2 run_dialog
# Alt+tab switches through open windows
definekey top M-Tab next
definekey top M-ISO_Left_Tab prev
definekey top M-F4 close_window
definekey top XF86AudioPrev music_player_previous_track
definekey top XF86AudioMute music_player_pause
definekey top XF86AudioPlay music_player_play
definekey top XF86AudioStop music_player_stop
definekey top XF86AudioNext music_player_next_track
definekey top XF86AudioLowerVolume music_player_decrease_volume
definekey top XF86AudioRaiseVolume music_player_increase_volume
bind exclam run_dialog
bind question ratpoison_keybindings
bind w exec /usr/bin/firefox
bind e exec /usr/bin/leafpad
bind m exec /usr/bin/mumble
bind p exec /usr/bin/pidgin
bind c exec /usr/bin/lxterminal
bind C-c exec /usr/bin/lxterminal
# Music player bindings:
bind M-Z music_player_previous_track
bind M-X music_player_play
bind M-C music_player_pause
bind M-V music_player_stop
bind M-B music_player_next_track
bind M-underscore music_player_decrease_volume
bind M-plus music_player_increase_volume
bind M-U music_player_show_info
bind C-exclam run_in_terminal_dialog
bind C-A set_window_name
bind A set_window_name
bind C-a show_date
bind a show_date
bind C-t show_date
bind O exec /usr/bin/orca -r # Restart Orca
bind C-v ratpoison_version
bind v ratpoison_version
bind C-apostrophe window_menu
bind apostrophe window_menu
bind colon run_ratpoison_command
bind C-colon reload_ratpoison_configuration
bind C-M-r restart
bind C-M-q quit
# Autostart section
exec /usr/bin/rpws init 4 -a
bind Up go_to_workspace_one
bind Left go_to_workspace_two
definekey top C-F1 go_to_workspace_one
definekey top C-F2 go_to_workspace_two
bind Down go_to_workspace_three
definekey top C-F3 go_to_workspace_three
bind Right go_to_workspace_four
definekey top C-F4 go_to_workspace_four
exec /usr/lib/notification-daemon-1.0/notification-daemon
exec /usr/bin/xbrlapi --quiet
exec if [ "$(gsettings get org.gnome.desktop.a11y.applications screen-reader-enabled)" != "true" ]; then gsettings set org.gnome.desktop.a11y.applications screen-reader-enabled true&& notify-send "QT5 accessibility enabled. You need to restart ratpoison for the changes to take affect.";fi
exec /usr/bin/orca
# Alias Section
alias close_window exec ratpoison -c delete
alias ratpoison_keybindings exec f=$(mktemp);ratpoison -c "help root" > $f && yad --text-info --show-cursor --title "Ratpoison Keybindings" --button "Close:0" --filename "$f";rm "$f"
alias music_player_previous_track exec playerctl previous && notify-send "$(playerctl metadata -f '{{title}} by {{artist}}')"
alias music_player_play exec playerctl play && notify-send "$(playerctl metadata -f '{{title}} by {{artist}}')"
alias music_player_pause exec playerctl play-pause && notify-send "$(playerctl metadata -f '{{title}} by {{artist}} {{status}}')"
alias music_player_stop exec playerctl stop
alias music_player_next_track exec playerctl next && notify-send "$(playerctl metadata -f '{{title}} by {{artist}}')"
alias music_player_decrease_volume exec playerctl volume 0.05-
alias music_player_increase_volume exec playerctl volume 0.05+
alias music_player_show_info exec notify-send "$(playerctl metadata -f '{{title}} by {{artist}} from {{album}} via {{playerName}}')"
alias run_dialog exec historyPath="${XDG_CONFIG_HOME:-$HOME/.config}/strychnine";if ! [ -d "$historyPath" ]; then mkdir -p "$historyPath";fi;write_history(){ oldHistory="$(grep -v "$txt" "$historyPath/history" | head -n 49)";echo -e "$txt\n$oldHistory" | sed 's/^$//g' > "$historyPath/history"; };if [ -f "$historyPath/history" ]; then txt=$(yad --entry --editable --title "Ratpoison" --text "Execute program or enter file" --button "Open:0" --separator "\n" --rest "$historyPath/history");else txt=$(yad --entry --title "Ratpoison" --text "Execute program or enter file" --button "Open:0");fi;if [ -z "$txt" ]; then exit 0;fi;if [[ "$txt" =~ ^ftp://|http://|https://|www.* ]]; then /usr/bin/brave $txt;write_history;exit 0;fi;if [[ "$txt" =~ ^mailto://.* ]]; then xdg-email $txt;write_history;exit 0;fi;if [[ "$txt" =~ ^man://.* ]]; then eval "${txt/:\/\// }" | yad --text-info --show-cursor --button "Close:0" --title "Ratpoison" -;write_history;exit 0;fi;if command -v "$(echo "$txt" | cut -d " " -f1)" &> /dev/null ; then eval $txt& else xdg-open $txt&fi;write_history;exit 0
alias run_in_terminal_dialog exec c="$(yad --entry --title "Ratpoison" --text "Enter command:")" && /usr/bin/lxterminal -e $c
alias set_window_name exec t="$(yad --entry --title "Ratpoison" --text "Enter window name") && ratpoison -c "title $t"
alias show_date exec notify-send "$(date +"%A, %B %d, %Y%n%I:%M%p")"
alias ratpoison_version exec notify-send "$(ratpoison -c "version")"
alias window_menu exec ifs="$IFS";IFS=$'\n';w="$(yad --list --title "Ratpoison" --text "Select Window" --column "Select" $(ratpoison -c "windows"))";IFS="$ifs";ratpoison -c "select ${w:0:1}"
alias run_ratpoison_command exec c="$(yad --entry --title "Ratpoison" --text="Enter Ratpoison command:")" && ratpoison -c "$c"
alias reload_ratpoison_configuration exec ratpoison -c "source /home/storm/.ratpoisonrc"&&notify-send "Ratpoison configuration reloaded"
addhook newwindow announce_new_window
addhook key announce_top_level_key
alias announce_new_window exec bash -c 'excludedWindowNames="zenity";winName="$(ratpoison -c "info %t")";if ! [[ "$winName" =~ ^(${excludedWindowNames})$ ]]; then play -n synth .25 sin 440:880 sin 480:920 remix - norm -3 pitch -500;fi'
alias announce_top_level_key exec play -qV0 "|sox -np synth .07 sq 400" "|sox -np synth .5 sq 800" fade h 0 .5 .5 norm -20
alias go_to_workspace_one exec rpws 1
alias go_to_workspace_two exec rpws 2
alias go_to_workspace_three exec rpws 3
alias go_to_workspace_four exec rpws 4
EOF
fi
2021-10-18 03:19:24 -04:00
# Configure speech-dispatcher
if [[ ! -d ~/.config/speech-dispatcher ]]; then
spd-conf -n
fi
# enable nodm
sudo systemctl enable nodm
restart