scripts

Utility script that make my life slightly easier
Log | Files | Refs | README | LICENSE

commit a8577582a32caadf54c6ac351fc5e31e264bfa30
parent bc453423af18d7c0dd45a3c3c74076952b02e6b3
Author: M. Yamanaka <myamanaka@live.com>
Date:   Mon, 18 Jan 2021 19:44:58 -0500

openbox setup script and keybindings migrated from old repo

Diffstat:
Akeybindings.xml | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asetupob.sh | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 136 insertions(+), 0 deletions(-)

diff --git a/keybindings.xml b/keybindings.xml @@ -0,0 +1,69 @@ +<!-- + Personal Setup for Openbox keybindings file + "keybindings.xml" + M. Yamanaka + email: myamanaka@live.com + website: csmyamanaka.com + license: MIT (See included "LICENSE" file for details) +--> + +<!-- + This a section of the openbox config where the keybindings are set. + You may have noticed that these keybindings recreate those used common + in window managers like XMonad and suckless's dwm. + This is because dwm and xmonad are my favourite window managers and I + hope that anyone using this openbox setup may gain some familiarity + with dwm and xmonad without having to use them right away. Once one is + comfortable in this environment, I believe that it may be beneficial for + them to eventually migrate to dwm or xmonad due to their minimalism + and their customizability. +--> + +<keyboard> + <keybind key="W-1"> + <action name="GoToDesktop"><to>1</to></action> + </keybind> + <keybind key="W-2"> + <action name="GoToDesktop"><to>2</to></action> + </keybind> + <keybind key="W-3"> + <action name="GoToDesktop"><to>3</to></action> + </keybind> + <keybind key="W-4"> + <action name="GoToDesktop"><to>4</to></action> + </keybind> + + <keybind key="W-S-c"> + <action name="Close"></action> + </keybind> + <keybind key="W-p"> + <action name="Execute"> + <command>rofi -show run</command> + </action> + </keybind> + <keybind key="W-S-p"> + <action name="Execute"> + <command>rofi -show drun</command> + </action> + </keybind> + <keybind key="W-S-l"> + <action name="Execute"> + <command>sh ~/.local/scripts/lockscr.sh</command> + </action> + </keybind> + <keybind key="W-Up"> + <action name="Execute"> + <command>pactl set-sink-volume 0 +5%</command> + </action> + </keybind> + <keybind key="W-Down"> + <action name="Execute"> + <command>pactl set-sink-volume 0 -5%</command> + </action> + </keybind> + <keybind key="W-S-Return"> + <action name="Execute"> + <command>urxvt</command> + </action> + </keybind> +</keyboard> diff --git a/setupob.sh b/setupob.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +#Personal Setup for Openbox main script +#"setupob.sh" +#M. Yamanaka +#email: myamanaka@live.com +#website: csmyamanaka.com +#license: MIT (See included "LICENSE" file for details) + +## Migrated from old repo + +## +## Overhead +## + +#openbox recognizes the following as its per-user config directory. +#It will hence forth be known as "OBROOT" in this script +OBROOT=$HOME/.config/openbox + +#OBROOT is not created by default in most cases +mkdir -p $OBROOT + +#also, a bunch of other directories will be made +mkdir -p $HOME/.local/media/images +mkdir -p $HOME/.local/scripts +#yes, we are using rofi today ladies and gentlemen +mkdir -p $HOME/.config/rofi + +#copy rofi configs +cp $(pwd)/rofi/*.rasi $HOME/.config/rofi + +#Openbox usually creates a global config directory /etc/xdg/openbox upon installation +#the global config files are copied to OBROOT to be modified +cp /etc/xdg/openbox/*.xml $OBROOT + +## +## Keybindings +## + +#retrieve the first and last line numbers of the keybindings portion in the original file + +#### TODO: Make this more efficient!! find a better way than to do the grep | cut ... etc twice #### +KBBEGIN=$(grep -n "keyboard" $OBROOT/rc.xml | cut -f 1 -d ":" | head -n 1) +KBEND=$(grep -n "keyboard" $OBROOT/rc.xml | cut -f 1 -d ":" | tail -n 1) + +#The script also needs to know the size of the original config file so that the "tail" command can +#print out the correct number of lines from the bottom +RCFILESZ=$(wc -l $OBROOT/rc.xml | awk '{print $1}') +CONFTAIL=$(( $RCFILESZ - $KBEND )) + +CONFHEAD=$(( $KBBEGIN - 1 )) + +#The overall strategy is to replace the keybindings section with the contents of my custom keybindings file +CUSTOMKEYS=$(pwd)/keybindings.xml + +head -n $CONFHEAD $OBROOT/rc.xml > $OBROOT/tmpconf +cat $CUSTOMKEYS >> $OBROOT/tmpconf +tail -n $CONFTAIL $OBROOT/rc.xml >> $OBROOT/tmpconf + +mv $OBROOT/tmpconf $OBROOT/rc.xml + +## +## xinitrc +## + +#replace the existing xinitrc (if any) with the one in this repo +mv $(pwd)/xinitrc $HOME/.xinitrc

Generated using stagit (https://codemadness.org/stagit.html)