sisyphus
Mikhail Novosyolov 2 years ago
parent d824fe84f3
commit b564a0b89f
  1. 28
      kometa-xdg.spec
  2. 0
      plasma5/XDG_CONFIG_DIRS/dolphinrc
  3. 0
      plasma5/XDG_CONFIG_DIRS/kcminputrc
  4. 0
      plasma5/XDG_CONFIG_DIRS/kdeglobals
  5. 0
      plasma5/XDG_CONFIG_DIRS/kxkbrc
  6. 203
      plasma5/XDG_DATA_DIRS/kxmlgui5/dolphin/dolphinui.rc
  7. 50
      scripts/kometa-xdg-env
  8. 20
      scripts/test.sh

@ -3,7 +3,7 @@ Summary: XDG desktop settings for Kometa distros
Summary(ru): Настройки рабочего окружения дистрибутивов Комета
License: GPL-3.0
Group: Graphical desktop/Other
Version: 1.3
Version: 1.4
Release: alt1
Source0: kometa-xdg-%version.tar
Source1: COPYING
@ -18,19 +18,26 @@ XDG desktop settings for Kometa distros
#--------------------------------------------------------------
%package core
Summary: DE-agnostic desktop settings for Kometa distros
Summary(ru): DE-независимые настройки рабочих окружений дистрибутивов Комета
Summary: Engine to set distribution-specific desktop settings
Summary(ru): Движок установки дистрибутиво-специфичных настроек рабочего стола
Group: Graphical desktop/Other
Requires: sed
%description core
DE-agnostic desktop settings for Kometa distros
Engine to set distribution-specific desktop settings.
Sets environmental variables $XDG_CONFIG_DIRS and $XDG_DATA_DIRS,
adding /etc/xdg/kometa and /usr/share/kometa into them.
Can be used separately from Kometa.
%description -l ru_RU.UTF-8 core
DE-независимые настройки рабочих окружений дистрибутивов Комета
Движок установки дистрибутиво-специфичных настроек рабочего стола.
Устонавливает переменные окружения $XDG_CONFIG_DIRS и $XDG_DATA_DIRS,
добавляя в них /etc/xdg/kometa и /usr/share/kometa.
Может быть использован вне кометы.
%files core
%doc COPYING
%dir /etc/xdg/kometa
%dir /usr/share/kometa
%_bindir/kometa-xdg-env
%_user_env_gen_dir/10-kometa-xdg.sh
/etc/profile.d/10-kometa-xdg.sh
@ -57,6 +64,9 @@ KDE 5 desktop settings for classic variant of Kometa
/etc/xdg/kometa/kcminputrc
/etc/xdg/kometa/kdeglobals
/etc/xdg/kometa/kxkbrc
%dir /usr/share/kometa/kxmlgui5
%dir /usr/share/kometa/kxmlgui5/dolphin
/usr/share/kometa/kxmlgui5/dolphin/dolphinui.rc
#--------------------------------------------------------------
@ -152,7 +162,9 @@ install -m0755 scripts/profile.sh %buildroot/etc/profile.d/10-kometa-xdg.sh
install -m0755 scripts/systemd.sh %buildroot%_user_env_gen_dir/10-kometa-xdg.sh
mkdir -p %buildroot/etc/xdg/kometa
install -m0644 plasma5/* %buildroot/etc/xdg/kometa
cp -rv plasma5/XDG_CONFIG_DIRS/* %buildroot/etc/xdg/kometa
mkdir -p %buildroot/usr/share/kometa
cp -rv plasma5/XDG_DATA_DIRS/* %buildroot/usr/share/kometa
mkdir -p %buildroot%_datadir
echo QT_QPA_PLATFORMTHEME=gtk3 > %buildroot/%_datadir/kometa-pam-env
@ -162,6 +174,10 @@ cd scripts
./test.sh
%changelog
* Fri Dec 24 2021 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.4-alt1
- Add setting $XDG_DATA_DIRS, enable "Show Previews" button in Dolphin
- Tune description: note that kometa-xdg-core can be used just to set env outside of Kometa
* Thu Dec 16 2021 Mikhail Novosyolov <mikhailnov@altlinux.org> 1.3-alt1
- Turn off NumLock by default in KDE 5

@ -0,0 +1,203 @@
<!DOCTYPE gui>
<gui name="dolphin" version="35" translationDomain="kxmlgui5">
<MenuBar>
<Menu name="file" noMerge="1">
<text translationDomain="kxmlgui5">&amp;File</text>
<Action name="file_new"/>
<Separator weakSeparator="1"/>
<Action name="new_menu"/>
<Action name="file_new"/>
<Action name="new_tab"/>
<Action name="file_close"/>
<Action name="undo_close_tab"/>
<Separator/>
<Action name="add_to_places"/>
<Separator/>
<Action name="renamefile"/>
<Action name="duplicate"/>
<Action name="movetotrash"/>
<Action name="deletefile"/>
<Separator/>
<Action name="show_target"/>
<Separator/>
<Action name="properties"/>
<Separator weakSeparator="1"/>
<Action name="file_close"/>
<Separator weakSeparator="1"/>
<Action name="file_quit"/>
</Menu>
<Menu name="edit" noMerge="1">
<text translationDomain="kxmlgui5">&amp;Edit</text>
<Action name="edit_undo"/>
<Separator weakSeparator="1"/>
<Action name="edit_cut"/>
<Action name="edit_copy"/>
<Action name="edit_paste"/>
<Separator weakSeparator="1"/>
<Action name="edit_select_all"/>
<Separator weakSeparator="1"/>
<Action name="edit_find"/>
<Separator weakSeparator="1"/>
<Action name="edit_undo"/>
<Separator/>
<Action name="edit_cut"/>
<Action name="edit_copy"/>
<Action name="copy_location"/>
<Action name="edit_paste"/>
<Separator/>
<Action name="show_filter_bar"/>
<Action name="edit_find"/>
<Separator/>
<Action name="copy_to_inactive_split_view"/>
<Action name="move_to_inactive_split_view"/>
<Action name="edit_select_all"/>
<Action name="invert_selection"/>
</Menu>
<Menu name="view" noMerge="1">
<text translationDomain="kxmlgui5">&amp;View</text>
<Action name="view_zoom_in"/>
<Action name="view_zoom_out"/>
<Separator weakSeparator="1"/>
<Action name="view_redisplay"/>
<Separator weakSeparator="1"/>
<Action name="view_zoom_in"/>
<Action name="view_zoom_reset"/>
<Action name="view_zoom_out"/>
<Separator/>
<Action name="sort"/>
<Action name="view_mode"/>
<Action name="additional_info"/>
<Action name="show_preview"/>
<Action name="show_in_groups"/>
<Action name="show_hidden_files"/>
<Separator/>
<Action name="split_view"/>
<Action name="split_stash"/>
<Action name="redisplay"/>
<Action name="stop"/>
<Separator/>
<Action name="panels"/>
<Menu name="location_bar" noMerge="1" icon="edit-select-text">
<text translationDomain="dolphin" context="@title:menu">Location Bar</text>
<Action name="editable_location"/>
<Action name="replace_location"/>
</Menu>
<Separator/>
<Action name="view_properties"/>
</Menu>
<Menu name="go" noMerge="1">
<text translationDomain="kxmlgui5">&amp;Go</text>
<Action name="go_up"/>
<Action name="go_back"/>
<Action name="go_forward"/>
<Action name="go_home"/>
<Separator weakSeparator="1"/>
<Action name="bookmarks"/>
<Action name="closed_tabs"/>
</Menu>
<Menu name="tools" noMerge="1">
<text translationDomain="kxmlgui5">&amp;Tools</text>
<Action name="open_preferred_search_tool"/>
<Action name="open_terminal"/>
<Action name="focus_terminal_panel"/>
<Action name="compare_files"/>
<Action name="change_remote_encoding"/>
</Menu>
<Menu name="settings" noMerge="1">
<text translationDomain="kxmlgui5">&amp;Settings</text>
<Action name="options_show_menubar"/>
<Merge name="StandardToolBarMenuHandler"/>
<Merge name="KMDIViewActions"/>
<Separator weakSeparator="1"/>
<Action name="switch_application_language"/>
<Action name="options_configure_keybinding"/>
<Action name="options_configure_toolbars"/>
<Action name="options_configure"/>
</Menu>
<Separator weakSeparator="1"/>
<Menu name="help" noMerge="1">
<text translationDomain="kxmlgui5">&amp;Help</text>
<Action name="help_contents"/>
<Action name="help_whats_this"/>
<Separator weakSeparator="1"/>
<Action name="help_report_bug"/>
<Separator weakSeparator="1"/>
<Action name="help_donate"/>
<Separator weakSeparator="1"/>
<Action name="help_about_app"/>
<Action name="help_about_kde"/>
</Menu>
</MenuBar>
<ToolBar name="mainToolBar" noMerge="1">
<text translationDomain="dolphin" context="@title:menu">Main Toolbar</text>
<Action name="go_back"/>
<Action name="go_up"/>
<Action name="go_forward"/>
<Separator name="separator_0"/>
<Action name="icons"/>
<Action name="compact"/>
<Action name="details"/>
<Action name="url_navigators"/>
<Action name="show_preview"/>
<Action name="split_view"/>
<Action name="split_stash"/>
<Action name="toggle_search"/>
<Action name="hamburger_menu"/>
</ToolBar>
<State name="new_file">
<disable>
<Action name="edit_undo"/>
<Action name="edit_redo"/>
<Action name="edit_cut"/>
<Action name="edit_copy"/>
<Action name="renamefile"/>
<Action name="movetotrash"/>
<Action name="deletefile"/>
<Action name="invert_selection"/>
<Separator/>
<Action name="go_back"/>
<Action name="go_forward"/>
</disable>
</State>
<State name="has_selection">
<enable>
<Action name="edit_cut"/>
<Action name="edit_copy"/>
<Action name="renamefile"/>
<Action name="duplicate"/>
<Action name="movetotrash"/>
<Action name="deletefile"/>
<Action name="invert_selection"/>
</enable>
</State>
<State name="has_no_selection">
<disable>
<Action name="edit_cut"/>
<Action name="edit_copy"/>
<Action name="renamefile"/>
<Action name="duplicate"/>
<Action name="movetotrash"/>
<Action name="deletefile"/>
<Action name="delete_shortcut"/>
<Action name="invert_selection"/>
</disable>
</State>
<ActionProperties scheme="Default">
<Action name="go_back" priority="0"/>
<Action name="go_forward" priority="0"/>
<Action name="go_up" priority="0"/>
<Action name="go_home" priority="0"/>
<Action name="stop" priority="0"/>
<Action name="icons" priority="0"/>
<Action name="compact" priority="0"/>
<Action name="details" priority="0"/>
<Action name="view_zoom_in" priority="0"/>
<Action name="view_zoom_reset" priority="0"/>
<Action name="view_zoom_out" priority="0"/>
<Action name="edit_cut" priority="0"/>
<Action name="edit_copy" priority="0"/>
<Action name="edit_paste" priority="0"/>
<Action name="toggle_search" priority="0"/>
<Action name="toggle_filter" priority="0"/>
</ActionProperties>
</gui>

@ -1,7 +1,8 @@
#!/bin/sh
KOMETA_XDG_TESTING="${KOMETA_XDG_TESTING:-0}"
KOMETA_XDG_TYPE="${KOMETA_XDG_TYPE:-}"
KOMETA_XDG_DIR=/etc/xdg/kometa
KOMETA_XDG_CONFIG_DIR=/etc/xdg/kometa
KOMETA_XDG_DATA_DIR=/usr/share/kometa
XDG_CONFIG_DIRS="${XDG_CONFIG_DIRS:-}"
_check_runability(){
@ -26,44 +27,51 @@ _check_runability(){
# * is not a mess and is a valid value
# * does not have repeated directories (if it has, we will probably still be OK)
# $1: current value of $XDG_CONFIG_DIRS
_mk_xdg_config_dirs(){
_mk_xdg_dirs(){
local tmp
# current value
tmp="$1"
# /etc/xdg, /usr/share
root1="$2"
# /etc/kf5/xdg, /usr/share/kf5
root2="$3"
# /etc/xdg/kometa, /usr/share/kometa
add="$4"
case "$tmp" in
"" )
# https://bugzilla.altlinux.org/show_bug.cgi?id=41566
tmp=/etc/kf5/xdg:/etc/xdg
tmp="$root2":"$root1"
;;
:/etc/xdg )
:"$root1" )
# not a valid value!
tmp=/etc/xdg
tmp="$root1"
;;
/etc/xdg )
"$root1" )
:
;;
*/etc/xdg )
*"$root1" )
:
;;
* )
# not a valid values - does not end with /etc/xdg
tmp="$tmp:/etc/xdg"
# not a valid values - does not end with /etc/xdg or /usr/share
tmp="$tmp":"$root1"
;;
esac
case "$tmp" in
*:/etc/xdg/kometa:* | /etc/xdg/kometa:* )
*:"$root1"/kometa:* | "$root1"/kometa:* )
:
;;
*:/etc/kf5/xdg:* )
tmp="$(echo "$tmp" | sed -e "s,:/etc/kf5/xdg:,:$KOMETA_XDG_DIR:/etc/kf5/xdg:,")"
*:"$root2":* )
tmp="$(echo "$tmp" | sed -e "s,:${root2}:,:${add}:${root2}:,")"
;;
/etc/kf5/xdg:* )
tmp="$(echo "$tmp" | sed -e "s,^/etc/kf5/xdg:,$KOMETA_XDG_DIR:/etc/kf5/xdg:,")"
"$root2":* )
tmp="$(echo "$tmp" | sed -e "s,^${root2}:,${add}:${root2}:,")"
;;
*:/etc/xdg )
tmp="$(echo "$tmp" | sed -e "s,:/etc/xdg,:$KOMETA_XDG_DIR:/etc/xdg,")"
*:"$root1" )
tmp="$(echo "$tmp" | sed -e "s,:${root1},:${add}:${root1},")"
;;
/etc/xdg )
tmp="$(echo "$tmp" | sed -e "s,^/etc/xdg,$KOMETA_XDG_DIR:/etc/xdg,")"
"$root1" )
tmp="$(echo "$tmp" | sed -e "s,^${root1},${add}:${root1},")"
;;
esac
echo "$tmp"
@ -73,13 +81,17 @@ _main(){
_check_runability "$1"
# $XDG_DATA_DIRS may be added
local result_xdg_config_dirs
result_xdg_config_dirs="$(_mk_xdg_config_dirs "$XDG_CONFIG_DIRS")"
result_xdg_config_dirs="$(_mk_xdg_dirs "$XDG_CONFIG_DIRS" /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")"
local result_xdg_data_dirs
result_xdg_data_dirs="$(_mk_xdg_dirs "$XDG_DATA_DIRS" /usr/share /usr/share/kf5 "$KOMETA_XDG_DATA_DIR")"
case "$1" in
systemd )
echo XDG_CONFIG_DIRS="$result_xdg_config_dirs"
echo XDG_DATA_DIRS="$result_xdg_data_dirs"
;;
profile )
export XDG_CONFIG_DIRS="$result_xdg_config_dirs"
export XDG_DATA_DIRS="$result_xdg_data_dirs"
;;
esac
}

