From 72733dd1b9f2b706d8c9af09ccb28cd899237c83 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 26 Jun 2019 14:22:59 -0700 Subject: [PATCH] [NixOS] [XMonad] Use installed version of rofi-systemd --- dotfiles/config/xmonad/xmonad.hs | 4 +- dotfiles/lib/bin/rofi_systemd.sh | 113 ------------------------------- nixos/configuration.nix | 2 +- 3 files changed, 4 insertions(+), 115 deletions(-) delete mode 100755 dotfiles/lib/bin/rofi_systemd.sh diff --git a/dotfiles/config/xmonad/xmonad.hs b/dotfiles/config/xmonad/xmonad.hs index ce5672fc..9d0c1c81 100644 --- a/dotfiles/config/xmonad/xmonad.hs +++ b/dotfiles/config/xmonad/xmonad.hs @@ -1030,7 +1030,7 @@ addKeys conf@XConfig { modMask = modm } = , ((hyper, xK_k), spawn "rofi_kill_process.sh") , ((hyper .|. shiftMask, xK_k), spawn "rofi_kill_all.sh") - , ((hyper, xK_r), spawn "rofi_systemd.sh") + , ((hyper, xK_r), spawn "rofi-systemd") , ((hyper, xK_0), spawn "tvpower.js") , ((modalt, xK_z), spawn "split_chrome_tab_to_next_screen.sh") , ((hyper, xK_9), spawn "start_synergy.sh") @@ -1038,6 +1038,8 @@ addKeys conf@XConfig { modMask = modm } = , ((hyper, xK_space), spawn "skippy-xd") , ((hyper, xK_i), spawn "rofi_select_input.hs") , ((hyper, xK_o), spawn "rofi_paswitch.sh") + , ((modm, xK_apostrophe), spawn "load_default_map.sh") + , ((modalt, xK_apostrophe), spawn "load_xkb_map.sh") -- Media keys diff --git a/dotfiles/lib/bin/rofi_systemd.sh b/dotfiles/lib/bin/rofi_systemd.sh deleted file mode 100755 index e92ac8ee..00000000 --- a/dotfiles/lib/bin/rofi_systemd.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env sh - -export SYSTEMD_COLORS=0 -term=${ROFI_SYSTEMD_TERM-urxvt -e} -default_action=${ROFI_SYSTEMD_DEFAULT_ACTION-"list_actions"} - -function unit_files { - systemctl "$1" list-unit-files --no-legend -} - -# This is needed to list services started from template units -function running_units { - systemctl "$1" list-units --all --type=service --no-legend | - awk '{print $1 " " $3}' -} - - -function get_units { - { unit_files "--$1"; running_units "--$1"; } | sort -u -k1,1 | - awk -v unit_type="$1" '{print $0 " " unit_type}' -} - -enable="Alt+e" -disable="Alt+d" -stop="Alt+k" -restart="Alt+r" -tail="Alt+t" -list_actions="Alt+l" - -all_actions="enable -disable -stop -restart -tail -list_actions" - -function select_service_and_act { - result=$(rofi -dmenu -i -p "systemd unit: " \ - -kb-custom-1 "${enable}" \ - -kb-custom-2 "${disable}" \ - -kb-custom-3 "${stop}" \ - -kb-custom-4 "${restart}" \ - -kb-custom-5 "${tail}" \ - -kb-custom-6 "${list_actions}") - - rofi_exit="$?" - - case "$rofi_exit" in - 1) - action="exit" - exit 1 - ;; - 10) - action="enable" - ;; - 11) - action="disable" - ;; - 12) - action="stop" - ;; - 13) - action="restart" - ;; - 14) - action="tail" - ;; - 15) - action="list_actions" - ;; - *) - action="$default_action" - ;; - esac - - selection="$(echo $result | sed -n 's/ \+/ /gp')" - service_name=$(echo "$selection" | awk '{ print $1 }' | tr -d ' ') - is_user="$(echo $selection | awk '{ print $3 }' )" - - case "$is_user" in - user*) - user_arg="--user" - command="systemctl $user_arg" - ;; - system*) - user_arg="" - command="sudo systemctl" - ;; - *) - command="systemctl" - esac - - to_run="$(get_command_with_args)" - echo "Running $to_run" - eval "$term $to_run" -} - -function get_command_with_args { - case "$action" in - "tail") - echo "journalctl $user_arg -u '$service_name' -f" - ;; - "list_actions") - action=$(echo "$all_actions" | rofi -dmenu -i -p "Select action: ") - get_command_with_args - ;; - *) - echo "$command $action '$service_name'" - ;; - esac -} - -{ get_units user; get_units system; } | column -tc 1 | select_service_and_act diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 58de900a..06259b35 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -154,6 +154,7 @@ in pommed_light rofi rofi-pass + rofi-systemd skippy-xd synergy udiskie @@ -334,7 +335,6 @@ in systemctl --user import-environment GDK_PIXBUF_MODULE_FILE ''; }; - }; virtualisation.docker.enable = true;