autorefactoring && mime apps list for docx

This commit is contained in:
Gregory Bednov 2026-08-28 16:24:05 +03:00
commit 2381381cc8

View file

@ -1,7 +1,8 @@
{
description = "MIREA desktop";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
outputs = { self, nixpkgs, ... }:
outputs =
{ self, nixpkgs, ... }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
@ -10,8 +11,8 @@
pcmanfmConf = "${self}/pcmanfm.conf";
mimeappsList = "${self}/mimeapps.list";
desktopItems0 = (pkgs.writeText "desktop-items-0.conf"
''
desktopItems0 = (
pkgs.writeText "desktop-items-0.conf" ''
[*]
wallpaper_mode=center
wallpaper_common=1
@ -27,24 +28,31 @@ sort=mtime;ascending;
show_documents=0
show_trash=1
show_mounts=1
'');
jgmenu_run_prepared =
(pkgs.writeShellScript "jgmenu_run_prepared"
''${pkgs.jgmenu}/bin/jgmenu_run apps | ${prepare_jgmenu}/bin/prepare_jgmenu | ${pkgs.jgmenu}/bin/jgmenu --simple'');
powermenu = (pkgs.writeShellScript "powermenu"
''
);
jgmenu_run_prepared = (
pkgs.writeShellScript "jgmenu_run_prepared" "${pkgs.jgmenu}/bin/jgmenu_run apps | ${prepare_jgmenu}/bin/prepare_jgmenu | ${pkgs.jgmenu}/bin/jgmenu --simple"
);
powermenu = (
let
zenityDialog =
msg: cmd:
''${pkgs.zenity}/bin/zenity --question --text "Уверены, что хотите ${msg}?" --default-cancel; && ${cmd}'';
in
pkgs.writeShellScript "powermenu" ''
if [ "$1" = "poweroff" ]; then
${pkgs.zenity}/bin/zenity --question --text "Уверены, что хотите выключить?" --default-cancel && poweroff
${zenityDialog "Выключить" "poweroff"}
exit 0
fi
if [ "$1" = "reboot" ]; then
${pkgs.zenity}/bin/zenity --question --text "Уверены, что хотите перезагрузить?" --default-cancel && reboot
${zenityDialog "Выключить" "reboot"}
exit 0
fi
'');
''
);
mireaweek = pkgs.stdenv.mkDerivation rec {
pname = "mireaweek";
@ -81,8 +89,7 @@ fi
tint2conf1 = builtins.readFile "${self}/tint2conf.1";
tint2conf2 = builtins.readFile "${self}/tint2conf.2";
tint2config = pkgs.writeText "tint2conf"
''
tint2config = pkgs.writeText "tint2conf" ''
${tint2conf1}
#-------------------------------------
button = new
@ -133,35 +140,29 @@ ${tint2conf2}
screenshotDir = ''"$HOME/Pictures/Screenshots"'';
videoDir = ''"$HOME/Videos/ScreenRecords"'';
screenshotFullClipboard = pkgs.writeShellScript "screenshot-full-clipboard"
''
screenshotFullClipboard = pkgs.writeShellScript "screenshot-full-clipboard" ''
exec ${pkgs.maim}/bin/maim | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png
'';
screenshotWindowClipboard = pkgs.writeShellScript "screenshot-window-clipboard"
''
screenshotWindowClipboard = pkgs.writeShellScript "screenshot-window-clipboard" ''
exec ${pkgs.maim}/bin/maim -i "$(${pkgs.xdotool}/bin/xdotool getactivewindow)" | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png
'';
screenshotFullFile = pkgs.writeShellScript "screenshot-full-file"
''
screenshotFullFile = pkgs.writeShellScript "screenshot-full-file" ''
mkdir -p ${screenshotDir}
exec ${pkgs.maim}/bin/maim "$HOME/Pictures/Screenshots/$(date +%F-%H-%M-%S).png"
'';
screenshotRegionClipboard = pkgs.writeShellScript "screenshot-region-clipboard"
''
screenshotRegionClipboard = pkgs.writeShellScript "screenshot-region-clipboard" ''
exec ${pkgs.maim}/bin/maim -s | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png
'';
screenshotRegionFile = pkgs.writeShellScript "screenshot-region-file"
''
screenshotRegionFile = pkgs.writeShellScript "screenshot-region-file" ''
mkdir -p ${screenshotDir}
exec ${pkgs.maim}/bin/maim -s "$HOME/Pictures/Screenshots/$(date +%F-%H-%M-%S).png"
'';
recordFullScreen = pkgs.writeShellScript "record-full-screen"
''
recordFullScreen = pkgs.writeShellScript "record-full-screen" ''
set -eu
mkdir -p "$HOME/.cache" ${videoDir}
pidfile="$HOME/.cache/mirea-screenrecord.pid"
@ -187,8 +188,7 @@ ${pkgs.ffmpeg}/bin/ffmpeg \
echo $! > "$pidfile"
'';
capturePanel = pkgs.writeShellScript "capture-panel"
''
capturePanel = pkgs.writeShellScript "capture-panel" ''
choice="$(${pkgs.zenity}/bin/zenity \
--list \
--title="Capture" \
@ -227,8 +227,7 @@ case "$choice" in
esac
'';
sxhkdConfig = pkgs.writeText "sxhkdrc"
''
sxhkdConfig = pkgs.writeText "sxhkdrc" ''
# Windows-like
Print
${screenshotFullClipboard}
@ -267,28 +266,23 @@ F13
${jgmenu_run_prepared}
'';
sxhkdWrapped = pkgs.writeShellScript "sxhkd-mirea"
''
sxhkdWrapped = pkgs.writeShellScript "sxhkd-mirea" ''
exec ${pkgs.sxhkd}/bin/sxhkd -c ${sxhkdConfig}
'';
xcapeWrapped = pkgs.writeShellScript "xcape-mirea"
''
xcapeWrapped = pkgs.writeShellScript "xcape-mirea" ''
exec ${pkgs.xcape}/bin/xcape -e 'Super_L=F13;Super_R=F13'
'';
tint2custom = pkgs.writeShellScript "tint2"
''
tint2custom = pkgs.writeShellScript "tint2" ''
${pkgs.tint2}/bin/tint2 -c ${tint2config}
'';
pcmanfmdesktop = pkgs.writeShellScript "pcmanfm"
''
pcmanfmdesktop = pkgs.writeShellScript "pcmanfm" ''
${pkgs.pcmanfm}/bin/pcmanfm --desktop
'';
myxinitrc = pkgs.writeText ".xinitrc"
''
myxinitrc = pkgs.writeText ".xinitrc" ''
${tint2custom} &
${pcmanfmdesktop} &
${sxhkdWrapped} &
@ -296,8 +290,7 @@ ${xcapeWrapped} &
exec ${pkgs.metacity}/bin/metacity
'';
resethome = pkgs.writeShellScript "startmireadesktop"
''
resethome = pkgs.writeShellScript "startmireadesktop" ''
rm -rf $HOME/{*,.*} 2> /dev/null # wipe student directory, yeah!
printf "[client]\nport=3306\nuser=root" > /home/student/.my.cnf
echo "\set user postgres" > /home/student/.psqlrc
@ -312,7 +305,8 @@ printf "[Settings]\ngtk-icon-theme-name = WhiteSur" > "$HOME/.config/gtk-3.0/set
cp ${myxinitrc} "$HOME/.xinitrc"
mkdir -p "$HOME/Pictures/Screenshots" "$HOME/Videos/ScreenRecords" "$HOME/.cache"
'';
in {
in
{
packages.x86_64-linux.powermenu = powermenu; # must be imported into configuration.nix!
packages.x86_64-linux.tint2 = tint2custom;
packages.x86_64-linux.pcmanfm = pcmanfmdesktop;