home/natto: misc changes
add mpdris change emacs package hyprland keybind changes random changes to home.packages Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
		@@ -236,6 +236,8 @@ For autocomplete
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
(use-package rustic)
 | 
					(use-package rustic)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(use-package yuck-mode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(use-package wgsl-mode)
 | 
					(use-package wgsl-mode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(use-package nix-mode
 | 
					(use-package nix-mode
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,20 +64,24 @@ gestures {
 | 
				
			|||||||
    workspace_swipe = off
 | 
					    workspace_swipe = off
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$mainMod = SUPER
 | 
					
 | 
				
			||||||
 | 
					windowrule=float, ^.*(iwgtk)$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$mainMod=SUPER
 | 
				
			||||||
 | 
					
 | 
				
			||||||
binde=$mainMod, RETURN, exec, foot
 | 
					binde=$mainMod, RETURN, exec, foot
 | 
				
			||||||
bindr=SUPER, D, exec, pkill tofi || tofi-drun | xargs hyprctl dispatch exec --
 | 
					bindr=SUPER, D, exec, pkill tofi || tofi-drun | xargs hyprctl dispatch exec --
 | 
				
			||||||
bindr=SUPER SHIFT, D, exec, pkill tofi || tofi-run --require-match=false | xargs hyprctl dispatch exec
 | 
					bindr=SUPER SHIFT, D, exec, pkill tofi || tofi-run --require-match=false | xargs hyprctl dispatch exec --
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bind=$mainMod, P, exec, mpc toggle
 | 
					bind=$mainMod, P, exec, playerctl play-pause
 | 
				
			||||||
bind=, XF86AudioNext, exec, mpc seek +00:00:05
 | 
					bind=, XF86AudioPlay, exec, playerctl play-pause
 | 
				
			||||||
bind=, XF86AudioPrev, exec, mpc seek -00:00:05
 | 
					bind=, XF86AudioNext, exec, playerctl position 5+
 | 
				
			||||||
bind=$mainMod, XF86AudioNext, exec, mpc next
 | 
					bind=, XF86AudioPrev, exec, playerctl position 5-
 | 
				
			||||||
bind=$mainMod, XF86AudioPrev, exec, mpc prev
 | 
					bind=$mainMod, XF86AudioNext, exec, playerctl next
 | 
				
			||||||
 | 
					bind=$mainMod, XF86AudioPrev, exec, playerctl previous
 | 
				
			||||||
binde=, XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
 | 
					binde=, XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
 | 
				
			||||||
binde=, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
 | 
					binde=, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
 | 
				
			||||||
bind=,XF86AudioMute,exec,wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
 | 
					bind=, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
 | 
				
			||||||
 | 
					
 | 
				
			||||||
binde=, XF86MonBrightnessUp, exec, light -A 5
 | 
					binde=, XF86MonBrightnessUp, exec, light -A 5
 | 
				
			||||||
binde=, XF86MonBrightnessDown, exec, light -U 5
 | 
					binde=, XF86MonBrightnessDown, exec, light -U 5
 | 
				
			||||||
@@ -88,6 +92,9 @@ bind=$mainMod SHIFT, F3, exec, setxkbmap in deva
 | 
				
			|||||||
bind=$mainMod SHIFT, F4, exec, setxkbmap in guru
 | 
					bind=$mainMod SHIFT, F4, exec, setxkbmap in guru
 | 
				
			||||||
bind=$mainMod SHIFT, F5, exec, setxkbmap colemak dhz
 | 
					bind=$mainMod SHIFT, F5, exec, setxkbmap colemak dhz
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bind=, PRINT, exec, grimblast --notify copysave screen
 | 
				
			||||||
 | 
					bind=SHIFT, PRINT, exec, grimblast --notify copysave area
 | 
				
			||||||
 | 
					
 | 
				
			||||||
binde=$mainMod SHIFT, Q, killactive,
 | 
					binde=$mainMod SHIFT, Q, killactive,
 | 
				
			||||||
bind=$mainMod ALT, f, exit,
 | 
					bind=$mainMod ALT, f, exit,
 | 
				
			||||||
bind=$mainMod SHIFT, t, pseudo,
 | 
					bind=$mainMod SHIFT, t, pseudo,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,22 +70,22 @@ myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
 | 
				
			|||||||
     spawn "flameshot gui -d 10000")
 | 
					     spawn "flameshot gui -d 10000")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  , ((modMask, xK_p),
 | 
					  , ((modMask, xK_p),
 | 
				
			||||||
     spawn "mpc toggle")
 | 
					     spawn "playerctl play-pause")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  , ((0, xF86XK_AudioPlay),
 | 
					  , ((0, xF86XK_AudioPlay),
 | 
				
			||||||
     spawn "mpc toggle")
 | 
					     spawn "playerctl play-pause")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  , ((modMask, xF86XK_AudioNext),
 | 
					  , ((modMask, xF86XK_AudioNext),
 | 
				
			||||||
     spawn "mpc next")
 | 
					     spawn "playerctl next")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  , ((modMask, xF86XK_AudioPrev),
 | 
					  , ((modMask, xF86XK_AudioPrev),
 | 
				
			||||||
     spawn "mpc prev")
 | 
					     spawn "playerctl previous")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  , ((0, xF86XK_AudioPrev),
 | 
					  , ((0, xF86XK_AudioPrev),
 | 
				
			||||||
     spawn "mpc seek -00:00:05")
 | 
					     spawn "playerctl position 5-")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  , ((0, xF86XK_AudioNext),
 | 
					  , ((0, xF86XK_AudioNext),
 | 
				
			||||||
     spawn "mpc seek +00:00:05")
 | 
					     spawn "playerctl position 5+")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  , ((0, xF86XK_AudioRaiseVolume),
 | 
					  , ((0, xF86XK_AudioRaiseVolume),
 | 
				
			||||||
     spawn "pamixer --allow-boost -ui 5")
 | 
					     spawn "pamixer --allow-boost -ui 5")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@ let
 | 
				
			|||||||
  mymacs = config: # with inputs.emacs-overlay.packages.${pkgs.system}; already resolved with overlay
 | 
					  mymacs = config: # with inputs.emacs-overlay.packages.${pkgs.system}; already resolved with overlay
 | 
				
			||||||
    with pkgs; emacsWithPackagesFromUsePackage {
 | 
					    with pkgs; emacsWithPackagesFromUsePackage {
 | 
				
			||||||
      inherit config;
 | 
					      inherit config;
 | 
				
			||||||
      package = emacsGit;
 | 
					      package = emacsPgtk;
 | 
				
			||||||
      alwaysEnsure = true;
 | 
					      alwaysEnsure = true;
 | 
				
			||||||
      alwaysTangle = true;
 | 
					      alwaysTangle = true;
 | 
				
			||||||
      extraEmacsPackages = epkgs: with epkgs; [
 | 
					      extraEmacsPackages = epkgs: with epkgs; [
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,8 +10,8 @@
 | 
				
			|||||||
      };
 | 
					      };
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    iconTheme = {
 | 
					    iconTheme = {
 | 
				
			||||||
      package = pkgs.zafiro-icons;
 | 
					      package = pkgs.papirus-icon-theme;
 | 
				
			||||||
      name = "Zafiro-icons-Dark";
 | 
					      name = "Papirus-Dark";
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@ let
 | 
				
			|||||||
  home = config.home.homeDirectory;
 | 
					  home = config.home.homeDirectory;
 | 
				
			||||||
in
 | 
					in
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  services = {
 | 
					  services = rec {
 | 
				
			||||||
    mpd = {
 | 
					    mpd = {
 | 
				
			||||||
      enable = true;
 | 
					      enable = true;
 | 
				
			||||||
      musicDirectory = "${home}/Music";
 | 
					      musicDirectory = "${home}/Music";
 | 
				
			||||||
@@ -18,7 +18,7 @@ in
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    mpd-discord-rpc = {
 | 
					    mpd-discord-rpc = {
 | 
				
			||||||
      enable = true;
 | 
					      inherit (mpd) enable;
 | 
				
			||||||
      settings = {
 | 
					      settings = {
 | 
				
			||||||
        id = 1039532008424099850; # dont really care
 | 
					        id = 1039532008424099850; # dont really care
 | 
				
			||||||
        format = {
 | 
					        format = {
 | 
				
			||||||
@@ -29,6 +29,16 @@ in
 | 
				
			|||||||
        };
 | 
					        };
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    mpdris2 = {
 | 
				
			||||||
 | 
					      inherit (mpd) enable;
 | 
				
			||||||
 | 
					      mpd = {
 | 
				
			||||||
 | 
					        inherit (mpd) musicDirectory;
 | 
				
			||||||
 | 
					        host = "localhost";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    playerctld.enable = true;
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  systemd.user.services = {
 | 
					  systemd.user.services = {
 | 
				
			||||||
@@ -62,8 +72,8 @@ in
 | 
				
			|||||||
        visualizerSupport = true;
 | 
					        visualizerSupport = true;
 | 
				
			||||||
        clockSupport = true;
 | 
					        clockSupport = true;
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      mpdas
 | 
					 | 
				
			||||||
      mpc_cli
 | 
					      mpc_cli
 | 
				
			||||||
 | 
					      playerctl
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    file.ncmpcpp = {
 | 
					    file.ncmpcpp = {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,7 @@
 | 
				
			|||||||
    imagemagick
 | 
					    imagemagick
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Utils
 | 
					    # Utils
 | 
				
			||||||
 | 
					    neofetch
 | 
				
			||||||
    rage
 | 
					    rage
 | 
				
			||||||
    curl
 | 
					    curl
 | 
				
			||||||
    yt-dlp
 | 
					    yt-dlp
 | 
				
			||||||
@@ -18,7 +19,6 @@
 | 
				
			|||||||
    unrar
 | 
					    unrar
 | 
				
			||||||
    vim
 | 
					    vim
 | 
				
			||||||
    jmtpfs
 | 
					    jmtpfs
 | 
				
			||||||
    neofetch
 | 
					 | 
				
			||||||
    (inputs.nbfc.packages.${pkgs.system}.nbfc-client-c)
 | 
					    (inputs.nbfc.packages.${pkgs.system}.nbfc-client-c)
 | 
				
			||||||
    (flake.packages.${pkgs.system}.customscripts)
 | 
					    (flake.packages.${pkgs.system}.customscripts)
 | 
				
			||||||
    translate-shell
 | 
					    translate-shell
 | 
				
			||||||
@@ -31,17 +31,24 @@
 | 
				
			|||||||
      nss = nss_latest;
 | 
					      nss = nss_latest;
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    inputs.webcord.legacyPackages.${pkgs.system}.webcord
 | 
					    inputs.webcord.legacyPackages.${pkgs.system}.webcord
 | 
				
			||||||
 | 
					    (xfce.thunar.override {
 | 
				
			||||||
 | 
					      thunarPlugins = with xfce; [
 | 
				
			||||||
 | 
					        thunar-media-tags-plugin
 | 
				
			||||||
 | 
					        thunar-volman
 | 
				
			||||||
 | 
					        thunar-archive-plugin
 | 
				
			||||||
 | 
					      ];
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					    xfce.xfconf
 | 
				
			||||||
 | 
					    xfce.tumbler
 | 
				
			||||||
    qbittorrent
 | 
					    qbittorrent
 | 
				
			||||||
    hexchat
 | 
					    hexchat
 | 
				
			||||||
    luajit
 | 
					    luajit
 | 
				
			||||||
    dunst
 | 
					    dunst
 | 
				
			||||||
    feh
 | 
					 | 
				
			||||||
    authy
 | 
					    authy
 | 
				
			||||||
    gnome.zenity
 | 
					    gnome.zenity
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Wine and games and stuff
 | 
					    # Wine and games and stuff
 | 
				
			||||||
    steam
 | 
					    steam
 | 
				
			||||||
    wineWowPackages.stable
 | 
					 | 
				
			||||||
    winetricks
 | 
					    winetricks
 | 
				
			||||||
    #   (inputs.nix-gaming.packages.${pkgs.system}.osu-stable)
 | 
					    #   (inputs.nix-gaming.packages.${pkgs.system}.osu-stable)
 | 
				
			||||||
    (flake.packages.${pkgs.system}.tlauncher)
 | 
					    (flake.packages.${pkgs.system}.tlauncher)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
{ pkgs, config, colors, ... }:
 | 
					{ pkgs, config, colors, inputs, ... }:
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  wayland = {
 | 
					  wayland = {
 | 
				
			||||||
    windowManager = {
 | 
					    windowManager = {
 | 
				
			||||||
@@ -49,5 +49,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  home.packages = with pkgs; [
 | 
					  home.packages = with pkgs; [
 | 
				
			||||||
    tofi
 | 
					    tofi
 | 
				
			||||||
 | 
					    wineWowPackages.waylandFull
 | 
				
			||||||
 | 
					    imv
 | 
				
			||||||
 | 
					    grim
 | 
				
			||||||
 | 
					    slurp
 | 
				
			||||||
 | 
					    inputs.hyprland-contrib.packages.${pkgs.system}.grimblast
 | 
				
			||||||
 | 
					    wl-clipboard
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,6 @@
 | 
				
			|||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  home.packages = with pkgs; [
 | 
					  home.packages = with pkgs; [
 | 
				
			||||||
    (dmenu.override { patches = [ ./patches/dmenu.patch ]; })
 | 
					 | 
				
			||||||
    (st.override {
 | 
					    (st.override {
 | 
				
			||||||
      patches = [ ./patches/st.patch ];
 | 
					      patches = [ ./patches/st.patch ];
 | 
				
			||||||
      extraLibs = [ harfbuzz ];
 | 
					      extraLibs = [ harfbuzz ];
 | 
				
			||||||
@@ -27,19 +26,12 @@
 | 
				
			|||||||
    xorg.xkbcomp
 | 
					    xorg.xkbcomp
 | 
				
			||||||
    xorg.xmodmap
 | 
					    xorg.xmodmap
 | 
				
			||||||
    sxiv
 | 
					    sxiv
 | 
				
			||||||
 | 
					    feh
 | 
				
			||||||
    xdotool
 | 
					    xdotool
 | 
				
			||||||
    (xfce.thunar.override {
 | 
					 | 
				
			||||||
      thunarPlugins = with xfce; [
 | 
					 | 
				
			||||||
        thunar-media-tags-plugin
 | 
					 | 
				
			||||||
        thunar-volman
 | 
					 | 
				
			||||||
        thunar-archive-plugin
 | 
					 | 
				
			||||||
      ];
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
    xfce.xfconf
 | 
					 | 
				
			||||||
    xfce.tumbler
 | 
					 | 
				
			||||||
    flameshot
 | 
					    flameshot
 | 
				
			||||||
    xmobar
 | 
					    xmobar
 | 
				
			||||||
    stalonetray
 | 
					    stalonetray
 | 
				
			||||||
 | 
					    wineWowPackages.stable
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  home.file.stalonetray = {
 | 
					  home.file.stalonetray = {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,108 +0,0 @@
 | 
				
			|||||||
#!/bin/sh
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# title: dmenu_websearch <http://efe.kim/dmenu_websearch.html>
 | 
					 | 
				
			||||||
# license: CC0
 | 
					 | 
				
			||||||
# author: Sunur Efe Vural <efe@efe.kim>
 | 
					 | 
				
			||||||
# version: Mar 22, 2019
 | 
					 | 
				
			||||||
# dependencies: dmenu, xdotool, hexdump, xprop, setxkbmap, coreutils.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# A  browser-independent address  bar  with bookmark  support. When  the
 | 
					 | 
				
			||||||
# cursor is on a web browser it acts as the address bar of that browser.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
browser='firefox --new-window'
 | 
					 | 
				
			||||||
engine='https://duckduckgo.com/?q=%s'
 | 
					 | 
				
			||||||
bookmarks="$HOME/.bookmarks"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
gotourl() {
 | 
					 | 
				
			||||||
	if [ "$nbrowser" = surf ]
 | 
					 | 
				
			||||||
	then
 | 
					 | 
				
			||||||
		xprop -id "$winid" -f _SURF_GO 8s -set _SURF_GO "$choice"
 | 
					 | 
				
			||||||
	elif [ -n "$winid" ] && [ -z "$nbrowser" ]
 | 
					 | 
				
			||||||
	then
 | 
					 | 
				
			||||||
		#change layout to us cuz xdotool spasms with non-latin layouts
 | 
					 | 
				
			||||||
		layout=$(setxkbmap -query | awk '/^layout:/{ print $2 }')
 | 
					 | 
				
			||||||
		setxkbmap -layout us
 | 
					 | 
				
			||||||
		xdotool key --clearmodifiers "$shortcut"\
 | 
					 | 
				
			||||||
			type --clearmodifiers --delay 2 "$choice"
 | 
					 | 
				
			||||||
		xdotool key --clearmodifiers Return
 | 
					 | 
				
			||||||
		setxkbmap -layout "$layout"
 | 
					 | 
				
			||||||
	elif [ -n "$nbrowser" ]
 | 
					 | 
				
			||||||
	then
 | 
					 | 
				
			||||||
		$nbrowser "$choice"
 | 
					 | 
				
			||||||
	else $browser "$choice"
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
searchweb() {
 | 
					 | 
				
			||||||
	#convert search query to percent encoding and insert it into url
 | 
					 | 
				
			||||||
	choice=$(echo "$choice" | hexdump -v -e '/1 " %02x"')
 | 
					 | 
				
			||||||
	choice=$(echo "$engine" | sed "s/%s/${choice% 0a}/;s/[[:space:]]/%/g")
 | 
					 | 
				
			||||||
	gotourl
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
xprop -root | grep '^_NET_ACTIVE_WINDOW' && {
 | 
					 | 
				
			||||||
	winid=$(xprop -root _NET_ACTIVE_WINDOW | sed 's/.*[[:space:]]//')
 | 
					 | 
				
			||||||
	class=$(xprop -id "$winid" WM_CLASS | awk -F'\"' '{ print $(NF - 1) }')
 | 
					 | 
				
			||||||
	case "$class" in
 | 
					 | 
				
			||||||
		Firefox) nbrowser='firefox' ;;
 | 
					 | 
				
			||||||
		#Firefox) shortcut='ctrl+l' ;; # alternative method, uses xdotool
 | 
					 | 
				
			||||||
		IceCat) nbrowser='icecat' ;;
 | 
					 | 
				
			||||||
		Chromium) nbrowser='chromium' ;;
 | 
					 | 
				
			||||||
		Chrome) nbrowser='chrome' ;;
 | 
					 | 
				
			||||||
		Opera) nbrowser='opera' ;;
 | 
					 | 
				
			||||||
		Vivaldi) nbrowser='vivaldi' ;; # not tested
 | 
					 | 
				
			||||||
		Brave) nbrowser='brave' ;; # not tested
 | 
					 | 
				
			||||||
		Conkeror) nbrowser='conkeror' ;; # not tested
 | 
					 | 
				
			||||||
		Palemoon) nbrowser='palemoon' ;; # not tested
 | 
					 | 
				
			||||||
		Iceweasel) nbrowser='iceweasel' ;; # not tested
 | 
					 | 
				
			||||||
		qutebrowser) nbrowser='qutebrowser' ;;
 | 
					 | 
				
			||||||
		Midori) nbrowser='midori' ;; # not that good
 | 
					 | 
				
			||||||
		Luakit) nbrowser='luakit' ;; # uses the last window instance
 | 
					 | 
				
			||||||
		Uzbl|Vimb) shortcut='o' ;;
 | 
					 | 
				
			||||||
		Links) shortcut='g' ;;
 | 
					 | 
				
			||||||
		Netsurf*|Epiphany|Dillo|Konqueror|Arora) shortcut='ctrl+l' ;;
 | 
					 | 
				
			||||||
		Surf) nbrowser='surf' ; uricur=$(xprop -id "$winid" _SURF_URI |\
 | 
					 | 
				
			||||||
				awk -F'\"' '{ print $( NF - 1 ) }') ;;
 | 
					 | 
				
			||||||
		*) pid=$(xprop -id "$winid" _NET_WM_PID | awk '{ print $3 }')
 | 
					 | 
				
			||||||
			while pgrep -oP "$pid" >/dev/null
 | 
					 | 
				
			||||||
			do
 | 
					 | 
				
			||||||
				pid=$(pgrep -oP "$pid")
 | 
					 | 
				
			||||||
			done
 | 
					 | 
				
			||||||
			pname=$(awk '/^Name\:/{ print $NF }' /proc/"$pid"/status) ||
 | 
					 | 
				
			||||||
				winid="" ;;
 | 
					 | 
				
			||||||
	esac
 | 
					 | 
				
			||||||
	[ -n "$pname" ] && case "$pname" in
 | 
					 | 
				
			||||||
		w3m) shortcut="U" ;;
 | 
					 | 
				
			||||||
		lynx|elinks|links) shortcut="g" ;;
 | 
					 | 
				
			||||||
		*) winid="" ;;
 | 
					 | 
				
			||||||
	esac
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
tmpfile=$(mktemp /tmp/dmenu_websearch.XXXXXX)
 | 
					 | 
				
			||||||
trap 'rm "$tmpfile"' 0 1 15
 | 
					 | 
				
			||||||
printf '%s\n%s\n' "$uricur" "$1" > "$tmpfile"
 | 
					 | 
				
			||||||
cat "$bookmarks" >> "$tmpfile"
 | 
					 | 
				
			||||||
sed -i -E '/^(#|$)/d' "$tmpfile"
 | 
					 | 
				
			||||||
choice=$(dmenu -i -p "Go:" -w "$winid" < "$tmpfile") || exit 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Detect links without protocol (This is WIP)
 | 
					 | 
				
			||||||
protocol='^(https?|ftps?|mailto|about|file):///?'
 | 
					 | 
				
			||||||
checkurl() {
 | 
					 | 
				
			||||||
	grep -Fx "$choice" "$tmpfile" &&
 | 
					 | 
				
			||||||
		choice=$(echo "$choice" | awk '{ print $1 }') && return 0
 | 
					 | 
				
			||||||
	[ ${#choice} -lt 4 ] && return 1
 | 
					 | 
				
			||||||
	echo "$choice" | grep -Z ' ' && return 1
 | 
					 | 
				
			||||||
	echo "$choice" | grep -EiZ "$protocol" && return 0
 | 
					 | 
				
			||||||
	echo "$choice" | grep -FZ '..' && return 1
 | 
					 | 
				
			||||||
	prepath=$(echo "$choice" | sed 's/(\/|#|\?).*//')
 | 
					 | 
				
			||||||
	echo "$prepath" |  grep -FvZ '.' && return 1
 | 
					 | 
				
			||||||
	echo "$prepath" |  grep -EZ '^([[:alnum:]~_:-]+\.?){1,3}' && return 0
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if checkurl
 | 
					 | 
				
			||||||
then
 | 
					 | 
				
			||||||
	echo "$choice" | grep -EivZ "$protocol" &&
 | 
					 | 
				
			||||||
		choice="http://$choice"
 | 
					 | 
				
			||||||
	gotourl
 | 
					 | 
				
			||||||
else searchweb
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user