Add xdg desktop entries and update scripts
- Add xdg desktop entries for Firefox, Zathura, Nsxiv-wrapper, Nvim-wrapper, and Mpv-wrapper - Update clipboard-recall and get-focused-monitor scripts to use xorg.xrandr and xdotool - Include restic-backup.nix and enable fuse.userAllowOther in citadel configuration.
This commit is contained in:
parent
a12c1d3469
commit
8f1e6bc630
|
@ -14,6 +14,7 @@
|
||||||
./common/optional/notes.nix
|
./common/optional/notes.nix
|
||||||
./common/optional/yazi.nix
|
./common/optional/yazi.nix
|
||||||
./common/optional/desktop/common/kodi.nix
|
./common/optional/desktop/common/kodi.nix
|
||||||
|
./common/optional/desktop/common/xdg
|
||||||
];
|
];
|
||||||
|
|
||||||
home.packages = [
|
home.packages = [
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
{pkgs, ...}:
|
||||||
|
{
|
||||||
|
imports = [./scripts.nix];
|
||||||
|
|
||||||
|
|
||||||
|
xdg.desktopEntries = {
|
||||||
|
firefox = {
|
||||||
|
name = "Firefox";
|
||||||
|
exec = "${pkgs.firefox}/bin/firefox";
|
||||||
|
};
|
||||||
|
zathura = {
|
||||||
|
name = "Zathura";
|
||||||
|
exec = "${pkgs.zathura}/bin/zathura";
|
||||||
|
terminal = false;
|
||||||
|
mimeType = ["application/pdf"];
|
||||||
|
};
|
||||||
|
nsxiv-wrapper = {
|
||||||
|
name = "Nsxiv-wrapper";
|
||||||
|
# exec = "nsxiv-wrapper %f";
|
||||||
|
exec = "st -c xdg-open-nsxiv -T st-float -g 150x50 -e nsxiv %F";
|
||||||
|
terminal = false;
|
||||||
|
mimeType = ["image/*"];
|
||||||
|
};
|
||||||
|
nvim-wrapper = {
|
||||||
|
name = "Nvim-wrapper";
|
||||||
|
exec = "st -c xdg-open-nvim -T st-float -g 150x50 -e nvim %F";
|
||||||
|
terminal = false;
|
||||||
|
mimeType = ["text/*"];
|
||||||
|
};
|
||||||
|
mpv-wrapper = {
|
||||||
|
name = "Mpv-wrapper";
|
||||||
|
exec = "st -c xdg-open-mpv -T st-float -g 150x50 -e mpv %F";
|
||||||
|
terminal = false;
|
||||||
|
mimeType = ["video/*"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
xdg.mimeApps = {
|
||||||
|
enable = true;
|
||||||
|
defaultApplications = {
|
||||||
|
"application/pdf" = "zathura.desktop";
|
||||||
|
|
||||||
|
# text
|
||||||
|
"text/html" = "firefox.desktop";
|
||||||
|
"text/plain" = "nvim-wrapper.desktop";
|
||||||
|
|
||||||
|
# images
|
||||||
|
"image/jpeg" = "nsxiv-wrapper.desktop";
|
||||||
|
"image/jpg" = "nsxiv-wrapper.desktop";
|
||||||
|
"image/png" = "nsxiv-wrapper.desktop";
|
||||||
|
"image/tiff" = "nsxiv-wrapper.desktop";
|
||||||
|
"image/gif" = "nsxiv-wrapper.desktop";
|
||||||
|
"image/heic" = "nsxiv-wrapper.desktop";
|
||||||
|
"image/bmp" = "nsxiv-wrapper.desktop";
|
||||||
|
"image/webp" = "nsxiv-wrapper.desktop";
|
||||||
|
|
||||||
|
# video
|
||||||
|
"video/mp4" = "mpv-wrapper.desktop";
|
||||||
|
"video/mpeg" = "mpv-wrapper.desktop";
|
||||||
|
|
||||||
|
"x-scheme-handler/http" = "firefox.desktop";
|
||||||
|
"x-scheme-handler/https" = "firefox.desktop";
|
||||||
|
"x-scheme-handler/about" = "firefox.desktop";
|
||||||
|
"x-scheme-handler/unknown" = "firefox.desktop";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
{pkgs, ...}: {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
(writeShellScriptBin "nsxiv-wrapper" ''
|
||||||
|
# Script to open image files with nsxiv
|
||||||
|
monitor_name=$(get-focused-monitor)
|
||||||
|
monitor_info=$(${xorg.xrandr}/bin/xrandr | grep "$monitor_name")
|
||||||
|
|
||||||
|
width=$(echo $monitor_info | grep -oP '\d+x\d+' | cut -dx -f1)
|
||||||
|
height=$(echo $monitor_info | grep -oP '\d+x\d+' | cut -dx -f2)
|
||||||
|
|
||||||
|
scale_width=$(( $width/4 + $width/2 ))
|
||||||
|
scale_height=$(( $height/4 + $height/2 ))
|
||||||
|
|
||||||
|
echo "$1" | ${nsxiv}/bin/nsxiv -ioq -g "$scale_width"x"$scale_height" -N float
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
}
|
|
@ -53,7 +53,7 @@
|
||||||
(writeShellScriptBin "clipboard-image-recall" ''
|
(writeShellScriptBin "clipboard-image-recall" ''
|
||||||
# Script to view and select and output images in image clipboard dir to clipboard.
|
# Script to view and select and output images in image clipboard dir to clipboard.
|
||||||
monitor_name=$(get-focused-monitor)
|
monitor_name=$(get-focused-monitor)
|
||||||
monitor_info=$(xrandr | grep "$monitor_name")
|
monitor_info=$(${xorg.xrandr}/bin/xrandr | grep "$monitor_name")
|
||||||
|
|
||||||
width=$(echo $monitor_info | grep -oP '\d+x\d+' | cut -dx -f1)
|
width=$(echo $monitor_info | grep -oP '\d+x\d+' | cut -dx -f1)
|
||||||
height=$(echo $monitor_info | grep -oP '\d+x\d+' | cut -dx -f2)
|
height=$(echo $monitor_info | grep -oP '\d+x\d+' | cut -dx -f2)
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
|
|
||||||
filesdir="$(find $1 -type f -printf '%T@ %p\n' | sort -rn | cut -d ' ' -f 2-)"
|
filesdir="$(find $1 -type f -printf '%T@ %p\n' | sort -rn | cut -d ' ' -f 2-)"
|
||||||
[ "$filesdir" == "" ] && notify-send -t 1000 "Clipboard Recall" "No images in directory" && exit 1
|
[ "$filesdir" == "" ] && notify-send -t 1000 "Clipboard Recall" "No images in directory" && exit 1
|
||||||
output="$(echo "$filesdir" | ${nsxiv}/bin/nsxiv -tioq -g "$scale_width"x"$scale_height" -N nsxiv-float )"
|
output="$(echo "$filesdir" | ${nsxiv}/bin/nsxiv -tioq -g "$scale_width"x"$scale_height" -N float )"
|
||||||
num_lines=$( echo "$output" | wc -l)
|
num_lines=$( echo "$output" | wc -l)
|
||||||
|
|
||||||
if [ "$num_lines" -gt 1 ]; then
|
if [ "$num_lines" -gt 1 ]; then
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
(writeShellScriptBin "get-focused-monitor" ''
|
(writeShellScriptBin "get-focused-monitor" ''
|
||||||
# get the current cursor location into X and Y variables
|
# get the current cursor location into X and Y variables
|
||||||
eval $(xdotool getmouselocation --shell)
|
eval $(${xdotool}/bin/xdotool getmouselocation --shell)
|
||||||
|
|
||||||
# compare mouse location to monitor coordinates
|
# compare mouse location to monitor coordinates
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
{outputs, ...}: {
|
{
|
||||||
|
outputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
home.username = "sam";
|
home.username = "sam";
|
||||||
home.homeDirectory = "/home/sam";
|
home.homeDirectory = "/home/sam";
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ in {
|
||||||
../common/optional/nix-ld.nix
|
../common/optional/nix-ld.nix
|
||||||
../common/optional/gaming.nix
|
../common/optional/gaming.nix
|
||||||
../common/optional/powersave.nix
|
../common/optional/powersave.nix
|
||||||
|
../common/optional/restic-backup.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
@ -180,6 +181,8 @@ in {
|
||||||
ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="on"
|
ACTION=="unbind", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", TEST=="power/control", ATTR{power/control}="on"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
programs.fuse.userAllowOther = true;
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "citadel";
|
hostName = "citadel";
|
||||||
networkmanager.enable = true;
|
networkmanager.enable = true;
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
# src = /home/sam/.local/share/src/dwm;
|
# src = /home/sam/.local/share/src/dwm;
|
||||||
src = pkgs.fetchgit {
|
src = pkgs.fetchgit {
|
||||||
url = "https://git.bitlab21.com/sam/dwm";
|
url = "https://git.bitlab21.com/sam/dwm";
|
||||||
rev = "3e0601b29d879e589703239e064f0baaabb3474b";
|
rev = "26c82bae50ed580f651fd8316d9b162620872035";
|
||||||
sha256 = "sha256-7Hq0vo6YnXKhEUdKjvaAeKodq2l8wwJRzCYJfdHDNMQ=";
|
sha256 = "sha256-Qx71t1d7RMVaWKIJ71SPIF49+jjhwN7xI2ZubAoHO8E=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue