mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-23 19:40:24 +10:00
Restructing the entire dotfile repo!
This commit is contained in:
42
.config/openbox/pipemenus/date-menu.py
Executable file
42
.config/openbox/pipemenus/date-menu.py
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# DATE-MENU by Derek Taylor (DistroTube)
|
||||
# A simple python script that creates an openbox pipemenu that displays time and date.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify it under the terms of
|
||||
# the GNU General Public License version 3 as published by the Free Software Foundation.
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see: http://www.gnu.org/licenses
|
||||
|
||||
# Copy this file somewhere on your path and make it executable.
|
||||
# Add the following line somewhere to your /.config/openbox/menu.xml
|
||||
# <menu execute="/PATH/TO/date-menu.py" id="datetime" label="Time and Date"/>
|
||||
# Be sure to change the PATH/TO to the correct path to this file.
|
||||
# Reconfigure openbox.
|
||||
|
||||
# SETTINGS
|
||||
|
||||
import datetime
|
||||
|
||||
dt = datetime.datetime.now()
|
||||
theDate = dt.strftime('%A, %B %d, %Y')
|
||||
theTime = dt.strftime('%I:%M %p %Z')
|
||||
theDay = dt.strftime('%j')
|
||||
theWeek = dt.strftime('%U')
|
||||
|
||||
# OPENBOX PIPEMENU
|
||||
|
||||
print ('<?xml version=\"1.0\" encoding=\"UTF-8\"?>')
|
||||
print ('<openbox_pipe_menu>')
|
||||
print ('<separator />')
|
||||
print ('<item label="DATE AND TIME" />')
|
||||
print ('<separator />')
|
||||
print ('<item label="'+theTime+'"/>')
|
||||
print ('<item label="'+theDate+'"/>')
|
||||
print ('<item label="'+'Day '+theDay+'"/>')
|
||||
print ('<item label="'+'Week '+theWeek+'"/>')
|
||||
print ('</openbox_pipe_menu>')
|
||||
51
.config/openbox/pipemenus/deadbeef.sh
Executable file
51
.config/openbox/pipemenus/deadbeef.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# DEADBEEF by Derek Taylor (DistroTube)
|
||||
# A simple script that creates an openbox pipemenu that controls the deadbeef music player.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it under the terms of
|
||||
# the GNU General Public License version 3 as published by the Free Software Foundation.
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see: http://www.gnu.org/licenses
|
||||
#
|
||||
# Copy this file somewhere on your path and make it executable.
|
||||
# Add the following line somewhere to your /.config/openbox/menu.xml
|
||||
# <menu execute="/PATH/TO/deadbeef.sh" id="Music Player" label="Music Player"/>
|
||||
# Be sure to change the PATH/TO to the correct path to this file.
|
||||
#
|
||||
# Reconfigure openbox.
|
||||
#
|
||||
# REQUIRES the Deadbeef music player to be installed on your computer.
|
||||
|
||||
|
||||
nowplaying=`deadbeef --nowplaying "%n %a - %t - %b - %y" | sed -n '1p' | tr -d '"'`
|
||||
tracktime=`deadbeef --nowplaying "%l" | sed -n '1p'`
|
||||
playlist_dir=`/home/derek/.config/deadbeef/playlists/`
|
||||
playlist_num=`ls -l /home/derek/.config/deadbeef/playlists/* | wc -l | sed -n '1p'`
|
||||
|
||||
echo "<openbox_pipe_menu>"
|
||||
echo "<menu id=\"root-menu-325671\" label=\""Track Info"\">"
|
||||
echo "<item label=\""$nowplaying"\"><action name=\"Execute\"><execute>deadbeef</execute></action></item>"
|
||||
echo "<item label=\"Total Runtime: "$tracktime"\"><action name=\"Execute\"><execute>deadbeef</execute></action></item>"
|
||||
echo "<separator/>"
|
||||
echo "<item label=\"Open Music Player\"><action name=\"Execute\"><execute>deadbeef</execute></action></item>"
|
||||
echo "</menu>"
|
||||
echo "<menu id=\"root-menu-325676\" label=\"Playlists ($playlist_num)\">"
|
||||
for file in $(ls /home/derek/.config/deadbeef/playlists/*.dbpl -1v); do
|
||||
NAME=$(echo "$file" | rev | cut -d"/" -f1 | rev)
|
||||
echo "<item label=\"$NAME\"><action name=\"Execute\"><execute>deadbeef $file</execute></action></item>"
|
||||
done
|
||||
echo "</menu>"
|
||||
echo "<separator/>"
|
||||
echo "<item label=\"Play\"><action name=\"Execute\"><execute>deadbeef --play</execute></action></item>"
|
||||
echo "<item label=\"Pause\"><action name=\"Execute\"><execute>deadbeef --pause</execute></action></item>"
|
||||
echo "<item label=\"Stop\"><action name=\"Execute\"><execute>deadbeef --stop</execute></action></item>"
|
||||
echo "<item label=\"Next\"><action name=\"Execute\"><execute>deadbeef --next</execute></action></item>"
|
||||
echo "<item label=\"Previous\"><action name=\"Execute\"><execute>deadbeef --prev</execute></action></item>"
|
||||
echo "<separator/>"
|
||||
echo "<item label=\"Quit\"><action name=\"Execute\"><execute>deadbeef --quit</execute></action></item>"
|
||||
echo "</openbox_pipe_menu>"
|
||||
97
.config/openbox/pipemenus/gmusicbrowser.py
Executable file
97
.config/openbox/pipemenus/gmusicbrowser.py
Executable file
@@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# GMUISCBROWSER by Derek Taylor (DistroTube)
|
||||
# A simple script that creates an openbox pipemenu that controls gmusicbrowser.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it under the terms of
|
||||
# the GNU General Public License version 3 as published by the Free Software Foundation.
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see: http://www.gnu.org/licenses
|
||||
#
|
||||
# Copy this file somewhere on your path and make it executable.
|
||||
# Add the following line somewhere to your /.config/openbox/menu.xml
|
||||
# <menu execute="/PATH/TO/gmusicbrowser.sh" id="gmusicbrowser" label="gmusicbrowser"/>
|
||||
# Be sure to change the PATH/TO to the correct path to this file.
|
||||
#
|
||||
# Reconfigure openbox.
|
||||
#
|
||||
# REQUIRES the gmusicbrowser music player to be installed on your computer.
|
||||
|
||||
# The playlist submenu is designed to pull all .m3u files from the ~home/$USER/.config/gmusicbrowser/ directory.
|
||||
# Therefore, you must create this folder and export your playlists to this folder.
|
||||
# To enable song information to display, you must enable the NOW PLAYHING plugin in gmusicbrowser.
|
||||
# Add this to "command for when playing song changed": tee /home/$USER/.config/gmusicbrowser/nowplaying.info
|
||||
# Change $USER to your actual username. Tick the checkbox for send title/artist/album in standard input.
|
||||
# You also should go to Preferences > Misc. and tick the checkbox for remember playing position between sessions.
|
||||
# This allows gmusicbrowser to remember the song it was playing within the playlist upon exit.
|
||||
|
||||
# SETTING
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
playlistDir = '/home/derek/.config/gmusicbrowser/'
|
||||
|
||||
cmd1 = "cat /home/derek/.config/gmusicbrowser/*.info | sed -n -e 's/^.*Title=//p' | tr -d '\"'"
|
||||
process = subprocess.Popen(cmd1, stdout=subprocess.PIPE, shell=True)
|
||||
songTitle = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
cmd2 = "cat /home/derek/.config/gmusicbrowser/*.info | sed -n -e 's/^.*Artist=//p' | tr -d '\"'"
|
||||
process = subprocess.Popen(cmd2, stdout=subprocess.PIPE, shell=True)
|
||||
songArtist = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
cmd3 = "cat /home/derek/.config/gmusicbrowser/*.info | sed -n -e 's/^.*Album=//p' | tr -d '\"'"
|
||||
process = subprocess.Popen(cmd3, stdout=subprocess.PIPE, shell=True)
|
||||
songAlbum = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
cmd4 = "cat /home/derek/.config/gmusicbrowser/*.info | sed -n -e 's/^.*Length=//p' | tr -d '\"'"
|
||||
process = subprocess.Popen(cmd4, stdout=subprocess.PIPE, shell=True)
|
||||
songLength = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
cmd5 = "cat /home/derek/.config/gmusicbrowser/*.info | sed -n -e 's/^.*Year=//p' | tr -d '\"'"
|
||||
process = subprocess.Popen(cmd5, stdout=subprocess.PIPE, shell=True)
|
||||
songYear = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
cmd6 = "cat /home/derek/.config/gmusicbrowser/*.info | sed -n -e 's/^.*Track=//p' | tr -d '\"'"
|
||||
process = subprocess.Popen(cmd6, stdout=subprocess.PIPE, shell=True)
|
||||
songTrack = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
cmd7 = "ls -l /home/derek/.config/gmusicbrowser/*m3u | wc -l | sed -n '1p'"
|
||||
process = subprocess.Popen(cmd7, stdout=subprocess.PIPE, shell=True)
|
||||
playlistNum = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
# OPENBOX PIPEMENU
|
||||
|
||||
print ('<?xml version=\"1.0\" encoding=\"UTF-8\"?>')
|
||||
print ('<openbox_pipe_menu>')
|
||||
print ('<menu id=\"root-menu-325671\" label=\"Track Info\">')
|
||||
print ('<item label="'+songTitle+' - '+songArtist+' - '+songAlbum+' ('+songYear+')'+'"><action name=\"Execute\"><execute>gmusicbrowser -cmd PlayPause</execute></action></item>')
|
||||
print ('<item label="'+'Total Runtime: '+songLength+'"><action name=\"Execute\"><execute>gmusicbrowser -cmd PlayPause</execute></action></item>')
|
||||
print ('<separator/>')
|
||||
print ('<item label=\"Open gmusicbrowser\"><action name=\"Execute\"><execute>gmusicbrowser -cmd</execute></action></item>')
|
||||
print ('</menu>')
|
||||
print ('<menu id=\"root-menu-325676\" label=\"Playlists ('+playlistNum+')\">')
|
||||
for filename in os.listdir('/home/derek/.config/gmusicbrowser/'):
|
||||
plist = "echo "+filename+" | rev | cut -d\"/\" -f1 | rev"
|
||||
process = subprocess.Popen(plist, stdout=subprocess.PIPE, shell=True)
|
||||
playlist = process.communicate()[0].decode("utf-8").rstrip()
|
||||
if playlist.endswith(".m3u"):
|
||||
print ('<item label="'+playlist+'"><action name=\"Execute\"><execute>gmusicbrowser '+playlistDir+filename+'</execute></action></item>')
|
||||
print ('</menu>')
|
||||
print ('<separator/>')
|
||||
print ('<item label=\"Play\"><action name=\"Execute\"><execute>gmusicbrowser -cmd Play</execute></action></item>')
|
||||
print ('<item label=\"Pause\"><action name=\"Execute\"><execute>gmusicbrowser -cmd Pause</execute></action></item>')
|
||||
print ('<item label=\"Stop\"><action name=\"Execute\"><execute>gmusicbrowser -cmd Stop</execute></action></item>')
|
||||
print ('<item label=\"Next\"><action name=\"Execute\"><execute>gmusicbrowser -cmd NextSong</execute></action></item>')
|
||||
print ('<item label=\"Previous\"><action name=\"Execute\"><execute>gmusicbrowser -cmd PrevSong</execute></action></item>')
|
||||
print ('<separator/>')
|
||||
print ('<item label=\"Volume Up\"><action name=\"Execute\"><execute>gmusicbrowser -cmd IncVolume</execute></action></item>')
|
||||
print ('<item label=\"Volume Down\"><action name=\"Execute\"><execute>gmusicbrowser -cmd DecVolume</execute></action></item>')
|
||||
print ('<separator/>')
|
||||
print ('<item label=\"Show/Hide\"><action name=\"Execute\"><execute>gmusicbrowser -cmd ShowHide</execute></action></item>')
|
||||
print ('<item label=\"Quit\"><action name=\"Execute\"><execute>gmusicbrowser -cmd Quit</execute></action></item>')
|
||||
print ('</openbox_pipe_menu>')
|
||||
95
.config/openbox/pipemenus/mpcob.sh
Executable file
95
.config/openbox/pipemenus/mpcob.sh
Executable file
@@ -0,0 +1,95 @@
|
||||
#!/bin/sh
|
||||
# mpcob - control mpc in your openbox menu
|
||||
# 02/03/10 - supulton - vrfeight3@gmail.com
|
||||
# chmod +x mpcob.sh, and place:
|
||||
# "<menu id="pipe-mpc-menu" label="music" execute="/path/to/script/mpcob.sh" />"
|
||||
# somewhere in your menu.
|
||||
|
||||
# replace "urxvtc" with your preferred terminal
|
||||
set_term=`echo urxvt`
|
||||
|
||||
# gui mpd preference?
|
||||
set_player=`echo ncmpcpp`
|
||||
|
||||
#set variables
|
||||
playing=`mpc -f "%track%. %artist% - %title%" | sed -n '1p'`
|
||||
nowstatus=`mpc | sed -n '2p' | cut -d ' ' -f1`
|
||||
repeat=`mpc | tail -n 1 | cut -c 15-25`
|
||||
random=`mpc | tail -n 1 | cut -c 29-39`
|
||||
single=`mpc | tail -n 1 | cut -c 43-53`
|
||||
consume=`mpc | tail -n 1 | cut -c 57-`
|
||||
|
||||
# tell when mpc is stopped
|
||||
|
||||
if [ "$nowstatus" != "[Playing]" -a "$nowstatus" != "[Paused]" ]
|
||||
then
|
||||
export nowstatus=`echo "[Stopped]"`
|
||||
fi
|
||||
if [ "$nowstatus" = "[Stopped]" ]
|
||||
then
|
||||
export Playing=`echo Play`
|
||||
fi
|
||||
|
||||
# convert reserved XML characters '&', '<', '>', '"' for songs containing characters
|
||||
|
||||
if [[ $playing =~ '&' ]]
|
||||
then
|
||||
export playing=${playing//\&/\&\;}
|
||||
fi
|
||||
if [[ $playing =~ '<' ]]
|
||||
then
|
||||
export playing=${playing//\</\<\;}
|
||||
fi
|
||||
if [[ $playing =~ '>' ]]
|
||||
then
|
||||
export playing=${playing//\>/\>\;}
|
||||
fi
|
||||
if [[ $playing =~ '"' ]]
|
||||
then
|
||||
export playing=${playing//\"/\"\;}
|
||||
fi
|
||||
# echo menu
|
||||
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||
echo "<openbox_pipe_menu>"
|
||||
echo " <menu id=\"mpcob-playing\" label=\"$nowstatus\">"
|
||||
echo " <item label=\"$playing\"> "
|
||||
echo " <action name=\"Execute\"><execute>mpc toggle</execute></action>"
|
||||
echo " </item>"
|
||||
echo " <separator />"
|
||||
echo " <item label=\"$set_player\"> "
|
||||
echo " <action name=\"Execute\"><execute>urxvt -e ncmpcpp</execute></action>"
|
||||
echo " </item>"
|
||||
echo " </menu>"
|
||||
echo " <separator />"
|
||||
echo " <item label=\"Play/Pause\">"
|
||||
echo " <action name=\"Execute\"><execute>mpc toggle</execute></action>"
|
||||
echo " </item>"
|
||||
echo " <item label=\"Prev\">"
|
||||
echo " <action name=\"Execute\"><execute>mpc prev</execute></action>"
|
||||
echo " </item>"
|
||||
echo " <item label=\"Next\">"
|
||||
echo " <action name=\"Execute\"><execute>mpc next</execute></action>"
|
||||
echo " </item>"
|
||||
echo " <item label=\"Stop\">"
|
||||
echo " <action name=\"Execute\"><execute>mpc stop</execute></action>"
|
||||
echo " </item>"
|
||||
echo " <separator />"
|
||||
echo " <menu id=\"mpcob-options\" label=\"Options\">"
|
||||
echo " <item label=\"$random\">"
|
||||
echo " <action name=\"Execute\"><execute>mpc random</execute></action>"
|
||||
echo " </item>"
|
||||
echo " <item label=\"$repeat\">"
|
||||
echo " <action name=\"Execute\"><execute>mpc repeat</execute></action>"
|
||||
echo " </item>"
|
||||
echo " <item label=\"$consume\">"
|
||||
echo " <action name=\"Execute\"><execute>mpc consume</execute></action>"
|
||||
echo " </item>"
|
||||
echo " <item label=\"$single\">"
|
||||
echo " <action name=\"Execute\"><execute>mpc single</execute></action>"
|
||||
echo " </item>"
|
||||
echo " <separator />"
|
||||
echo " <item label=\"Update\">"
|
||||
echo " <action name=\"Execute\"><execute>mpc update</execute></action>"
|
||||
echo " </item>"
|
||||
echo " </menu>"
|
||||
echo "</openbox_pipe_menu>"
|
||||
68
.config/openbox/pipemenus/mpd.sh
Executable file
68
.config/openbox/pipemenus/mpd.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#! /bin/bash
|
||||
|
||||
# MPD/MPC by olshrimpeyes
|
||||
nowplaying=`mpc -f "%track%. %artist% - %title%" | sed -n '1p'`
|
||||
playing=`mpc | grep playing `
|
||||
nowstatus=`mpc | sed -n '2p' | cut -d ' ' -f1`
|
||||
|
||||
echo "<openbox_pipe_menu>"
|
||||
|
||||
|
||||
|
||||
# <menu icon="/home/derek/.config/openbox/circle-filled.png" id="root-menu-151830" label="Places">
|
||||
# <item icon="/home/derek/.config/openbox/square-open.png" label="Home">
|
||||
# <action name="Execute">
|
||||
# <execute>pcmanfm -n ~/</execute>
|
||||
# </action>
|
||||
# </item>
|
||||
# </menu>
|
||||
|
||||
|
||||
if [[ -z $nowplaying ]]
|
||||
|
||||
then
|
||||
|
||||
echo "<item label=\"Not Playing\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
|
||||
|
||||
else
|
||||
|
||||
echo "<menu icon=\"/home/derek/.config/openbox/circle-filled.png\" id=\"root-menu-325671\" label=\""$nowstatus"\">"
|
||||
echo "<item label=\""$nowplaying"\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
|
||||
echo "<item label=\""$playing"\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
|
||||
echo "<separator/>"
|
||||
echo "<item label=\"Open Music Player\"><action name=\"Execute\"><execute>urxvt -e ncmpcpp</execute></action></item>"
|
||||
echo "</menu>"
|
||||
|
||||
# if [[ -z $playing ]]
|
||||
|
||||
# then
|
||||
|
||||
# echo "<item label=\"Paused\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
|
||||
|
||||
# else
|
||||
|
||||
# echo "<item label=\""$playing"\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
|
||||
|
||||
# fi
|
||||
|
||||
fi
|
||||
|
||||
echo "<separator/>"
|
||||
|
||||
if [[ -z $playing ]]
|
||||
|
||||
then
|
||||
|
||||
echo "<item label=\"Play\"><action name=\"Execute\"><execute>mpc play</execute></action></item>"
|
||||
|
||||
else
|
||||
|
||||
echo "<item label=\"Pause\"><action name=\"Execute\"><execute>mpc pause</execute></action></item>"
|
||||
echo "<item label=\"Stop\"><action name=\"Execute\"><execute>mpc stop</execute></action></item>"
|
||||
|
||||
fi
|
||||
|
||||
echo "<item label=\"Next\"><action name=\"Execute\"><execute>mpc next</execute></action></item>"
|
||||
echo "<item label=\"Previous\"><action name=\"Execute\"><execute>mpc prev</execute></action></item>"
|
||||
echo "<item label=\"Volume\"><action name=\"Execute\"><execute>urxvt -e alsamixer</execute></action></item>"
|
||||
echo "</openbox_pipe_menu>"
|
||||
22
.config/openbox/pipemenus/obrecent.sh
Executable file
22
.config/openbox/pipemenus/obrecent.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
From Openbox
|
||||
Jump to: navigation, search
|
||||
|
||||
#!/bin/sh
|
||||
echo "<openbox_pipe_menu>"
|
||||
files=$(
|
||||
cat ~/.local/share/recently-used.xbel | grep file:/// | tail -n15 | cut -d "\"" -f 2 | tac | while read line;
|
||||
do
|
||||
file=$(echo "$line")
|
||||
name=$(echo -en "$file" | sed 's,.*/,,' | sed 's/%20/ /g')
|
||||
echo "<item label=\"$name\">
|
||||
<action name=\"Execute\"><command>xdg-open $line</command></action>
|
||||
</item>"
|
||||
done);
|
||||
echo "$files"
|
||||
echo "<separator />"
|
||||
echo "<item label=\"Clear Recent Documents\">
|
||||
<action name=\"Execute\"><command>rm ~/.local/share/recently-used.xbel</command></action>
|
||||
</item>"
|
||||
echo "</openbox_pipe_menu>"
|
||||
|
||||
|
||||
183
.config/openbox/pipemenus/places-menu.sh
Executable file
183
.config/openbox/pipemenus/places-menu.sh
Executable file
@@ -0,0 +1,183 @@
|
||||
#!/bin/sh
|
||||
# cb-places-pipemenu - a places openbox pipe menu
|
||||
# Copyright (C) 2010 John Crawley
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
# Version 2012/09/27-cb
|
||||
|
||||
|
||||
# Ported to #!++ <https://crunchbangplusplus.org>
|
||||
# by Ben Young <computermouth@crunchbangplusplus.org>
|
||||
# Ported to Manjaro <https://manjaro.github.io/>
|
||||
# by Daniel Napora <napcok@gmail.com>
|
||||
|
||||
# NB The shell, not bash, is invoked in the hope that
|
||||
# dash will be used, as it is much faster.
|
||||
|
||||
# Usage: add
|
||||
# <menu id="places" label="Places" execute="/path/to/mabox-places-pipemenu ~/" />
|
||||
# to your .config/openbox/menu.xml
|
||||
|
||||
# or, if you want the "recent files" menu incorporated at the top, use:
|
||||
# <menu id="places" label="Places" execute="/path/to/mabox-places-pipemenu --recent ~/" />
|
||||
# make sure you have mabox-recent-files-pipemenu somewhere, and enter its path below.
|
||||
|
||||
# path to your "recent files" script, if you want to incorporate it:
|
||||
recent_script=/usr/bin/mabox-recent-files-pipemenu
|
||||
|
||||
# Command to open folders at "Browse here..." - any file manager
|
||||
open_folder_cmd=pcmanfm
|
||||
# Default command to open files with - others might be xdg-open, gnome-open, pcmanfm...
|
||||
default_open_cmd=exo-open # exo-open comes with thunar
|
||||
# Text editor of choice
|
||||
text_editor=geany
|
||||
|
||||
# function to open files with default open command, or alternative command for certain files
|
||||
# - add other conditions to choice
|
||||
open_file() {
|
||||
[ -x "$1" ] && exec "$text_editor" "$1" # comment out this line if you don't want to edit executables instead of executing
|
||||
#[ -x "$1" ] && exec "terminator -e" "$1" # uncomment this and comment out previous line to run executables in terminal instead of editing
|
||||
[ "${1##*.}" = desktop ] && exec "$text_editor" "$1" # comment out this line if you don't want to edit .desktop files instead of executing
|
||||
exec "$default_open_cmd" "$1" # use default open command if above conditions not satisfied
|
||||
}
|
||||
|
||||
# extra dotfiles to display in HOME folder (dotfiles are hidden by default)
|
||||
# edit the list (space separated, surrounded by single quotes) or comment this line out, to taste:
|
||||
shown_dotfiles='.config .local'
|
||||
|
||||
# By default, this script will display directories separately, before files.
|
||||
# To change this behaviour, see NOTE1, NOTE2 and NOTE3 below, near end of page.
|
||||
|
||||
#######################################################################
|
||||
|
||||
case $1 in
|
||||
# if "--open" option is sent as $1, open file ($2) instead of generating menu
|
||||
--open)
|
||||
open_file "$2"
|
||||
echo "$0 : failed to open $2" >&2
|
||||
exit;; # in case exec command fails
|
||||
# if "--recent" option is sent, incorporate "recent files" menu
|
||||
--recent)
|
||||
shift
|
||||
output='<openbox_pipe_menu>
|
||||
'
|
||||
if [ -x "$recent_script" ]
|
||||
then
|
||||
output="$output"'<separator label="Ostatnio otwierane..." />
|
||||
<menu execute="'"$recent_script"'" id="recent" label="files" />
|
||||
'
|
||||
else
|
||||
echo "$0 : cannot find executable script $recent_script" >&2
|
||||
fi;;
|
||||
*)
|
||||
output='<openbox_pipe_menu>
|
||||
';;
|
||||
esac
|
||||
|
||||
path="${1:-$HOME}" # default starting place is ~, otherwise $1
|
||||
path="$( echo "${path}"/ | tr -s '/' )" # ensure one final slash
|
||||
[ -d "$path" ] || { echo "$0 : $path is not a directory" >&2; exit 1; }
|
||||
|
||||
case "$path" in # only escape if string needs it
|
||||
*\&*|*\<*|*\>*|*\"*|*\'*) pathe=$(sed "s/\&/\&/g;s/</\</g;s/>/\>/g;s/\"/\"/g;s/'/\'/g;" <<XXX
|
||||
$path
|
||||
XXX
|
||||
)
|
||||
;;
|
||||
*)pathe=$path;;
|
||||
esac
|
||||
|
||||
case "$pathe" in
|
||||
*\&apos\;*) pathe_apos=$(sed 's/\'/\'\"\'\"\'/g;'<<XXX
|
||||
$pathe
|
||||
XXX
|
||||
)
|
||||
;;
|
||||
*) pathe_apos=$pathe;;
|
||||
esac
|
||||
|
||||
# output="$output"'<separator label="'$pathe'" />
|
||||
output="$output"'<separator />
|
||||
<item label="Go to '"$pathe"'...">
|
||||
<action name="Execute">
|
||||
<command>
|
||||
''"$open_folder_cmd"'' ''"$pathe_apos"''
|
||||
</command>
|
||||
</action>
|
||||
</item>
|
||||
<separator />
|
||||
'
|
||||
|
||||
unset extra_entries directories_menu files_menu
|
||||
[ "$path" = "$HOME"/ ] && extra_entries="$shown_dotfiles"
|
||||
for i in "$path"* $extra_entries
|
||||
do
|
||||
[ -e "$i" ] || continue # only output code if file exists
|
||||
shortname="${i##*/}"
|
||||
case $shortname in
|
||||
*\&*|*\<*|*\>*|*\"*|*\'*) shortnamee=$(sed "s/\&/\&/g;s/</\</g;s/>/\>/g;s/\"/\"/g;s/'/\'/g;" <<XXX
|
||||
$shortname
|
||||
XXX
|
||||
)
|
||||
;;
|
||||
*) shortnamee=$shortname;;
|
||||
esac
|
||||
case $shortnamee in
|
||||
*\&apos\;*) shortnamee_apos=$(sed 's/\'/\'\"\'\"\'/g;'<<XXX
|
||||
$shortnamee
|
||||
XXX
|
||||
)
|
||||
;;
|
||||
*) shortnamee_apos=$shortnamee;;
|
||||
esac
|
||||
case $shortnamee in
|
||||
*_*) shortnamee_label=$(sed 's/_/__/g;'<<XXX
|
||||
$shortnamee
|
||||
XXX
|
||||
)
|
||||
;;
|
||||
*) shortnamee_label=$shortnamee;;
|
||||
esac
|
||||
[ -d "$i" ] && {
|
||||
# NOTE1 If you want directories and files listed together
|
||||
# change next line (directories_menu="$directories_menu"') to read: files_menu="$files_menu"' (note the one single quote at the end)
|
||||
directories_menu="$directories_menu"'
|
||||
<menu id="'"${pathe_apos}${shortnamee_apos}"'" label="'"$shortnamee_label"'" execute="''"$0"'' ''"${pathe_apos}${shortnamee_apos}"''" />'; continue; }
|
||||
files_menu="$files_menu"'
|
||||
<item label="'"$shortnamee_label"'">
|
||||
<action name="Execute">
|
||||
<command>
|
||||
''"$0"'' --open ''"${pathe_apos}${shortnamee_apos}"''
|
||||
</command>
|
||||
</action>
|
||||
</item>'
|
||||
done
|
||||
|
||||
[ -n "$directories_menu" ] && {
|
||||
# NOTE2 comment out next 2 lines if you don't want "Directories" label
|
||||
# output="${output}"'<item label="Directories" />
|
||||
# '
|
||||
# output="${output}"'<separator />
|
||||
# '
|
||||
output="${output}${directories_menu}"'
|
||||
'; }
|
||||
# [ -n "$files_menu" ] && {
|
||||
# NOTE3 comment out next 2 lines if you don't want "Files" label
|
||||
# output="${output}"'<item label="Files" />
|
||||
# '
|
||||
# output="${output}"'<separator />
|
||||
# '
|
||||
# output="${output}${files_menu}"'
|
||||
#'; }
|
||||
output="${output}"'</openbox_pipe_menu>
|
||||
'
|
||||
printf '%s' "$output"
|
||||
exit
|
||||
97
.config/openbox/pipemenus/shell-color-scripts.sh
Executable file
97
.config/openbox/pipemenus/shell-color-scripts.sh
Executable file
@@ -0,0 +1,97 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# SHELL-COLOR-SCRIPTS by Derek Taylor (DistroTube)
|
||||
# A simple script that creates an openbox pipemenu that runs shell-color-scripts
|
||||
# (https://github.com/dwt1/shell-color-scripts) in a terminal window.
|
||||
#
|
||||
# shell-color-scripts was forked from Color-Scripts (https://github.com/stark/Color-Scripts)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it under the terms of
|
||||
# the GNU General Public License version 3 as published by the Free Software Foundation.
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see: http://www.gnu.org/licenses
|
||||
#
|
||||
# Copy this file somewhere on your path and make it executable.
|
||||
# Add the following line somewhere to your /.config/openbox/menu.xml
|
||||
# <menu execute="/PATH/TO/shell-color-scripts.sh" id="shell-color-scripts" label="Shell Color Scripts"/>
|
||||
# Be sure to change the PATH/TO to the correct path to this file.
|
||||
#
|
||||
# Reconfigure openbox.
|
||||
|
||||
|
||||
# output the initial menu
|
||||
# NOTE: If you do not use the "termite" terminal program or the "ranger" file manager, edit the <command> below.
|
||||
cat <<EOF
|
||||
<openbox_pipe_menu>
|
||||
<item label="Color Scripts">
|
||||
<action name="Execute">
|
||||
<command>
|
||||
termite -e 'ranger ~/color-scripts'
|
||||
</command>
|
||||
</action>
|
||||
</item>
|
||||
EOF
|
||||
|
||||
|
||||
# seperate the main command from the virtuals
|
||||
echo " <separator/>"
|
||||
|
||||
echo " <menu id=\"color-scripts-01-15\" label=\"01-15\">"
|
||||
# each color script listed in the menu
|
||||
for file in $(ls ~/shell-color-scripts/* | head -15); do
|
||||
NAME=$(echo "$file" | rev | cut -d"/" -f1 | rev)
|
||||
echo " <menu id=\"$NAME\" label=\"$NAME\">"
|
||||
# NOTE: If you do not use the "termite" terminal program, then change "termite" to your preferred terminal (ex. xterm, urxvt, etc.)
|
||||
echo "<item label=\"Run in terminal\"><action name=\"Execute\"><execute>termite -e '$file' -t '$file'</execute></action></item>"
|
||||
# NOTE: If you do not use the "vim" text editor, then change "vim" to your preferred editor (ex. nano, geany, etc.)
|
||||
echo "<item label=\"Edit in vim\"><action name=\"Execute\"><execute>termite -e 'vim $file'</execute></action></item>"
|
||||
echo " </menu>"
|
||||
done
|
||||
echo " </menu>"
|
||||
|
||||
echo " <menu id=\"color-scripts-16-30\" label=\"16-30\">"
|
||||
# each color script listed in the menu
|
||||
for file in $(ls ~/shell-color-scripts/* | tail -37 | head -15); do
|
||||
NAME=$(echo "$file" | rev | cut -d"/" -f1 | rev)
|
||||
echo " <menu id=\"$NAME\" label=\"$NAME\">"
|
||||
# NOTE: If you do not use the "termite" terminal program, then change "termite" to your preferred terminal (ex. xterm, urxvt, etc.)
|
||||
echo "<item label=\"Run in terminal\"><action name=\"Execute\"><execute>termite -e '$file' -t '$file'</execute></action></item>"
|
||||
# NOTE: If you do not use the "vim" text editor, then change "vim" to your preferred editor (ex. nano, geany, etc.)
|
||||
echo "<item label=\"Edit in vim\"><action name=\"Execute\"><execute>termite -e 'vim $file'</execute></action></item>"
|
||||
echo " </menu>"
|
||||
done
|
||||
echo " </menu>"
|
||||
|
||||
echo " <menu id=\"color-scripts-31-45\" label=\"31-45\">"
|
||||
# each color script listed in the menu
|
||||
for file in $(ls ~/shell-color-scripts/* | tail -22 | head -15); do
|
||||
NAME=$(echo "$file" | rev | cut -d"/" -f1 | rev)
|
||||
echo " <menu id=\"$NAME\" label=\"$NAME\">"
|
||||
# NOTE: If you do not use the "termite" terminal program, then change "termite" to your preferred terminal (ex. xterm, urxvt, etc.)
|
||||
echo "<item label=\"Run in terminal\"><action name=\"Execute\"><execute>termite -e '$file' -t '$file'</execute></action></item>"
|
||||
# NOTE: If you do not use the "vim" text editor, then change "vim" to your preferred editor (ex. nano, geany, etc.)
|
||||
echo "<item label=\"Edit in vim\"><action name=\"Execute\"><execute>termite -e 'vim $file'</execute></action></item>"
|
||||
echo " </menu>"
|
||||
done
|
||||
echo " </menu>"
|
||||
|
||||
echo " <menu id=\"color-scripts-46+\" label=\"46+\">"
|
||||
# each color script listed in the menu
|
||||
for file in $(ls ~/shell-color-scripts/* | tail -7 | head -15); do
|
||||
NAME=$(echo "$file" | rev | cut -d"/" -f1 | rev)
|
||||
echo " <menu id=\"$NAME\" label=\"$NAME\">"
|
||||
# NOTE: If you do not use the "termite" terminal program, then change "termite" to your preferred terminal (ex. xterm, urxvt, etc.)
|
||||
echo "<item label=\"Run in terminal\"><action name=\"Execute\"><execute>termite -e '$file' -t '$file'</execute></action></item>"
|
||||
# NOTE: If you do not use the "vim" text editor, then change "vim" to your preferred editor (ex. nano, geany, etc.)
|
||||
echo "<item label=\"Edit in vim\"><action name=\"Execute\"><execute>termite -e 'vim $file'</execute></action></item>"
|
||||
echo " </menu>"
|
||||
done
|
||||
echo " </menu>"
|
||||
|
||||
# and finally...
|
||||
echo "</openbox_pipe_menu>"
|
||||
|
||||
31
.config/openbox/pipemenus/steam.sh
Executable file
31
.config/openbox/pipemenus/steam.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# STEAM by Derek Taylor (DistroTube)
|
||||
# A simple script that creates an openbox pipemenu that launches Steam games.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it under the terms of
|
||||
# the GNU General Public License version 3 as published by the Free Software Foundation.
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see: http://www.gnu.org/licenses
|
||||
#
|
||||
# Copy this file somewhere on your path and make it executable.
|
||||
# Add the following line somewhere to your /.config/openbox/menu.xml
|
||||
# <menu execute="/PATH/TO/steam.sh" id="steam" label="Steam"/>
|
||||
# Be sure to change the PATH/TO to the correct path to this file.
|
||||
#
|
||||
# Reconfigure openbox.
|
||||
|
||||
STEAMAPPS=~/.steam/steam/steamapps
|
||||
echo '<openbox_pipe_menu>'
|
||||
echo '<item icon="/home/derek/.config/openbox/square-open.png" label="Steam"><action name="Execute"><execute>steam</execute></action></item>'
|
||||
echo '<separator/>'
|
||||
for file in $(ls $STEAMAPPS/*.acf -1v); do
|
||||
ID=$(cat "$file" | grep '"appID"' | head -1 | sed -r 's/[^"]*"appID"[^"]*"([^"]*)"/\1/')
|
||||
NAME=$(cat "$file" | grep '"name"' | head -1 | sed -r 's/[^"]*"name"[^"]*"([^"]*)"/\1/')
|
||||
echo "<item icon=\"/home/derek/.config/openbox/square-open.png\" label=\"$NAME\"><action name=\"Execute\"><execute>steam steam://run/$ID</execute></action></item>"
|
||||
done
|
||||
echo '</openbox_pipe_menu>'
|
||||
177
.config/openbox/pipemenus/sysinfo.py
Executable file
177
.config/openbox/pipemenus/sysinfo.py
Executable file
@@ -0,0 +1,177 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# SYSTEMINFO by Derek Taylor (DistroTube)
|
||||
# A simple script that creates an openbox pipemenu that displays system information.
|
||||
# My root partition is on /dev/sda1 and my swap is /dev/sda5. Edit these is your partitioning is different.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it under the terms of
|
||||
# the GNU General Public License version 3 as published by the Free Software Foundation.
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see: http://www.gnu.org/licenses
|
||||
#
|
||||
# Copy this file somewhere on your path and make it executable.
|
||||
# Add the following line somewhere to your /.config/openbox/menu.xml
|
||||
# <menu execute="/PATH/TO/sysinfo.py" id="sysinfo" label="System Info"/>
|
||||
# Be sure to change the PATH/TO to the correct path to this file.
|
||||
#
|
||||
# Reconfigure openbox.
|
||||
#
|
||||
# REQUIRES net-tools (for ifconfig) to be installed on your computer.
|
||||
|
||||
# SETTINGS
|
||||
|
||||
import subprocess
|
||||
|
||||
# SETTINGS - SYSTEM
|
||||
|
||||
syst1 = "whoami"
|
||||
process = subprocess.Popen(syst1, stdout=subprocess.PIPE, shell=True)
|
||||
user = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
syst2 = "uname -n"
|
||||
process = subprocess.Popen(syst2, stdout=subprocess.PIPE, shell=True)
|
||||
host = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
syst3 = "uname -s"
|
||||
process = subprocess.Popen(syst3, stdout=subprocess.PIPE, shell=True)
|
||||
system = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
syst4 = "uname -r"
|
||||
process = subprocess.Popen(syst4, stdout=subprocess.PIPE, shell=True)
|
||||
release = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
syst5 = "uname -m"
|
||||
process = subprocess.Popen(syst5, stdout=subprocess.PIPE, shell=True)
|
||||
arch = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
syst6 = "uptime | sed 's/.* up //' | sed 's/[0-9]* us.*//' | sed 's/ day, / day /' | sed 's/ days, / days /' | sed 's/:/ hours /' | sed 's/ min//'| sed 's/,/ min/' | sed 's/ / /'"
|
||||
process = subprocess.Popen(syst6, stdout=subprocess.PIPE, shell=True)
|
||||
uptime = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
# SETTINGS - CPU
|
||||
|
||||
cpu1 = "cat /proc/cpuinfo | grep 'model name' | sed 's/.*: //' | sed -n '1p'"
|
||||
process = subprocess.Popen(cpu1, stdout=subprocess.PIPE, shell=True)
|
||||
CPUmodel = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
cpu2 = "cat /proc/cpuinfo | grep -m 1 'cpu MHz' | sed 's/.*: //'"
|
||||
process = subprocess.Popen(cpu2, stdout=subprocess.PIPE, shell=True)
|
||||
CPUfreq = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
cpu3 = "cat /proc/cpuinfo | grep -m 1 'cache size' | sed 's/.*: //'"
|
||||
process = subprocess.Popen(cpu3, stdout=subprocess.PIPE, shell=True)
|
||||
CPUcache = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
# SETTINGS - MEM
|
||||
|
||||
mem1 = "echo 'scale = 2; ('$(cat /proc/meminfo | grep MemTotal: | awk '{print $2}' | sed 's/k//')' /1024)' | bc"
|
||||
process = subprocess.Popen(mem1, stdout=subprocess.PIPE, shell=True)
|
||||
memTotal = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
mem2 = "echo 'scale = 2; ('$(cat /proc/meminfo | grep MemFree: | awk '{print $2}' | sed 's/k//')' /1024) + ('$(cat /proc/meminfo | grep grep -m 1 Cached: | awk '{print $2}' | sed 's/k//')' /1024)' | bc"
|
||||
process = subprocess.Popen(mem2, stdout=subprocess.PIPE, shell=True)
|
||||
memFree = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
mem3 = "echo 'scale = 2; ('$(cat /proc/meminfo | grep MemTotal: | awk '{print $2}' | sed 's/k//')' /1024) - (('$(cat /proc/meminfo | grep MemFree: | awk '{print $2}' | sed 's/k//')' /1024) + ('$(cat /proc/meminfo | grep -m 1 Cached: | awk '{print $2}' | sed 's/k//')' /1024))' | bc"
|
||||
process = subprocess.Popen(mem3, stdout=subprocess.PIPE, shell=True)
|
||||
memUsed = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
mem4 = "echo 'scale = 2; (('$(cat /proc/meminfo | grep MemTotal: | awk '{print $2}' | sed 's/k//')' /1024) - (('$(cat /proc/meminfo | grep MemFree: | awk '{print $2}' | sed 's/k//')' /1024) + ('$(cat /proc/meminfo | grep -m 1 Cached: | awk '{print $2}' | sed 's/k//')' /1024))) / ('$(cat /proc/meminfo | grep MemTotal: | awk '{print $2}' | sed 's/k//')' /1024) *100' | bc"
|
||||
process = subprocess.Popen(mem4, stdout=subprocess.PIPE, shell=True)
|
||||
memUsedPercent = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
# SETTINGS - DISKS
|
||||
|
||||
disk1 = "df -HlT | grep /dev/sda1 | sed -r 's/ / /g' | sed -r 's/ / /g' | cut -d ' ' -f 1"
|
||||
process = subprocess.Popen(disk1, stdout=subprocess.PIPE, shell=True)
|
||||
rootPart = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
disk2 = "df -HlT | grep /dev/sda1 | sed -r 's/ / /g' | sed -r 's/ / /g' | cut -d ' ' -f 2"
|
||||
process = subprocess.Popen(disk2, stdout=subprocess.PIPE, shell=True)
|
||||
fileSys = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
disk3 = "df -HlT | grep /dev/sda1 | sed -r 's/ / /g' | sed -r 's/ / /g' | cut -d ' ' -f 3"
|
||||
process = subprocess.Popen(disk3, stdout=subprocess.PIPE, shell=True)
|
||||
diskTotal = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
disk4 = "df -HlT | grep /dev/sda1 | sed -r 's/ / /g' | sed -r 's/ / /g' | cut -d ' ' -f 4"
|
||||
process = subprocess.Popen(disk4, stdout=subprocess.PIPE, shell=True)
|
||||
diskUsed = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
disk5 = "df -HlT | grep /dev/sda1 | sed -r 's/ / /g' | sed -r 's/ / /g' | cut -d ' ' -f 5"
|
||||
process = subprocess.Popen(disk5, stdout=subprocess.PIPE, shell=True)
|
||||
diskFree = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
# SETTINGS - SWAP
|
||||
|
||||
swap1 = "cat /proc/swaps | grep /dev/sda5 | sed -r 's/ / /g' | sed -r 's/ / /g' | cut -d ' ' -f 1"
|
||||
process = subprocess.Popen(swap1, stdout=subprocess.PIPE, shell=True)
|
||||
swapPart = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
swap2 = "echo 'scale = 2; ('$(cat /proc/meminfo | grep SwapTotal: | awk '{print $2}' | sed 's/k//')' /1024)' | bc"
|
||||
process = subprocess.Popen(swap2, stdout=subprocess.PIPE, shell=True)
|
||||
swapTotal = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
swap3 = "echo 'scale = 2; ('$(cat /proc/meminfo | grep SwapFree: | awk '{print $2}' | sed 's/k//')' /1024)' | bc"
|
||||
process = subprocess.Popen(swap3, stdout=subprocess.PIPE, shell=True)
|
||||
swapFree = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
swap4 = "echo 'scale = 2; ('$(cat /proc/meminfo | grep SwapTotal: | awk '{print $2}' | sed 's/k//')' /1024) - ('$(cat /proc/meminfo | grep SwapFree: | awk '{print $2}' | sed 's/k//')' /1024)' | bc"
|
||||
process = subprocess.Popen(swap4, stdout=subprocess.PIPE, shell=True)
|
||||
swapUsed = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
swap5 = "echo 'scale = 2; (('$(cat /proc/meminfo | grep SwapTotal: | awk '{print $2}' | sed 's/k//')' /1024) - ('$(cat /proc/meminfo | grep SwapFree: | awk '{print $2}' | sed 's/k//')' /1024)) / ('$(cat /proc/meminfo | grep SwapTotal: | awk '{print $2}' | sed 's/k//')' /1024) *100' | bc"
|
||||
process = subprocess.Popen(swap5, stdout=subprocess.PIPE, shell=True)
|
||||
swapUsedPercent = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
# SETTINGS - NET
|
||||
|
||||
net1 = "/sbin/ifconfig 'enp3s0' | grep 'inet ' | sed 's/.*inet //' | sed 's/netmask.*//'"
|
||||
process = subprocess.Popen(net1, stdout=subprocess.PIPE, shell=True)
|
||||
netIP = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
net2 = "/sbin/ifconfig 'enp3s0' | grep 'RX packets' | sed 's/.*bytes [0-9]* (//' | sed 's/iB).*)*//' | sed 's/b).*)*//' | sed 's/).*)*//'"
|
||||
process = subprocess.Popen(net2, stdout=subprocess.PIPE, shell=True)
|
||||
netDown = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
net3 = "/sbin/ifconfig 'enp3s0' | grep 'TX packets' | sed 's/.*bytes [0-9]* (//' | sed 's/iB).*)*//' | sed 's/b).*)*//' | sed 's/).*)*//'"
|
||||
process = subprocess.Popen(net3, stdout=subprocess.PIPE, shell=True)
|
||||
netUp = process.communicate()[0].decode("utf-8").rstrip()
|
||||
|
||||
# OPENBOX PIPEMENU
|
||||
|
||||
print ('<?xml version=\"1.0\" encoding=\"UTF-8\"?>')
|
||||
print ('<openbox_pipe_menu>')
|
||||
print ('<separator />')
|
||||
print ('<item label="SYSTEM" />')
|
||||
print ('<separator />')
|
||||
print ('<item label="'+'User @ Host: '+user+' @ '+host+'"/>')
|
||||
print ('<item label="'+'Kernel: '+system+' '+release+' '+arch+'"/>')
|
||||
print ('<item label="'+'Uptime: '+uptime+'"/>')
|
||||
print ('<separator />')
|
||||
print ('<item label="CPU" />')
|
||||
print ('<separator />')
|
||||
print ('<item label="'+'CPU: '+CPUmodel+'"/>')
|
||||
print ('<item label="'+'CPU FREQ: '+CPUfreq+' MHz"/>')
|
||||
print ('<item label="'+'CPU Cache: '+CPUcache+'"/>')
|
||||
print ('<separator />')
|
||||
print ('<item label="MEM" />')
|
||||
print ('<separator />')
|
||||
print ('<item label="'+'RAM USED: '+memUsed+' MiB/'+memTotal+' MiB'+' ('+memUsedPercent+'%)'+'"/>')
|
||||
print ('<separator />')
|
||||
print ('<item label="DISKS" />')
|
||||
print ('<separator />')
|
||||
print ('<item label="'+'Root: '+rootPart+' ('+fileSys+')"/>')
|
||||
print ('<item label="'+'Swap: '+swapPart+' ('+swapUsed+ ' MiB/'+swapTotal+' MiB)\"/>')
|
||||
print ('<item label="'+'SSD: '+diskTotal+' ('+diskUsed+ ' USED/'+diskFree+' FREE)\"/>')
|
||||
print ('<separator />')
|
||||
print ('<item label="NET" />')
|
||||
print ('<separator />')
|
||||
print ('<item label="'+'NET IP: '+netIP+'"/>')
|
||||
print ('<item label="'+'RX bytes: '+netDown+'"/>')
|
||||
print ('<item label="'+'TX bytes: '+netUp+'"/>')
|
||||
print ('</openbox_pipe_menu>')
|
||||
82
.config/openbox/pipemenus/virtualbox.sh
Executable file
82
.config/openbox/pipemenus/virtualbox.sh
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2009-2013 "isomorph"
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# BSD 3-Clause License
|
||||
#
|
||||
# ----
|
||||
#
|
||||
# OpenBox "VirtualBox" pipe-menu
|
||||
# Outputs a menu roughly akin to:
|
||||
#
|
||||
# VirtualBox
|
||||
# ----------
|
||||
# <Virtual Machine>
|
||||
# <Virtual Machine>
|
||||
# <Virtual Machine>
|
||||
# ...
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# 1. Copy this file somewhere on your path and make it executable
|
||||
# 2. Add the following line somewhere to your /.config/openbox/menu.xml
|
||||
#
|
||||
# <menu id="vms" label="Virtual Machines" execute="cb-virtual-machines-pipemenu" />
|
||||
#
|
||||
# 3. Reconfigure openbox
|
||||
|
||||
|
||||
# make sure virtualbox itself exists
|
||||
which "virtualbox" > /dev/null
|
||||
if [ "$?" -ne "0" ]; then
|
||||
cat <<EOF
|
||||
<openbox_pipe_menu>
|
||||
<item label="Virtualbox cannot be found"></item>
|
||||
<item label="Click here to install Virtualbox">
|
||||
<action name="Execute">
|
||||
<command>x-www-browser https://www.virtualbox.org/wiki/Linux_Downloads</command>
|
||||
</action></item>
|
||||
</openbox_pipe_menu>
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# output the initial menu
|
||||
cat <<EOF
|
||||
<openbox_pipe_menu>
|
||||
<item label="VirtualBox">
|
||||
<action name="Execute">
|
||||
<command>
|
||||
virtualbox -style gtk
|
||||
</command>
|
||||
</action>
|
||||
</item>
|
||||
EOF
|
||||
|
||||
# Check for the vboxmanage binary
|
||||
which "vboxmanage" > /dev/null
|
||||
if [ "$?" -ne "0" ]; then
|
||||
echo "</openbox_pipe_menu>"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# seperate the main command from the virtuals
|
||||
echo " <separator/>"
|
||||
|
||||
# output the list of virtual machines
|
||||
vboxmanage list vms | cut -f 2 -d "\"" | sort -f | while read vm
|
||||
do
|
||||
cat <<EOF
|
||||
<item label="$vm">
|
||||
<action name="Execute">
|
||||
<command>
|
||||
vboxmanage startvm "$vm"
|
||||
</command>
|
||||
</action>
|
||||
</item>
|
||||
EOF
|
||||
done;
|
||||
|
||||
# and finally...
|
||||
echo "</openbox_pipe_menu>"
|
||||
Reference in New Issue
Block a user