Commit ec894ef3 authored by Jens Henrik Goebbert's avatar Jens Henrik Goebbert
parents 3f2ad221 690be2c7
# set XDG base directory (public and private one)
export XDG_BASE=/homeb/zam/goebbert/workspace/xdg_profiles/etc/xdg
export XDG_BASE_HOME=${HOME}/.local/xdg
# set XDG config variables depending on XDG_PROFILE
XDG_BASE=/homeb/zam/goebbert/workspace/xdg_configs
. ${XDG_BASE}/etc/xdg/xdg_profile.sh
. ${XDG_BASE}/xdg_profile_set.sh
# run XFCE4
exec startxfce4
......
# set XDG base directory (public and private one)
export XDG_BASE=/homeb/zam/goebbert/workspace/xdg_profiles/etc/xdg
export XDG_BASE_HOME=${HOME}/.local/xdg
# set XDG config variables depending on XDG_PROFILE
. ${XDG_BASE}/xdg_profile_set.sh
# run XFCE4
exec startxfce4
#!/bin/bash
print_usage() {
echo "Usage: ${0} [OPTION]..."
echo "List information of XDG profile categories."
echo "Categories are searched in XDG_BASE/xdg_profiles and XDG_BASE_HOME/xdg_profiles."
echo "Currently they are set to: "
echo " XDG_BASE =${XDG_BASE}"
echo " XDG_BASE_HOME=${XDG_BASE_HOME}"
echo
echo "Mandatory arguments to long options are mandatory for short options too."
echo " -h, --help Print usage."
echo " -d, --details Print categories including their details."
}
print_categories() {
# check
if [[ ! -d ${XDG_BASE} ]]; then
echo "ERROR: XDG_BASE not set."
return
fi
# get profile categories
local XDG_PROFILE_CATEGORIES=()
local XDG_PROFILE_CATEGORIES_DESCRIPTION=()
local XDG_PROFILE_CATEGORIES_CREATOR=()
if [[ -f ${XDG_BASE}/xdg_profiles/xdg_profiles.info ]]; then
while read line; do
# read each line starting with "XDG_PROFILE_CATEGORY="
prefix="XDG_PROFILES_CATEGORY="
if [[ ${line} == ${prefix}* ]]; then
line=${line#${prefix}} # remove prefix from string
XDG_PROFILE_CATEGORIES+=("$( echo ${line} | cut -d';' -f 1)")
XDG_PROFILE_CATEGORIES_DESCRIPTION+=("$( echo ${line} | cut -d';' -f 2)")
XDG_PROFILE_CATEGORIES_CREATOR+=("$( echo ${line} | cut -d';' -f 3)")
fi
done < ${XDG_BASE}/xdg_profiles/xdg_profiles.info
fi
if [[ -f ${XDG_BASE_HOME}/xdg_profiles/xdg_profiles.info ]]; then
while read line; do
# read each line starting with "XDG_PROFILE_CATEGORY="
prefix="XDG_PROFILES_CATEGORY="
if [[ ${line} == ${prefix}* ]]; then
line=${line#${prefix}} # remove prefix from string
XDG_PROFILE_CATEGORIES+=("$( echo ${line} | cut -d';' -f 1)")
XDG_PROFILE_CATEGORIES_DESCRIPTION+=("$( echo ${line} | cut -d';' -f 2)")
XDG_PROFILE_CATEGORIES_CREATOR+=("$( echo ${line} | cut -d';' -f 3)")
fi
done < ${XDG_BASE_HOME}/xdg_profiles/xdg_profiles.info
fi
# print profile categories
pad=$(printf '%0.1s' "."{1..60})
padlength=40
for i in $(seq 1 ${#XDG_PROFILE_CATEGORIES[@]}); do
ii=$(( ${i} -1))
printf '%s' "${XDG_PROFILE_CATEGORIES[${ii}]}"
if [[ "${details}" = true ]]; then
printf '%*.*s' 0 $((padlength - ${#XDG_PROFILE_CATEGORIES[${ii}]} )) "$pad"
printf '%s' "${XDG_PROFILE_CATEGORIES_DESCRIPTION[${ii}]}"
fi
printf '\n'
done
}
# Transform long options to short ones
for arg in "$@"; do
shift
case "$arg" in
"--help") set -- "$@" "-h" ;;
"--details") set -- "$@" "-d" ;;
*) set -- "$@" "$arg"
esac
done
# Default behavior
help=false; details=false
# Parse short options
OPTIND=1
while getopts "hd" opt
do
case "$opt" in
"h") print_usage; exit 0 ;;
"d") details=true ;;
"?") print_usage >&2; exit 1 ;;
esac
done
# remove options from positional parameters
shift $(expr $OPTIND - 1)
# print categories
print_categories
This diff is collapsed.
#!/bin/bash
print_usage() {
echo "Usage: ${0} [OPTION]..."
echo "List information of XDG profiles."
echo "XDG_BASE/xdg_profiles and XDG_BASE_HOME/xdg_profiles is searched for profiles."
echo "Currently they are set to: "
echo " XDG_BASE =${XDG_BASE}"
echo " XDG_BASE_HOME=${XDG_BASE_HOME}"
echo
echo "Mandatory arguments to long options are mandatory for short options too."
echo " -h, --help Print usage."
echo " -p, --paths Print profile paths."
echo " -n, --names Print profile name."
echo " -d, --descriptions Print profile description"
echo " -c, --categories Print profile category"
echo " -o, --creators Print userid of creator"
echo " -b, --births Print day+time of creation"
echo " -i, --hidden Print hidden flag"
echo " -a, --show_all Print all profiles includen the hidden ones."
echo
}
print_profiles() {
# get profile categories
local XDG_PROFILE_IDS=()
local XDG_PROFILE_PATHS=()
local XDG_PROFILE_NAMES=()
local XDG_PROFILE_DESCRIPTIONS=()
local XDG_PROFILE_CATEGORIES=()
local XDG_PROFILE_CREATORS=()
local XDG_PROFILE_BIRTHS=()
local XDG_PROFILE_HIDDENS=()
# collect information of all xdg profiles
for id_path in ${XDG_BASE_HOME}/xdg_profiles/* ${XDG_BASE}/xdg_profiles/* ; do
# is path a directory
if [[ ! -d ${id_path} ]]; then
continue
fi
# does path include a profile description file
if [[ ! -f ${id_path}/xdg_profile.info ]]; then
continue
fi
XDG_PROFILE_IDS+=($(basename ${id_path}))
XDG_PROFILE_PATHS+=("${id_path}")
prefix="XDG_PROFILE_NAME="
line=$(grep ${prefix} ${id_path}/xdg_profile.info)
line=${line:- }
XDG_PROFILE_NAMES+=("${line#${prefix}}")
prefix="XDG_PROFILE_DESCRIPTION="
line=$(grep ${prefix} ${id_path}/xdg_profile.info)
line=${line:- }
XDG_PROFILE_DESCRIPTIONS+=("${line#${prefix}}")
prefix="XDG_PROFILE_CATEGORY="
line=$(grep ${prefix} ${id_path}/xdg_profile.info)
line=${line:- }
XDG_PROFILE_CATEGORIES+=("${line#${prefix}}")
prefix="XDG_PROFILE_CREATOR="
line=$(grep ${prefix} ${id_path}/xdg_profile.info)
line=${line:- }
XDG_PROFILE_CREATORS+=("${line#${prefix}}")
prefix="XDG_PROFILE_BIRTH="
line=$(grep ${prefix} ${id_path}/xdg_profile.info)
line=${line:- }
XDG_PROFILE_BIRTHS+=("${line#${prefix}}")
prefix="XDG_PROFILE_HIDDEN="
line=$(grep ${prefix} ${id_path}/xdg_profile.info)
line=${line:-0}
XDG_PROFILE_HIDDENS+=("${line#${prefix}}")
done
# print profile categories
pad=$(printf '%0.1s' " "{1..60})
padlength=20
for i in $(seq 1 ${#XDG_PROFILE_IDS[@]}); do
ii=$(( ${i} -1))
# skip hidden profiles if not "show all"
if [[ "${show_all}" = false ]]; then
if [ ${XDG_PROFILE_HIDDENS} -eq 1 ]; then
continue
fi
fi
printf '%s' "${XDG_PROFILE_IDS[${ii}]}"
lastlen=${#XDG_PROFILE_IDS[${ii}]}
# print xdg project path
if [[ "${paths}" = true ]]; then
printf '%*.*s' 0 $((padlength - ${lastlen})) "$pad"
printf '%s' "${XDG_PROFILE_PATHS[${ii}]}"
lastlen=${#XDG_PROFILE_PATHS[${ii}]}
fi
# print xdg project name
if [[ "${names}" = true ]]; then
printf '%*.*s' 0 $((padlength - ${lastlen})) "$pad"
printf '%s' "${XDG_PROFILE_NAMES[${ii}]}"
lastlen=${#XDG_PROFILE_NAMES[${ii}]}
fi
# print xdg project description
if [[ "${descriptions}" = true ]]; then
printf '%*.*s' 0 $((padlength - ${lastlen})) "$pad"
printf '%s' "${XDG_PROFILE_DESCRIPTIONS[${ii}]}"
lastlen=${#XDG_PROFILE_DESCRIPTIONS[${ii}]}
fi
# print xdg project category
if [[ "${categories}" = true ]]; then
printf '%*.*s' 0 $((padlength - ${lastlen})) "$pad"
printf '%s' "${XDG_PROFILE_CATEGORIES[${ii}]}"
lastlen=${#XDG_PROFILE_CATEGORIES[${ii}]}
fi
# print xdg project creator
if [[ "${creators}" = true ]]; then
printf '%*.*s' 0 $((padlength - ${lastlen})) "$pad"
printf '%s' "${XDG_PROFILE_CREATORS[${ii}]}"
lastlen=${#XDG_PROFILE_CREATORS[${ii}]}
fi
# print xdg project birth
if [[ "${births}" = true ]]; then
printf '%*.*s' 0 $((padlength - ${lastlen})) "$pad"
printf '%s' "${XDG_PROFILE_BIRTHS[${ii}]}"
lastlen=${#XDG_PROFILE_BIRTHS[${ii}]}
fi
# print xdg project hidden
if [[ "${hiddens}" = true ]]; then
printf '%*.*s' 0 $((padlength - ${lastlen})) "$pad"
printf '%s' "${XDG_PROFILE_HIDDENS[${ii}]}"
lastlen=${#XDG_PROFILE_HIDDENS[${ii}]}
fi
printf '\n'
done
}
# Transform long options to short ones
for arg in "$@"; do
shift
case "$arg" in
"--help") set -- "$@" "-h" ;;
"--paths") set -- "$@" "-p" ;;
"--names") set -- "$@" "-n" ;;
"--descriptions") set -- "$@" "-d" ;;
"--categories") set -- "$@" "-c" ;;
"--creators") set -- "$@" "-o" ;;
"--births") set -- "$@" "-b" ;;
"--hidden") set -- "$@" "-a" ;;
*) set -- "$@" "$arg"
esac
done
# parse short options
help=false;
paths=false;
names=false;
descriptions=false;
categories=false;
creators=false;
births=false;
hiddens=false;
show_all=false
OPTIND=1
while getopts "hpndcobia" opt
do
case "$opt" in
"h") print_usage; exit 0 ;;
"p") paths=true ;;
"n") names=true ;;
"d") descriptions=true ;;
"c") categories=true ;;
"o") creators=true ;;
"b") births=true ;;
"i") hiddens=true; show_all=true ;;
"a") show_all=true ;;
"?") print_usage >&2; exit 1 ;;
esac
done
# remove options from positional parameters
shift $(expr $OPTIND - 1)
# print profiles
print_profiles
......@@ -11,21 +11,24 @@ if grep -q "^$LOGNAME" /etc/passwd ; then
fi
# path to XDG desktop profiles
XDG_PROFILES_DIR=${XDG_BASE}/etc/xdg/xdg_profiles
export XDG_PROFILES_DIR=${XDG_BASE}/xdg_profiles
# set default XDG variables
export XDG_CONFIG_HOME=${HOME}/.config/xdg_profiles/default
export XDG_CONFIG_DIRS=${XDG_PROFILES_DIR}/default/config:/etc/xdg:/etc
export XDG_CONFIG_DIR=${XDG_PROFILES_DIR}/default/config
export XDG_CONFIG_DIRS=${XDG_CONFIG_DIR}:/etc/xdg:/etc
export XDG_DATA_HOME=${HOME}/.local/xdg_profiles/default
export XDG_DATA_DIR=${XDG_PROFILES_DIR}/default/data
export XDG_DATA_DIRS=${XDG_DATA_DIR}:/usr/local/share:/usr/share
# set profile XDG variables
# XDG_DATA_HOME must be ${HOME}/.local/xdg_profiles/${XDG_PROFILE}, as this is fixed in ${XDG_CONFIG_HOME}/user-dirs.dirs
echo -n "select XDG profile ${XDG_PROFILE} ... "
if [ -d ${XDG_PROFILES_DIR}/${XDG_PROFILE} ]; then
export XDG_CONFIG_HOME=${HOME}/.config/xdg_profiles/${XDG_PROFILE}
export XDG_CONFIG_DIRS=${XDG_PROFILES_DIR}/${XDG_PROFILE}/config:${XDG_CONFIG_DIRS}
export XDG_CONFIG_DIR=${XDG_PROFILES_DIR}/${XDG_PROFILE}/config
export XDG_CONFIG_DIRS=${XDG_CONFIG_DIR}:${XDG_CONFIG_DIRS}
export XDG_DATA_HOME=${HOME}/.local/xdg_profiles/${XDG_PROFILE}
export XDG_DATA_DIR=${XDG_PROFILES_DIR}/${XDG_PROFILE}/data
export XDG_DATA_DIRS=${XDG_DATA_DIR}:${XDG_DATA_DIRS}
......@@ -39,11 +42,33 @@ fi
if [ ! -d ${XDG_CONFIG_HOME} ]; then
echo "XDG profile ${XDG_PROFILE} choosen the first time ... creating ${XDG_CONFIG_HOME}"
mkdir -p ${XDG_CONFIG_HOME}
# change default desktop directory from ${HOME}/Desktop to ${XDG_DATA_HOME}/Desktop
# to enable profile-specific desktop icons
cp ${XDG_PROFILES_DIR}/${XDG_PROFILE}/config/user-dirs.dirs ${XDG_CONFIG_HOME}/
fi
if [ ! -d ${XDG_DATA_HOME} ]; then
echo "XDG profile ${XDG_PROFILE} choosen the first time ... creating ${XDG_DATA_HOME}"
mkdir -p ${XDG_DATA_HOME}
fi
if [ -d ${XDG_PROFILES_DIR}/${XDG_PROFILE}/data/Desktop ]; then
if [ ! -d ${XDG_DATA_HOME}/Desktop ]; then
echo "XDG profile ${XDG_PROFILE} choosen the first time ... creating ${XDG_DATA_HOME}/Desktop"
mkdir -p ${XDG_DATA_HOME}/Desktop
fi
fi
# always renew desktop icons, if profile has its own Desktop folder
# this might annoy users, who have removed the icons,
# but it ensures that icon updates are pushed to the users on every new login
if [ -d ${XDG_PROFILES_DIR}/${XDG_PROFILE}/data/Desktop ]; then
ln -s -f ${XDG_PROFILES_DIR}/${XDG_PROFILE}/data/Desktop/* ${XDG_DATA_HOME}/Desktop/
fi
# always renew devilspie2 scripts on login
if [ -d ${XDG_PROFILES_DIR}/${XDG_PROFILE}/config/devilspie2 ]; then
mkdir -p ${XDG_CONFIG_HOME}/devilspie2/
cp -f ${XDG_PROFILES_DIR}/${XDG_PROFILE}/config/devilspie2/*.lua ${XDG_CONFIG_HOME}/devilspie2/
fi
# echo settings
echo "XDG_CONFIG_HOME=${XDG_CONFIG_HOME}"
......
[Desktop Entry]
Encoding=UTF-8
Version=
Type=Application
Name=devilspie2
Comment=
Exec=bash -c 'devilspie2'
StartupNotify=false
Terminal=false
Hidden=false
[Desktop Entry]
Encoding=UTF-8
Version=
Type=Application
Name=infoterm-default
Comment=
Exec=bash -c 'IFS=: && for p in ${XDG_CONFIG_DIRS}; do if [ -e ${p}/infoterm-default/infoterm-default.sh ]; then ${p}/infoterm-default/infoterm-default.sh; break; fi; done'
StartupNotify=false
Terminal=false
Hidden=false
-- the debug_print command does only print anything to stdout
-- if devilspie2 is run using the --debug option
debug_print("Window Name: " .. get_window_name());
debug_print("Application name: " .. get_application_name())
if (get_window_name()=="infoterm-default") then
-- Removes all window decorations
undecorate_window()
-- asks the window manager to put the window on all workspaces
pin_window()
-- Asks the window manager to keep the window's position fixed on the screen,
-- even when the workspace or viewport scrolls.
stick_window()
-- set this to true if you would like the window to skip listing in your tasklist
set_skip_tasklist(true)
-- set this to true if you would like the window to skip listing in your pager
set_skip_pager(true)
-- set the current window below all normal windows
set_window_below(true)
-- sets the window type, according to _NET_WM_WINDOW_TYPE
set_window_type("WINDOW_TYPE_SPLASH")
end
# settings
TERM_MARGIN_X_RIGHT=50
TERM_MARGIN_Y_TOP=250
TERM_MARGIN_Y_BOTTOM=300
TERM_CHAR_HEIGHT_PX=8
TERM_CHAR_WIDTH_PX=$(expr ${TERM_CHAR_HEIGHT_PX} / 2)
TERM_CHAR_HEIGHT_MARGIN=4
echo
echo "InfoTerm-Settings:"
echo " TERM_MARGIN_X_RIGHT = ${TERM_MARGIN_X_RIGHT}"
echo " TERM_MARGIN_Y_TOP = ${TERM_MARGIN_Y_TOP}"
echo " TERM_MARGIN_Y_BOTTOM = ${TERM_MARGIN_Y_BOTTOM}"
echo " TERM_CHAR_HEIGHT_PX = ${TERM_CHAR_HEIGHT_PX}"
echo " TERM_CHAR_WIDTH_PX = ${TERM_CHAR_WIDTH_PX}"
echo " TERM_CHAR_HEIGHT_MARGIN = ${TERM_CHAR_HEIGHT_MARGIN}"
echo
# calc terminal geometry (size+position)
SCR_RES_X=`xrandr | grep current | awk '{ for(i=1;i<=NF;i++) if ($i == "current") print $(i+1) }' | sed 's/[^0-9]*//g'`
SCR_RES_Y=`xrandr | grep current | awk '{ for(i=1;i<=NF;i++) if ($i == "current") print $(i+3) }' | sed 's/[^0-9]*//g'`
echo "screen resolution: ${SCR_RES_X} x ${SCR_RES_Y}"
TERM_CHARS_X=120
TERM_CHARS_Y=16
#$(( (${SCR_RES_Y} - ${TERM_MARGIN_Y_TOP} - ${TERM_MARGIN_Y_BOTTOM}) / (${TERM_CHAR_HEIGHT_PX} + ${TERM_CHAR_HEIGHT_MARGIN}) ))
echo "terminal columns x rows: ${TERM_CHARS_X} x ${TERM_CHARS_Y}"
INFOTERM_XPOS=$(( ${SCR_RES_X} - ${TERM_MARGIN_X_RIGHT} - ${TERM_CHARS_X} * ${TERM_CHAR_WIDTH_PX} ))
INFOTERM_YPOS=${TERM_MARGIN_Y_TOP}
echo "terminal pixel position: ${INFOTERM_XPOS} x ${INFOTERM_YPOS}"
INFOTERM_GEOMETRY=${TERM_CHARS_X}x${TERM_CHARS_Y}+${INFOTERM_XPOS}+${INFOTERM_YPOS}
echo "geometry: ${INFOTERM_GEOMETRY}"
# set the XDG_CONFIG_HOME for infoterm to the directory infoterm.sh is stored
# and start terminal with forever-refresh-loop
INFOTERM_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
XDG_CONFIG_HOME=${INFOTERM_DIR} \
PRINT_LINES=${TERM_CHARS_Y} \
xfce4-terminal --disable-server --title=infoterm-default --hide-menubar --hide-borders --hide-toolbar --geometry=${INFOTERM_GEOMETRY} \
-e 'sh -c "htop -C -u nobody --delay=50 --sort-key=PERCENT_CPU"'
[Configuration]
MiscAlwaysShowTabs=FALSE
MiscBell=FALSE
MiscBordersDefault=FALSE
MiscCursorBlinks=FALSE
MiscCursorShape=TERMINAL_CURSOR_SHAPE_BLOCK
MiscDefaultGeometry=80x24
MiscInheritGeometry=FALSE
MiscMenubarDefault=FALSE
MiscMouseAutohide=FALSE
MiscToolbarDefault=FALSE
MiscConfirmClose=TRUE
MiscCycleTabs=TRUE
MiscTabCloseButtons=TRUE
MiscTabCloseMiddleClick=TRUE
MiscTabPosition=GTK_POS_TOP
MiscHighlightUrls=TRUE
TitleInitial=infoterm-vis
ScrollingBar=TERMINAL_SCROLLBAR_NONE
FontName=Monospace 8
BackgroundMode=TERMINAL_BACKGROUND_TRANSPARENT
BackgroundDarkness=0.000000
ShortcutsNoMenukey=TRUE
ShortcutsNoMnemonics=TRUE
......@@ -8,7 +8,7 @@
<Name>Forschungszentrum Juelich</Name>
<Directory>fzj.directory</Directory>
<Include>
<Category>--- FZJ ---</Category>
<Category>FZ-Juelich</Category>
</Include>
<!-- Read in overrides and child menus from *-merged/ -->
......
......@@ -8,10 +8,10 @@
<Name>Forschungszentrum Juelich</Name>
<Menu>
<Name>Visualization</Name>
<Directory>vis.directory</Directory>
<Name>FZJ Utilities</Name>
<Directory>fzj-utils.directory</Directory>
<Include>
<Category>Visualization</Category>
<Category>FZJ-Utilities</Category>
</Include>
</Menu>
......
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu>
<Name>Xfce</Name>
<Menu>
<Name>Forschungszentrum Juelich</Name>
<Menu>
<Name>FZJ Visualization</Name>
<Directory>fzj-vis.directory</Directory>
<Include>
<Category>FZJ-Visualization</Category>
</Include>
</Menu>
</Menu>
</Menu>
......@@ -2,21 +2,29 @@
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu>
<Name>Xfce</Name>
<Name>FZJ</Name>
<DefaultAppDirs/>
<DefaultDirectoryDirs/>
<DefaultMergeDirs/>
<!-- get all menu entries from /usr/share/applications/ which have category X-Xfce-Toplevel -->
<!--
<Include>
<Category>X-Xfce-Toplevel</Category>
</Include>
-->
<Include>
<Category>FZJ-Toplevel</Category>
</Include>
<!-- define menu layout -->
<Layout>
<Filename>xfce4-run.desktop</Filename>
<Separator/>
<Filename>exo-terminal-emulator.desktop</Filename>
<Filename>exo-file-manager.desktop</Filename>
<Filename>default-Terminal.desktop</Filename>
<Filename>default-FileManager.desktop</Filename>
<Separator/>
<Menuname>Forschungszentrum Juelich</Menuname>
<Separator/>
......@@ -25,9 +33,10 @@
<Separator/>
<Merge type="all"/>
<Separator/>
<Filename>xfce4-session-logout.desktop</Filename>
<Filename>default-SessionLogout.desktop</Filename>
</Layout>
<!-- get submenues from /usr/share/desktop-directories/ -->
<Menu>
<Name>Preferences</Name>
<Directory>xfce-settings.directory</Directory>
......@@ -135,6 +144,7 @@
</Include>
</Menu>