@ -3,13 +3,19 @@ set -x
set -e
trap 'if [ $? != 0 ]; then echo "ERROR!!!"; fi' EXIT
KOMETA_XDG_TESTING=1
KOMETA_XDG_DIR=/etc/xdg/kometa
KOMETA_XDG_CONFIG_DIR=/etc/xdg/kometa
KOMETA_XDG_DATA_DIR=/usr/share/kometa
export PATH="$PWD:$PATH"
. ./kometa-xdg-env
[ "$(_mk_xdg_config_dirs /etc/xdg)" = $KOMETA_XDG_DIR:/etc/xdg ]
[ "$(_mk_xdg_config_dirs /etc/foo)" = /etc/foo:$KOMETA_XDG_DIR:/etc/xdg ]
[ "$(_mk_xdg_config_dirs /etc/foo:/etc/xdg)" = /etc/foo:$KOMETA_XDG_DIR:/etc/xdg ]
[ "$(_mk_xdg_config_dirs /etc/foo:$KOMETA_XDG_DIR:/etc/kf5/xdg:/etc/xdg)" = /etc/foo:$KOMETA_XDG_DIR:/etc/kf5/xdg:/etc/xdg ]
[ "$(_mk_xdg_config_dirs /home/user/.config/kdedefaults:/etc/kf5/xdg:/etc/xdg)" = /home/user/.config/kdedefaults:$KOMETA_XDG_DIR:/etc/kf5/xdg:/etc/xdg ]
# $XDG_CONFIG_DIRS
[ "$(_mk_xdg_dirs /etc/xdg /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")" = $KOMETA_XDG_CONFIG_DIR:/etc/xdg ]
[ "$(_mk_xdg_dirs /etc/foo /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")" = /etc/foo:$KOMETA_XDG_CONFIG_DIR:/etc/xdg ]
[ "$(_mk_xdg_dirs /etc/foo:/etc/xdg /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")" = /etc/foo:$KOMETA_XDG_CONFIG_DIR:/etc/xdg ]
[ "$(_mk_xdg_dirs /etc/foo:$KOMETA_XDG_CONFIG_DIR:/etc/kf5/xdg:/etc/xdg /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")" = /etc/foo:$KOMETA_XDG_CONFIG_DIR:/etc/kf5/xdg:/etc/xdg ]
[ "$(_mk_xdg_dirs /home/user/.config/kdedefaults:/etc/kf5/xdg:/etc/xdg /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")" = /home/user/.config/kdedefaults:$KOMETA_XDG_CONFIG_DIR:/etc/kf5/xdg:/etc/xdg ]
# https://bugzilla.altlinux.org/show_bug.cgi?id=41566
[ "$(_mk_xdg_config_dirs "")" = $KOMETA_XDG_DIR:/etc/kf5/xdg:/etc/xdg ]
[ "$(_mk_xdg_dirs "" /etc/xdg /etc/kf5/xdg "$KOMETA_XDG_CONFIG_DIR")" = $KOMETA_XDG_CONFIG_DIR:/etc/kf5/xdg:/etc/xdg ]
# $XDG_DATA_DIRS
[ "$(_mk_xdg_dirs /usr/share /usr/share /usr/share/kf5 "$KOMETA_XDG_DATA_DIR")" = $KOMETA_XDG_DATA_DIR:/usr/share ]

Loading…
Cancel
Save