summaryrefslogtreecommitdiffstats
path: root/dmenuclip
authorRaghavendra D Prabhu <[email protected]>2011-03-12 18:54:47 (GMT)
committer Raghavendra D Prabhu <[email protected]>2011-03-12 18:54:47 (GMT)
commit5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a (patch) (side-by-side diff)
treedeabb15393558ab3a1a629fc0782d8b0c3124c48 /dmenuclip
downloadScripts-5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a.zip
Scripts-5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a.tar.gz
Scripts-5ec75ea891c9b44cdd2d7a3e0c29b4d08dff2b2a.tar.bz2
Initial scripts update
Diffstat (limited to 'dmenuclip') (more/less context) (ignore whitespace changes)
-rwxr-xr-xdmenuclip52
1 files changed, 52 insertions, 0 deletions
diff --git a/dmenuclip b/dmenuclip
new file mode 100755
index 0000000..cb6abd1
--- a/dev/null
+++ b/dmenuclip
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+# dmenuclip - Really nasty dmenu launcher to be used in combination with
+# clipbored
+use strict;
+
+my $xsels = "$ENV{XDG_DATA_HOME}/clipbored/clips";
+
+my $font = (exists $ENV{CLIPBORED_DMENU_FONT})
+ ? $ENV{CLIPBORED_DMENU_FONT}
+ : '-*-fixed-*-*-*-*-15-*-*-*-*-*-*-*';
+my $normal_bg = (exists $ENV{CLIPBORED_DMENU_NORMAL_BG})
+ ? $ENV{CLIPBORED_DMENU_NORMAL_BG}
+ : "#1c1c1c";
+my $normal_fg = (exists $ENV{CLIPBORED_DMENU_NORMAL_FG})
+ ? $ENV{CLIPBORED_DMENU_NORMAL_FG}
+ : "#ffffff";
+my $select_bg = (exists $ENV{CLIPBORED_DMENU_SELECT_BG})
+ ? $ENV{CLIPBORED_DMENU_SELECT_BG}
+ : "#484848";
+my $select_fg = (exists $ENV{CLIPBORED_DMENU_SELECT_FG})
+ ? $ENV{CLIPBORED_DMENU_SELECT_FG}
+ : "#ffffff";
+
+my $list_mode = (exists $ENV{CLIPBORED_DMENU_LISTMODE})
+ ? dmenu_mode($ENV{CLIPBORED_DMENU_LISTMODE})
+ : dmenu_mode('vertical');
+
+# If defined, we want vertical mode
+if(exists($ENV{CLIPBORED_DMENU_LINES})) {
+ $list_mode = "-l $ENV{CLIPBORED_DMENU_LINES}";
+}
+
+sub dmenu_mode {
+ my $what = shift;
+
+ if($what eq 'vertical') {
+ return("-l 15");
+ }
+ else {
+ return("");
+ }
+}
+
+$normal_bg =~ s/^(#)/\\$1/;
+$normal_fg =~ s/^(#)/\\$1/;
+$select_bg =~ s/^(#)/\\$1/;
+$select_fg =~ s/^(#)/\\$1/;
+
+my $dmenu = "dmenu -i -b $list_mode "
+ . "-nb $normal_bg -nf $normal_fg -sb $select_bg -sf $select_fg";
+
+system("printf \"\$(\\tac $xsels|$dmenu -fn $font -p dmenuclip)\"|xclip -i -l 0|xclip -o");