Skip to content

Commit

Permalink
Create a nested 'kgames' menu for the desktop
Browse files Browse the repository at this point in the history
This places all of the kgames applications inside a 'KGames' menu
which lives in the main Games menu.

This adds a configuration option as to whether to install the .menu
file in the current user's home directory -- there isn't a location in
/usr/local which is defined for this file, only /etc or $HOME. This is
enabled by default so that a 'ninja install' works and doesn't require
admin privs. Switch back to the /etc location by doing

	$ meson -Duser-menu=false

Signed-off-by: Keith Packard <[email protected]>
  • Loading branch information
keith-packard committed Jan 10, 2022
1 parent 255d210 commit 7f000b8
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 14 deletions.
2 changes: 1 addition & 1 deletion kaces/kaces.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/kgames.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;CardGame
Categories=Game;CardGame;Kgames
2 changes: 1 addition & 1 deletion kcanfield/kcanfield.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/kgames.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;CardGame
Categories=Game;CardGame;Kgames
2 changes: 1 addition & 1 deletion kcribbage/kcribbage.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/kgames.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;CardGame
Categories=Game;CardGame;Kgames
2 changes: 1 addition & 1 deletion kdominos/kdominos.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/kdominos.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;CardGame
Categories=Game;CardGame;Kgames
6 changes: 6 additions & 0 deletions kgames.directory.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Desktop Entry]
Encoding=UTF-8

Icon=@ICONDIR@/kgames.svg

Name=Kgames
18 changes: 18 additions & 0 deletions kgames.menu.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/menu-1.1.dtd">
<Menu>
<Name>Applications</Name>
<Menu>
<Name>Games</Name>
<Exclude>
<Category>Kgames</Category>
</Exclude>
<Menu>
<Name>KGames</Name>
<Directory>kgames.directory</Directory>
<Include>
<Category>Kgames</Category>
</Include>
</Menu>
</Menu>
</Menu>
2 changes: 1 addition & 1 deletion kklondike/kklondike.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/kgames.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;CardGame
Categories=Game;CardGame;Kgames
2 changes: 1 addition & 1 deletion kmcarlo/kmcarlo.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/kgames.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;CardGame
Categories=Game;CardGame;Kgames
2 changes: 1 addition & 1 deletion kmontana/kmontana.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/kgames.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;CardGame
Categories=Game;CardGame;Kgames
2 changes: 1 addition & 1 deletion kslyfox/kslyfox.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/kgames.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;CardGame
Categories=Game;CardGame;Kgames
2 changes: 1 addition & 1 deletion kspider/kspider.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/kgames.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;CardGame
Categories=Game;CardGame;Kgames
2 changes: 1 addition & 1 deletion ktabby/ktabby.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/kgames.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;CardGame
Categories=Game;CardGame;Kgames
2 changes: 1 addition & 1 deletion kthieves/kthieves.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/kgames.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;CardGame
Categories=Game;CardGame;Kgames
2 changes: 1 addition & 1 deletion ktowers/ktowers.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/kgames.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;CardGame
Categories=Game;CardGame;Kgames
27 changes: 27 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ svg_icon_dir = datadir / 'icons/hicolor/scalable/apps'

desktop_dir = datadir / 'applications'

menudir = get_option('menudir')
if menudir == ''
if get_option('user-menu')
fs = import('fs')
xdg_config_dir = fs.expanduser('~/.config')
message('user-menu config_dir is ' + xdg_config_dir)
else
xdg_config_dir= sysconfdir / 'xdg'
endif
menudir = xdg_config_dir / 'menus/applications-merged'
endif

message('menudir is ' + menudir)

conf_data = configuration_data()
conf_data.set('KGAMES_VERSION', meson.project_version(),
description: 'KGames version in unquoted string form.')
Expand All @@ -60,6 +74,7 @@ conf_data.set('KGAMES_VERSION_STRING',
description: 'KGames version in quoted string form.')
conf_data.set('BINDIR', prefix / bindir)
conf_data.set('ICONDIR', prefix / svg_icon_dir)
conf_data.set('MENUDIR', menudir)

inc_dirs = ['.']

Expand All @@ -69,6 +84,18 @@ configure_file(output : 'kgames.h',
configuration: conf_data,
install: false)

configure_file(input: 'kgames.directory.in',
output: '@BASENAME@',
configuration: conf_data,
install_dir : datadir / 'desktop-directories'
)

configure_file(input: 'kgames.menu.in',
output: '@BASENAME@',
configuration: conf_data,
install_dir : menudir
)

subdir('Xkw')
subdir('kaces')
subdir('kcanfield')
Expand Down
4 changes: 4 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
option('user-menu', type: 'boolean', value: true,
description: 'Install menu file only for current user')
option('menudir', type: 'string',
description: 'Install directory for menu file')
2 changes: 1 addition & 1 deletion xmille/xmille.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/xmille.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;CardGame
Categories=Game;CardGame;Kgames
2 changes: 1 addition & 1 deletion xreversi/xreversi.desktop.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Icon=@ICONDIR@/xreversi.svg
StartupNotify=false
Terminal=false
Type=Application
Categories=Game;BoardGame
Categories=Game;BoardGame;Kgames

0 comments on commit 7f000b8

Please sign in to comment.