#include "alloc-util.h"
#include "bus-error.h"
-#include "bus-unit-util.h"
+#include "bus-unit-procs.h"
#include "bus-util.h"
#include "cgroup-show.h"
#include "cgroup-util.h"
assert(table);
assert(word);
- if (table_get_rows(table) > 1) {
+ if (table_get_rows(table) > 1 || OUTPUT_MODE_IS_JSON(arg_output)) {
r = table_set_sort(table, (size_t) 0, (size_t) -1);
if (r < 0)
return log_error_errno(r, "Failed to sort table: %m");
(void) pager_open(arg_pager_flags);
if (argc <= 1) {
- const char *session, *p = "/org/freedesktop/login1/session/self";
-
+ /* If no argument is specified inspect the manager itself */
if (properties)
- /* If no argument is specified inspect the manager itself */
return show_properties(bus, "/org/freedesktop/login1", &new_line);
- /* And in the pretty case, show data of the calling session */
- session = getenv("XDG_SESSION_ID");
- if (session) {
- r = get_session_path(bus, session, &error, &path);
- if (r < 0)
- return log_error_errno(r, "Failed to get session path: %s", bus_error_message(&error, r));
-
- p = path;
- }
-
- return print_session_status_info(bus, p, &new_line);
+ return print_session_status_info(bus, "/org/freedesktop/login1/session/auto", &new_line);
}
for (i = 1; i < argc; i++) {
(void) pager_open(arg_pager_flags);
if (argc <= 1) {
- /* If not argument is specified inspect the manager
- * itself */
+ /* If no argument is specified inspect the manager itself */
if (properties)
return show_properties(bus, "/org/freedesktop/login1", &new_line);
(void) pager_open(arg_pager_flags);
if (argc <= 1) {
- /* If not argument is specified inspect the manager
- * itself */
+ /* If no argument is specified inspect the manager itself */
if (properties)
return show_properties(bus, "/org/freedesktop/login1", &new_line);
- return print_seat_status_info(bus, "/org/freedesktop/login1/seat/self", &new_line);
+ return print_seat_status_info(bus, "/org/freedesktop/login1/seat/auto", &new_line);
}
for (i = 1; i < argc; i++) {
polkit_agent_open_if_enabled(arg_transport, arg_ask_password);
if (argc < 2) {
- /* No argument? Let's either use $XDG_SESSION_ID (if specified), or an empty
- * session name, in which case logind will try to guess our session. */
-
short_argv[0] = argv[0];
- short_argv[1] = getenv("XDG_SESSION_ID") ?: (char*) "";
+ short_argv[1] = (char*) "";
short_argv[2] = NULL;
argv = short_argv;
&error, NULL,
"s", argv[i]);
if (r < 0)
- return log_error_errno(r, "Failed to issue method call: %s", bus_error_message(&error, -r));
+ return log_error_errno(r, "Failed to issue method call: %s", bus_error_message(&error, r));
}
return 0;
int r;
setlocale(LC_ALL, "");
+ log_show_color(true);
log_parse_environment();
log_open();