aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2021-06-01 21:44:12 +0530
committerAkshay Nair <phenax5@gmail.com>2021-06-01 21:44:12 +0530
commitdae97302c821e709654ce25204fd0a7485ce05aa (patch)
tree5206e580e4c843f6b61080f8e8745a2897b302b9
parent8d29a49ec6afcff5802488ac062d54ba276bee0f (diff)
downloadnixos-config-dae97302c821e709654ce25204fd0a7485ce05aa.tar.gz
nixos-config-dae97302c821e709654ce25204fd0a7485ce05aa.zip
Adds sxiv config
Diffstat (limited to '')
-rwxr-xr-xconfig/sxiv/exec/image-info19
-rwxr-xr-xconfig/sxiv/exec/key-handler27
-rw-r--r--configuration.nix1
-rw-r--r--home.nix34
4 files changed, 64 insertions, 17 deletions
diff --git a/config/sxiv/exec/image-info b/config/sxiv/exec/image-info
new file mode 100755
index 0000000..155ca0e
--- /dev/null
+++ b/config/sxiv/exec/image-info
@@ -0,0 +1,19 @@
+#!/usr/bin/env sh
+
+# Example for $XDG_CONFIG_HOME/sxiv/exec/image-info
+# Called by sxiv(1) whenever an image gets loaded.
+# The output is displayed in sxiv's status bar.
+# Arguments:
+# $1: path to image file
+# $2: image width
+# $3: image height
+
+s=" " # field separator
+
+exec 2>/dev/null
+
+filename=$(basename -- "$1")
+filesize=$(du -Hh -- "$1" | cut -f 1)
+geometry="${2}x${3}"
+
+echo "${geometry}${s}${filesize}${s}${filename}"
diff --git a/config/sxiv/exec/key-handler b/config/sxiv/exec/key-handler
new file mode 100755
index 0000000..590af3c
--- /dev/null
+++ b/config/sxiv/exec/key-handler
@@ -0,0 +1,27 @@
+#!/usr/bin/env sh
+
+# Mod key = Ctrl + x
+
+rotate() {
+ degree="$1"
+ tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read file; do
+ case "$(file -b -i "$file")" in
+ image/jpeg*) jpegtran -rotate "$degree" -copy all -outfile "$file" "$file" ;;
+ *) mogrify -rotate "$degree" "$file" ;;
+ esac
+ done
+}
+
+# >, < Rotate
+# <Return> Thumbnail view
+# C-x w Set as wallpaper
+# C-x C-c Copy to clipboard
+
+case "$1" in
+# Copy image to clipboard
+"C-c") while read file; do xclip -selection clipboard -target image/png "$file"; done ;;
+
+# Set as wallpaper
+"w") while read file; do feh --bg-scale "$file"; done ;;
+esac
+
diff --git a/configuration.nix b/configuration.nix
index 5de33c1..b6c0c6e 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -99,7 +99,6 @@ in
# Enable sound.
sound.enable = true;
- # hardware.pulseaudio.enable = true;
nix.autoOptimiseStore = true;
nix.gc = {
diff --git a/home.nix b/home.nix
index d846360..6e8b066 100644
--- a/home.nix
+++ b/home.nix
@@ -1,7 +1,8 @@
{ config, pkgs, epkgs, ... }:
let
localPkgs = import ./packages/default.nix { pkgs = pkgs; };
-in {
+in
+{
imports = [
./overlays-home.nix
./modules/music.home.nix
@@ -46,7 +47,7 @@ in {
programs.password-store = {
enable = true;
- package = pkgs.pass.withExtensions(exts: [ exts.pass-otp ]);
+ package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]);
settings = {
PASSWORD_STORE_DIR = "~/.config/password-store";
};
@@ -58,7 +59,7 @@ in {
enableSshSupport = false;
#pinentryFlavor = null;
#extraConfig = ''
- #pinentry-program /home/imsohexy/nixos/packages/anypinentry/source/anypinentry
+ #pinentry-program /home/imsohexy/nixos/packages/anypinentry/source/anypinentry
#'';
};
@@ -122,6 +123,7 @@ in {
".config/zsh".source = ./config/zsh;
".config/nvim".source = ./config/nvim;
".config/qutebrowser".source = ./config/qutebrowser;
+ ".config/sxiv".source = ./config/sxiv;
".local/share/qutebrowser/userscripts".source = ./config/qutebrowser/userscripts;
".local/share/qutebrowser/greasemonkey".source = ./config/qutebrowser/greasemonkey;
# ".local/share/qutebrowser/sessions".source = ./private-config/qutebrowser/sessions;
@@ -132,18 +134,18 @@ in {
};
#services.picom = {
- #enable = true;
- #backend = "glx";
- #inactiveDim = "0.3";
- #opacityRule = [
- #"98:class_g = 'St' && focused"
- #"85:class_g = 'St' && !focused"
- #"90:class_g = 'qutebrowser' && !focused"
- #"100:class_g = 'qutebrowser' && focused"
- #];
- #extraOptions = ''
- #focus-exclude = [ "class_g = 'dwm'", "class_g = 'dmenu'"];
- #'';
- #menuOpacity = "0.9";
+ #enable = true;
+ #backend = "glx";
+ #inactiveDim = "0.3";
+ #opacityRule = [
+ #"98:class_g = 'St' && focused"
+ #"85:class_g = 'St' && !focused"
+ #"90:class_g = 'qutebrowser' && !focused"
+ #"100:class_g = 'qutebrowser' && focused"
+ #];
+ #extraOptions = ''
+ #focus-exclude = [ "class_g = 'dwm'", "class_g = 'dmenu'"];
+ #'';
+ #menuOpacity = "0.9";
#};
}