Add rofi-filemenu & st-calc

These are dummy applications for rofi's dmenu launcher.
This commit is contained in:
Henrik Lissner 2019-12-09 02:54:42 -05:00
parent 6820a8a51c
commit 33868cd3d3
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
4 changed files with 70 additions and 24 deletions

View file

@ -23,6 +23,7 @@ bspc rule -a feh state=fullscreen
bspc rule -a 'Emacs:org*' state=floating bspc rule -a 'Emacs:org*' state=floating
bspc rule -a 'Emacs:scratch' state=floating bspc rule -a 'Emacs:scratch' state=floating
bspc rule -a st-scratch state=floating sticky=on center=on bspc rule -a st-scratch state=floating sticky=on center=on
bspc rule -a st-calc state=floating sticky=on center=on
# #

10
config/rofi/bin/rofi-filemenu Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env sh
DIR="$(fd -L --type d . $HOME | rofi -dmenu -i -columns 1 -theme theme/appmenu.rasi)"
if [ -d "$DIR" ]; then
cd "$DIR"
if [[ $1 == "-x" ]]; then
st-scratch
else
xst
fi
fi

View file

@ -18,24 +18,6 @@
}) })
xst # st + nice-to-have extensions xst # st + nice-to-have extensions
(writeScriptBin "st-scratch" ''
#!${stdenv.shell}
SCRID=st-scratch
focused=$(xdotool getactivewindow)
scratch=$(xdotool search --onlyvisible --classname $SCRID)
if [[ -n $scratch ]]; then
if [[ $focused == $scratch ]]; then
xdotool windowkill $scratch
else
xdotool windowactivate $scratch
fi
else
xst -t $SCRID -n $SCRID -c $SCRID \
-f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \
-g 100x26 \
-e $SHELL
fi
'')
(makeDesktopItem { (makeDesktopItem {
name = "xst"; name = "xst";
desktopName = "Suckless Terminal"; desktopName = "Suckless Terminal";
@ -44,6 +26,42 @@
exec = "${xst}/bin/xst"; exec = "${xst}/bin/xst";
categories = "Development;System;Utility"; categories = "Development;System;Utility";
}) })
(writeScriptBin "st-scratch" ''
#!${stdenv.shell}
SCRID=st-scratch
focused=$(xdotool getactivewindow)
scratch=$(xdotool search --onlyvisible --classname $SCRID)
if [[ -n $scratch ]]; then
if [[ $focused == $scratch ]]; then
xdotool windowkill $scratch
else
xdotool windowactivate $scratch
fi
else
xst -t $SCRID -n $SCRID -c $SCRID \
-f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \
-g 100x26 \
-e $SHELL
fi
'')
(writeScriptBin "st-calc" ''
#!${stdenv.shell}
SCRID=st-calc
scratch=$(xdotool search --onlyvisible --classname $SCRID)
[ -n "$scratch" ] && xdotool windowkill $scratch
xst -t $SCRID -n $SCRID -c $SCRID \
-f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \
-g 80x12 \
-e $SHELL -c qalc
'')
(makeDesktopItem {
name = "st-calc";
desktopName = "Calculator";
icon = "calc";
exec = "st-calc";
categories = "Development";
})
]; ];
}; };

View file

@ -9,20 +9,37 @@
'') '')
rofi rofi
# Fake rofi dmenu entries
(makeDesktopItem { (makeDesktopItem {
name = "browsermenu"; name = "rofi-browsermenu";
desktopName = "Open Bookmark in Firefox"; desktopName = "Open Bookmark in Firefox";
icon = "firefox"; icon = "firefox";
exec = "rofi-browsermenu"; exec = "${<config/rofi>}/bin/rofi-browsermenu";
categories = "Network"; categories = "Network;Utility";
})
(makeDesktopItem {
name = "rofi-filemenu";
desktopName = "Open Directory in Terminal";
icon = "folder";
exec = "${<config/rofi>}/bin/rofi-filemenu";
categories = "System;Utility";
})
(makeDesktopItem {
name = "rofi-filemenu-scratch";
desktopName = "Open Directory in Scratch Terminal";
icon = "folder";
exec = "${<config/rofi>}/bin/rofi-filemenu -x";
categories = "System;Utility";
}) })
];
# shellAliases = {}; ];
}; };
home-manager.users.hlissner.xdg.configFile = { home-manager.users.hlissner.xdg.configFile = {
# link recursively so other modules can link files in its folder # link recursively so other modules can link files in its folder
"rofi" = { source = <config/rofi>; recursive = true; }; "rofi" = {
source = <config/rofi>;
recursive = true;
};
}; };
} }