diff options
| author | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-27 20:22:49 +0100 | 
|---|---|---|
| committer | Přemysl Janouch <p.janouch@gmail.com> | 2016-01-27 20:22:49 +0100 | 
| commit | 2825c899617cefc872198296f83572ec3504db93 (patch) | |
| tree | cea42879f0cb488950576827ea87088bac4ab213 | |
| parent | 99081814671c28f30540e81af7ae73096ba4b9e0 (diff) | |
| download | desktop-tools-2825c899617cefc872198296f83572ec3504db93.tar.gz desktop-tools-2825c899617cefc872198296f83572ec3504db93.tar.xz desktop-tools-2825c899617cefc872198296f83572ec3504db93.zip | |
Add gdm-switch-user, run by dwmstatus
| -rw-r--r-- | CMakeLists.txt | 13 | ||||
| -rw-r--r-- | README.adoc | 2 | ||||
| -rw-r--r-- | dwmstatus.c | 15 | ||||
| -rw-r--r-- | gdm-switch-user.c | 17 | 
4 files changed, 47 insertions, 0 deletions
| diff --git a/CMakeLists.txt b/CMakeLists.txt index e37b106..b5e03bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,9 @@ include (AddThreads)  find_package (PkgConfig REQUIRED)  pkg_check_modules (dependencies REQUIRED libpulse x11) +pkg_check_modules (gdm gdm glib-2.0 gio-2.0) + +option (WITH_GDM "Compile with GDM support" ${gdm_FOUND})  set (project_libraries ${dependencies_LIBRARIES})  include_directories (${dependencies_INCLUDE_DIRS}) @@ -44,6 +47,12 @@ target_link_libraries (brightness ${project_libraries})  add_executable (fancontrol-ng fancontrol-ng.c)  target_link_libraries (fancontrol-ng ${project_libraries}) +if (WITH_GDM) +	include_directories (${gdm_INCLUDE_DIRS}) +	add_executable (gdm-switch-user gdm-switch-user.c) +	target_link_libraries (gdm-switch-user ${gdm_LIBRARIES}) +endif (WITH_GDM) +  # The files to be installed  include (GNUInstallDirs) @@ -54,6 +63,10 @@ install (FILES ${PROJECT_BINARY_DIR}/fancontrol-ng.service  install (FILES fancontrol-ng.conf.example  	DESTINATION ${CMAKE_INSTALL_DATADIR}/fancontrol-ng) +if (WITH_GDM) +	install (TARGETS gdm-switch-user DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif (WITH_GDM) +  install (TARGETS dwmstatus brightness fancontrol-ng  	DESTINATION ${CMAKE_INSTALL_BINDIR})  install (PROGRAMS shellify DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/README.adoc b/README.adoc index 10c28a5..acf7593 100644 --- a/README.adoc +++ b/README.adoc @@ -14,6 +14,8 @@ to other people as well.     in general it doesn't handle everything the original does   - 'shellify' is a simple script that sets up a shell for commands like vgdb     and nmcli that are painfully lacking it + - 'gdm-switch-user' tells the running GDM daemon, if any, to show the switch +   user screen  Don't expect them to work under any OS that isn't Linux. diff --git a/dwmstatus.c b/dwmstatus.c index 11c78ef..241c435 100644 --- a/dwmstatus.c +++ b/dwmstatus.c @@ -2638,6 +2638,18 @@ on_volume_set (struct app_context *ctx, int arg)  }  static void +on_lock (struct app_context *ctx, int arg) +{ +	(void) arg; + +	// One of these will work +	char *argv_gdm[] = { "gdm-switch-user", NULL }; +	spawn (ctx, argv_gdm); +	char *argv_ldm[] = { "dm-tool", "lock", NULL }; +	spawn (ctx, argv_ldm); +} + +static void  on_brightness (struct app_context *ctx, int arg)  {  	char *value = xstrdup_printf ("%d", arg); @@ -2655,6 +2667,9 @@ struct  }  g_keys[] =  { +	// This key should be labeled L on normal Qwert[yz] layouts +	{ Mod4Mask,            XK_n,         on_lock,          0 }, +  	// MPD  	{ Mod4Mask,            XK_Up,        on_mpd_play,      0 },  	{ Mod4Mask,            XK_Down,      on_mpd_stop,      0 }, diff --git a/gdm-switch-user.c b/gdm-switch-user.c new file mode 100644 index 0000000..5718c31 --- /dev/null +++ b/gdm-switch-user.c @@ -0,0 +1,17 @@ +// Public domain +#include <gdm-user-switching.h> + +int +main (int argc, char *argv[]) +{ +	(void) argc; +	(void) argv; + +	GError *e = NULL; +	if (!gdm_goto_login_session_sync (g_cancellable_new (), &e)) +	{ +		g_printerr ("%s\n", e->message); +		return 1; +	} +	return 0; +} | 
