autorefactoring && mime apps list for docx
This commit is contained in:
parent
d5a0eff1d8
commit
2381381cc8
1 changed files with 315 additions and 321 deletions
336
flake.nix
336
flake.nix
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
description = "MIREA desktop";
|
description = "MIREA desktop";
|
||||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||||
outputs = { self, nixpkgs, ... }:
|
outputs =
|
||||||
|
{ self, nixpkgs, ... }:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||||
|
|
||||||
|
|
@ -10,41 +11,48 @@
|
||||||
pcmanfmConf = "${self}/pcmanfm.conf";
|
pcmanfmConf = "${self}/pcmanfm.conf";
|
||||||
mimeappsList = "${self}/mimeapps.list";
|
mimeappsList = "${self}/mimeapps.list";
|
||||||
|
|
||||||
desktopItems0 = (pkgs.writeText "desktop-items-0.conf"
|
desktopItems0 = (
|
||||||
''
|
pkgs.writeText "desktop-items-0.conf" ''
|
||||||
[*]
|
[*]
|
||||||
wallpaper_mode=center
|
wallpaper_mode=center
|
||||||
wallpaper_common=1
|
wallpaper_common=1
|
||||||
wallpapers_configured=1
|
wallpapers_configured=1
|
||||||
wallpaper=${self}/wallpaper.svg
|
wallpaper=${self}/wallpaper.svg
|
||||||
desktop_bg=#77767b
|
desktop_bg=#77767b
|
||||||
desktop_fg=#ffffff
|
desktop_fg=#ffffff
|
||||||
desktop_shadow=#000000
|
desktop_shadow=#000000
|
||||||
desktop_font=Sans 12
|
desktop_font=Sans 12
|
||||||
folder=/home/student
|
folder=/home/student
|
||||||
show_wm_menu=1
|
show_wm_menu=1
|
||||||
sort=mtime;ascending;
|
sort=mtime;ascending;
|
||||||
show_documents=0
|
show_documents=0
|
||||||
show_trash=1
|
show_trash=1
|
||||||
show_mounts=1
|
show_mounts=1
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
|
|
||||||
jgmenu_run_prepared =
|
jgmenu_run_prepared = (
|
||||||
(pkgs.writeShellScript "jgmenu_run_prepared"
|
pkgs.writeShellScript "jgmenu_run_prepared" "${pkgs.jgmenu}/bin/jgmenu_run apps | ${prepare_jgmenu}/bin/prepare_jgmenu | ${pkgs.jgmenu}/bin/jgmenu --simple"
|
||||||
''${pkgs.jgmenu}/bin/jgmenu_run apps | ${prepare_jgmenu}/bin/prepare_jgmenu | ${pkgs.jgmenu}/bin/jgmenu --simple'');
|
);
|
||||||
|
|
||||||
powermenu = (pkgs.writeShellScript "powermenu"
|
powermenu = (
|
||||||
''
|
let
|
||||||
if [ "$1" = "poweroff" ]; then
|
zenityDialog =
|
||||||
${pkgs.zenity}/bin/zenity --question --text "Уверены, что хотите выключить?" --default-cancel && poweroff
|
msg: cmd:
|
||||||
|
''${pkgs.zenity}/bin/zenity --question --text "Уверены, что хотите ${msg}?" --default-cancel; && ${cmd}'';
|
||||||
|
in
|
||||||
|
pkgs.writeShellScript "powermenu" ''
|
||||||
|
if [ "$1" = "poweroff" ]; then
|
||||||
|
${zenityDialog "Выключить" "poweroff"}
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "reboot" ]; then
|
if [ "$1" = "reboot" ]; then
|
||||||
${pkgs.zenity}/bin/zenity --question --text "Уверены, что хотите перезагрузить?" --default-cancel && reboot
|
${zenityDialog "Выключить" "reboot"}
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
|
|
||||||
mireaweek = pkgs.stdenv.mkDerivation rec {
|
mireaweek = pkgs.stdenv.mkDerivation rec {
|
||||||
pname = "mireaweek";
|
pname = "mireaweek";
|
||||||
|
|
@ -81,101 +89,94 @@ fi
|
||||||
tint2conf1 = builtins.readFile "${self}/tint2conf.1";
|
tint2conf1 = builtins.readFile "${self}/tint2conf.1";
|
||||||
tint2conf2 = builtins.readFile "${self}/tint2conf.2";
|
tint2conf2 = builtins.readFile "${self}/tint2conf.2";
|
||||||
|
|
||||||
tint2config = pkgs.writeText "tint2conf"
|
tint2config = pkgs.writeText "tint2conf" ''
|
||||||
''
|
${tint2conf1}
|
||||||
${tint2conf1}
|
#-------------------------------------
|
||||||
#-------------------------------------
|
button = new
|
||||||
button = new
|
button_lclick_command = ${jgmenu_run_prepared}
|
||||||
button_lclick_command = ${jgmenu_run_prepared}
|
button_icon = ${self}/wallpaper.svg
|
||||||
button_icon = ${self}/wallpaper.svg
|
|
||||||
|
|
||||||
separator = new
|
separator = new
|
||||||
separator_style = empty
|
separator_style = empty
|
||||||
separator_padding = 3 4
|
separator_padding = 3 4
|
||||||
|
|
||||||
button = new
|
button = new
|
||||||
button_lclick_command = ${pkgs.chromium}/bin/chromium
|
button_lclick_command = ${pkgs.chromium}/bin/chromium
|
||||||
button_icon = ${pkgs.chromium}/share/icons/hicolor/48x48/apps/chromium.png
|
button_icon = ${pkgs.chromium}/share/icons/hicolor/48x48/apps/chromium.png
|
||||||
|
|
||||||
button = new
|
button = new
|
||||||
button_lclick_command = ${pkgs.pcmanfm}/bin/pcmanfm
|
button_lclick_command = ${pkgs.pcmanfm}/bin/pcmanfm
|
||||||
button_icon = ${self}/folderIcon.svg
|
button_icon = ${self}/folderIcon.svg
|
||||||
|
|
||||||
separator = new
|
separator = new
|
||||||
separator_style = empty
|
separator_style = empty
|
||||||
separator_padding = 3 4
|
separator_padding = 3 4
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
execp = new
|
execp = new
|
||||||
execp_name = switch
|
execp_name = switch
|
||||||
execp_command = ${pkgs.xkb-switch}/bin/xkb-switch
|
execp_command = ${pkgs.xkb-switch}/bin/xkb-switch
|
||||||
execp_interval = 1
|
execp_interval = 1
|
||||||
execp_font = mono 10
|
execp_font = mono 10
|
||||||
execp_font_color = #dddddd 100
|
execp_font_color = #dddddd 100
|
||||||
execp_centered = 1
|
execp_centered = 1
|
||||||
execp_has_icon = 0
|
execp_has_icon = 0
|
||||||
execp_padding = 5 5
|
execp_padding = 5 5
|
||||||
|
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
execp = new
|
execp = new
|
||||||
execp_name = mireaweek
|
execp_name = mireaweek
|
||||||
execp_command = ${mireaweek}/bin/mireaweek
|
execp_command = ${mireaweek}/bin/mireaweek
|
||||||
execp_interval = 0
|
execp_interval = 0
|
||||||
execp_font = mono 10
|
execp_font = mono 10
|
||||||
execp_font_color = #dddddd 100
|
execp_font_color = #dddddd 100
|
||||||
execp_centered = 1
|
execp_centered = 1
|
||||||
execp_has_icon = 0
|
execp_has_icon = 0
|
||||||
execp_padding = 5 5
|
execp_padding = 5 5
|
||||||
|
|
||||||
${tint2conf2}
|
${tint2conf2}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
screenshotDir = ''"$HOME/Pictures/Screenshots"'';
|
screenshotDir = ''"$HOME/Pictures/Screenshots"'';
|
||||||
videoDir = ''"$HOME/Videos/ScreenRecords"'';
|
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
|
||||||
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
|
||||||
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}
|
||||||
mkdir -p ${screenshotDir}
|
exec ${pkgs.maim}/bin/maim "$HOME/Pictures/Screenshots/$(date +%F-%H-%M-%S).png"
|
||||||
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
|
||||||
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}
|
||||||
mkdir -p ${screenshotDir}
|
exec ${pkgs.maim}/bin/maim -s "$HOME/Pictures/Screenshots/$(date +%F-%H-%M-%S).png"
|
||||||
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
|
||||||
set -eu
|
mkdir -p "$HOME/.cache" ${videoDir}
|
||||||
mkdir -p "$HOME/.cache" ${videoDir}
|
pidfile="$HOME/.cache/mirea-screenrecord.pid"
|
||||||
pidfile="$HOME/.cache/mirea-screenrecord.pid"
|
|
||||||
|
|
||||||
if [ -f "$pidfile" ] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
|
if [ -f "$pidfile" ] && kill -0 "$(cat "$pidfile")" 2>/dev/null; then
|
||||||
kill -INT "$(cat "$pidfile")"
|
kill -INT "$(cat "$pidfile")"
|
||||||
rm -f "$pidfile"
|
rm -f "$pidfile"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
geometry="$(${pkgs.xorg.xrandr}/bin/xrandr | awk '/\*/ { print $1; exit }')"
|
geometry="$(${pkgs.xorg.xrandr}/bin/xrandr | awk '/\*/ { print $1; exit }')"
|
||||||
outfile="$HOME/Videos/ScreenRecords/$(date +%F-%H-%M-%S).mkv"
|
outfile="$HOME/Videos/ScreenRecords/$(date +%F-%H-%M-%S).mkv"
|
||||||
|
|
||||||
${pkgs.ffmpeg}/bin/ffmpeg \
|
${pkgs.ffmpeg}/bin/ffmpeg \
|
||||||
-f x11grab \
|
-f x11grab \
|
||||||
-video_size "$geometry" \
|
-video_size "$geometry" \
|
||||||
-framerate 30 \
|
-framerate 30 \
|
||||||
|
|
@ -184,12 +185,11 @@ ${pkgs.ffmpeg}/bin/ffmpeg \
|
||||||
-preset ultrafast \
|
-preset ultrafast \
|
||||||
"$outfile" >/dev/null 2>&1 &
|
"$outfile" >/dev/null 2>&1 &
|
||||||
|
|
||||||
echo $! > "$pidfile"
|
echo $! > "$pidfile"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
capturePanel = pkgs.writeShellScript "capture-panel"
|
capturePanel = pkgs.writeShellScript "capture-panel" ''
|
||||||
''
|
choice="$(${pkgs.zenity}/bin/zenity \
|
||||||
choice="$(${pkgs.zenity}/bin/zenity \
|
|
||||||
--list \
|
--list \
|
||||||
--title="Capture" \
|
--title="Capture" \
|
||||||
--column="Action" \
|
--column="Action" \
|
||||||
|
|
@ -202,7 +202,7 @@ choice="$(${pkgs.zenity}/bin/zenity \
|
||||||
"Record: region (start/stop)" \
|
"Record: region (start/stop)" \
|
||||||
--height=320 --width=520)"
|
--height=320 --width=520)"
|
||||||
|
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
"Screenshot: whole screen -> clipboard")
|
"Screenshot: whole screen -> clipboard")
|
||||||
exec ${screenshotFullClipboard}
|
exec ${screenshotFullClipboard}
|
||||||
;;
|
;;
|
||||||
|
|
@ -224,95 +224,89 @@ case "$choice" in
|
||||||
*)
|
*)
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
'';
|
'';
|
||||||
|
|
||||||
sxhkdConfig = pkgs.writeText "sxhkdrc"
|
sxhkdConfig = pkgs.writeText "sxhkdrc" ''
|
||||||
''
|
# Windows-like
|
||||||
# Windows-like
|
Print
|
||||||
Print
|
|
||||||
${screenshotFullClipboard}
|
${screenshotFullClipboard}
|
||||||
|
|
||||||
alt + Print
|
alt + Print
|
||||||
${screenshotWindowClipboard}
|
${screenshotWindowClipboard}
|
||||||
|
|
||||||
super + Print
|
super + Print
|
||||||
${screenshotFullFile}
|
${screenshotFullFile}
|
||||||
|
|
||||||
super + shift + s
|
super + shift + s
|
||||||
${screenshotRegionClipboard}
|
${screenshotRegionClipboard}
|
||||||
|
|
||||||
# macOS-like
|
# macOS-like
|
||||||
super + shift + 3
|
super + shift + 3
|
||||||
${screenshotFullFile}
|
${screenshotFullFile}
|
||||||
|
|
||||||
control + super + shift + 3
|
control + super + shift + 3
|
||||||
${screenshotFullClipboard}
|
${screenshotFullClipboard}
|
||||||
|
|
||||||
super + shift + 4
|
super + shift + 4
|
||||||
${screenshotRegionFile}
|
${screenshotRegionFile}
|
||||||
|
|
||||||
super + shift + 5
|
super + shift + 5
|
||||||
${capturePanel}
|
${capturePanel}
|
||||||
|
|
||||||
# "Run" / terminal
|
# "Run" / terminal
|
||||||
super + r
|
super + r
|
||||||
${pkgs.sakura}/bin/sakura
|
${pkgs.sakura}/bin/sakura
|
||||||
|
|
||||||
super + Return
|
super + Return
|
||||||
${pkgs.sakura}/bin/sakura
|
${pkgs.sakura}/bin/sakura
|
||||||
|
|
||||||
# tap Super only -> menu
|
# tap Super only -> menu
|
||||||
F13
|
F13
|
||||||
${jgmenu_run_prepared}
|
${jgmenu_run_prepared}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
sxhkdWrapped = pkgs.writeShellScript "sxhkd-mirea"
|
sxhkdWrapped = pkgs.writeShellScript "sxhkd-mirea" ''
|
||||||
''
|
exec ${pkgs.sxhkd}/bin/sxhkd -c ${sxhkdConfig}
|
||||||
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'
|
||||||
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}
|
||||||
${pkgs.tint2}/bin/tint2 -c ${tint2config}
|
'';
|
||||||
'';
|
|
||||||
|
|
||||||
pcmanfmdesktop = pkgs.writeShellScript "pcmanfm"
|
pcmanfmdesktop = pkgs.writeShellScript "pcmanfm" ''
|
||||||
''
|
${pkgs.pcmanfm}/bin/pcmanfm --desktop
|
||||||
${pkgs.pcmanfm}/bin/pcmanfm --desktop
|
'';
|
||||||
'';
|
|
||||||
|
|
||||||
myxinitrc = pkgs.writeText ".xinitrc"
|
myxinitrc = pkgs.writeText ".xinitrc" ''
|
||||||
''
|
${tint2custom} &
|
||||||
${tint2custom} &
|
${pcmanfmdesktop} &
|
||||||
${pcmanfmdesktop} &
|
${sxhkdWrapped} &
|
||||||
${sxhkdWrapped} &
|
${xcapeWrapped} &
|
||||||
${xcapeWrapped} &
|
exec ${pkgs.metacity}/bin/metacity
|
||||||
exec ${pkgs.metacity}/bin/metacity
|
'';
|
||||||
'';
|
|
||||||
|
|
||||||
resethome = pkgs.writeShellScript "startmireadesktop"
|
resethome = pkgs.writeShellScript "startmireadesktop" ''
|
||||||
''
|
rm -rf $HOME/{*,.*} 2> /dev/null # wipe student directory, yeah!
|
||||||
rm -rf $HOME/{*,.*} 2> /dev/null # wipe student directory, yeah!
|
printf "[client]\nport=3306\nuser=root" > /home/student/.my.cnf
|
||||||
printf "[client]\nport=3306\nuser=root" > /home/student/.my.cnf
|
echo "\set user postgres" > /home/student/.psqlrc
|
||||||
echo "\set user postgres" > /home/student/.psqlrc
|
mkdir -p "$HOME/.config/pcmanfm/default"
|
||||||
mkdir -p "$HOME/.config/pcmanfm/default"
|
cp ${desktopItems0} "$HOME/.config/pcmanfm/default/desktop-items-0.conf"
|
||||||
cp ${desktopItems0} "$HOME/.config/pcmanfm/default/desktop-items-0.conf"
|
cp ${pcmanfmConf} "$HOME/.config/pcmanfm/default/pcmanfm.conf"
|
||||||
cp ${pcmanfmConf} "$HOME/.config/pcmanfm/default/pcmanfm.conf"
|
chmod +w -R "$HOME/.config/pcmanfm/default/"
|
||||||
chmod +w -R "$HOME/.config/pcmanfm/default/"
|
cp ${mimeappsList} "$HOME/.config/mimeapps.list"
|
||||||
cp ${mimeappsList} "$HOME/.config/mimeapps.list"
|
chmod +w "$HOME/.config/mimeapps.list"
|
||||||
chmod +w "$HOME/.config/mimeapps.list"
|
mkdir -p "$HOME/.config/gtk-3.0"
|
||||||
mkdir -p "$HOME/.config/gtk-3.0"
|
printf "[Settings]\ngtk-icon-theme-name = WhiteSur" > "$HOME/.config/gtk-3.0/settings.ini"
|
||||||
printf "[Settings]\ngtk-icon-theme-name = WhiteSur" > "$HOME/.config/gtk-3.0/settings.ini"
|
cp ${myxinitrc} "$HOME/.xinitrc"
|
||||||
cp ${myxinitrc} "$HOME/.xinitrc"
|
mkdir -p "$HOME/Pictures/Screenshots" "$HOME/Videos/ScreenRecords" "$HOME/.cache"
|
||||||
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.powermenu = powermenu; # must be imported into configuration.nix!
|
||||||
packages.x86_64-linux.tint2 = tint2custom;
|
packages.x86_64-linux.tint2 = tint2custom;
|
||||||
packages.x86_64-linux.pcmanfm = pcmanfmdesktop;
|
packages.x86_64-linux.pcmanfm = pcmanfmdesktop;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue