diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index a624ad1947..e4ebde6dce 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -28,6 +28,6 @@ install(TARGETS kwin_update_default_rules DESTINATION ${LIB_INSTALL_DIR}/kconf_u install( FILES fsp_workarounds_1.kwinrules DESTINATION ${DATA_INSTALL_DIR}/kwin/default_rules ) install( FILES pop.wav DESTINATION ${SOUND_INSTALL_DIR} ) -install( FILES kwin.upd kwinsticky.upd kwiniconify.upd kwin3_plugin.upd kwin_focus1.upd kwinupdatewindowsettings.upd kwin_focus2.upd kwin_fsp_workarounds_1.upd kwin_on_off.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) -install( PROGRAMS pluginlibFix.pl kwin3_plugin.pl kwin_focus1.sh kwin_focus2.sh on-off_to_true-false.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) +install( FILES kwin.upd kwinsticky.upd kwiniconify.upd kwin3_plugin.upd kwin_focus1.upd kwinupdatewindowsettings.upd kwin_focus2.upd kwin_fsp_workarounds_1.upd kwin_on_off.upd kwin_window_shortcuts.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) +install( PROGRAMS pluginlibFix.pl kwin3_plugin.pl kwin_focus1.sh kwin_focus2.sh on-off_to_true-false.sh kwin_window_shortcuts.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) diff --git a/data/kwin_window_shortcuts.sh b/data/kwin_window_shortcuts.sh new file mode 100644 index 0000000000..11b7c8e7b3 --- /dev/null +++ b/data/kwin_window_shortcuts.sh @@ -0,0 +1,10 @@ +#! /bin/sh +# remove = lines for per-window shortcuts that are not supposed to be saved +while read line; do + if echo "$line" | grep '^[0-9]\+=' >/dev/null 2>/dev/null; then + key=`echo "$line" | sed 's/^\([0-9]\+\)=.*$/\1/'` + echo '# DELETE [kwin]'$key + else + echo "$line" + fi +done diff --git a/data/kwin_window_shortcuts.upd b/data/kwin_window_shortcuts.upd new file mode 100644 index 0000000000..0554cdbb18 --- /dev/null +++ b/data/kwin_window_shortcuts.upd @@ -0,0 +1,5 @@ +Id=kde414 +File=kglobalshortcutsrc +Group=kwin +Options=overwrite +Script=kwin_window_shortcuts.sh,sh diff --git a/useractions.cpp b/useractions.cpp index 579023566c..9fcd712554 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -410,7 +410,7 @@ void Workspace::setupWindowShortcutDone( bool ok ) void Workspace::clientShortcutUpdated( Client* c ) { - QString key = QString::number( c->window()); + QString key = QString( "_k_session:%1" ).arg(c->window()); QAction* action = client_keys->action( key.toLatin1().constData() ); if( !c->shortcut().isEmpty()) { @@ -426,9 +426,7 @@ void Workspace::clientShortcutUpdated( Client* c ) action->setEnabled( true ); } else - { delete action; - } } void Workspace::clientPopupActivated( QAction *action ) diff --git a/workspace.cpp b/workspace.cpp index 7948d5f646..b03e8d8b27 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -579,7 +579,10 @@ void Workspace::removeClient( Client* c, allowed_t ) if( client_keys_client == c ) setupWindowShortcutDone( false ); if( !c->shortcut().isEmpty()) + { c->setShortcut( QString() ); // remove from client_keys + clientShortcutUpdated( c ); // needed, since this is otherwise delayed by setShortcut() and wouldn't run + } if( c->isDialog()) Notify::raise( Notify::TransDelete );