Use notify-send from nix within scripts

Also adjust dmenu selection to follow my naming conventions.
Ensure other dependencies are provided via nix.
This commit is contained in:
Daniel Siepmann 2022-10-11 19:11:34 +02:00
parent 6af935b3e4
commit 60410692dc
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
6 changed files with 19 additions and 24 deletions

View file

@ -5,8 +5,6 @@ with lib;
let
cfg = config.programs.khal;
# TODO: Make more compatible, e.g. provide notify from outside and add checks whether to use or not.
# Maybe create small php script instead which parses the khal output and checks for beginning
notificationScript = pkgs.writeShellApplication {
name = "khal-notification";
text = ''
@ -16,7 +14,7 @@ let
exit 0;
fi
notify-send \
${pkgs.libnotify}/bin/notify-send \
--urgency=critical \
--expire-time=90000 \
--icon="${config.gtk.iconTheme.package}/share/icons/${config.gtk.iconTheme.name}/32/apps/office-calendar.svg" \

View file

@ -2,20 +2,15 @@
writeShellApplication,
dmenu,
dunst,
libnotify,
bc,
firefox,
i3
i3,
xdg-utils
}:
let
# Still has many references to Ubuntu system tools.
# Will migrate step by step and update references.
# For now it is cool to have a first custom package which can be installed.
# It already uses nix dunst and dmenu.
# Also things like version switch should not be necessary once I managed nix shells.
# Things like version switch should not be necessary once I managed nix shells.
dmenu-custom-scripts-calc = writeShellApplication {
name = "dmenu-custom-scripts-calc";
@ -73,12 +68,12 @@ let
runtimeInputs = [
dmenu
firefox
xdg-utils
];
text = ''
file=$(find ~/Projects/docs/php/ -maxdepth 1 -name '*.html' -printf "%f\n" | dmenu -i -l 20 -p "Search Term")
firefox --new-tab "http://php.docs.localhost/$file"
xdg-open "http://php.docs.localhost/$file"
'';
};
@ -87,6 +82,7 @@ let
runtimeInputs = [
dmenu
libnotify
];
text = ''
@ -102,6 +98,7 @@ let
runtimeInputs = [
dmenu
libnotify
];
text = builtins.readFile ./xdebug.sh;
@ -109,7 +106,7 @@ let
in
writeShellApplication {
name = "dmenu_selection";
name = "custom-dmenu-selection";
# TODO: Find way to remove the nix prefixes from "files"
text = ''

View file

@ -22,7 +22,7 @@ case "$chosen" in
"logout")
i3-msg exit
;;
# Not supported, seems to complicated and not recommended with ssh
# Not supported, seems to complicated and not recommended with
# "hibernate")
# pkill -u "$USER" -USR1 dunst
# i3lock -c '#2E3436'

View file

@ -1,4 +1,4 @@
{ config }:
{ config, pkgs }:
let
modifier = config.xsession.windowManager.i3.config.modifier;
@ -216,7 +216,7 @@ in {
# For docs, see: https://developer.gnome.org/integration-guide/stable/desktop-files.html.en
"${modifier}+a" = "exec --no-startup-id i3-dmenu-desktop";
"${modifier}+space" = "exec --no-startup-id dmenu_selection";
"${modifier}+space" = "exec --no-startup-id custom-dmenu-selection";
# change focus
"${modifier}+h" = "focus left";
@ -317,10 +317,10 @@ in {
# ~ > pacmd move-sink-input 3 8
# Function Key Bindings (💡)
"XF86MonBrightnessUp" = "exec xbacklight -inc 10 && notify-send \"Changed Display Brightness\" \"Now: $(xbacklight)\"";
"XF86MonBrightnessDown" = "exec xbacklight -dec 10 && notify-send \"Changed Display Brightness\" \"Now: $(xbacklight)\"";
"Shift+XF86MonBrightnessUp" = "exec xbacklight -inc 1 && notify-send \"Changed Display Brightness\" \"Now: $(xbacklight)\"";
"Shift+XF86MonBrightnessDown" = "exec xbacklight -dec 1 && notify-send \"Changed Display Brightness\" \"Now: $(xbacklight)\"";
"XF86MonBrightnessUp" = "exec xbacklight -inc 10 && ${pkgs.libnotify}/bin/notify-send \"Changed Display Brightness\" \"Now: $(xbacklight)\"";
"XF86MonBrightnessDown" = "exec xbacklight -dec 10 && ${pkgs.libnotify}/bin/notify-send \"Changed Display Brightness\" \"Now: $(xbacklight)\"";
"Shift+XF86MonBrightnessUp" = "exec xbacklight -inc 1 && ${pkgs.libnotify}/bin/notify-send \"Changed Display Brightness\" \"Now: $(xbacklight)\"";
"Shift+XF86MonBrightnessDown" = "exec xbacklight -dec 1 && ${pkgs.libnotify}/bin/notify-send \"Changed Display Brightness\" \"Now: $(xbacklight)\"";
# Dunst Key Bindings
# See: man dunstctl.1

View file

@ -29,6 +29,6 @@
'';
windowManager.i3 = import ./windowManager/i3.nix {
inherit config;
inherit config pkgs;
};
}

View file

@ -16,7 +16,7 @@ let
name = "project-frontend-compile";
text = ''
yarn run build
notify-send "done compiling frontend"
${pkgs.libnotify}/bin/notify-send "done compiling frontend"
'';
};