commit 85299315382417b0addfa4c1a495b3ceffc69c4e Author: yutent Date: Mon Dec 2 17:16:13 2024 +0800 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7c9e51a --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ + +.vscode + +._* +*.deb + +.Spotlight-V100 +.Trashes +.DS_Store +.AppleDouble +.LSOverride diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..86be823 --- /dev/null +++ b/build.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +if [ -d unpack ]; then + sudo rm -rf unpack +fi + +version="1.0.3" + +mkdir -p unpack/DEBIAN + +cp debian/control unpack/DEBIAN/ +cp -r usr unpack/ + +cd unpack +find usr -type f | xargs md5sum > DEBIAN/md5sums + +_size=$(du -d 0 usr | cut -f1) + +sed -i "s/{{size}}/${_size}/" DEBIAN/control +sed -i "s/{{version}}/${version}/" DEBIAN/control + +cd .. +sudo chown -R root:root unpack/ +dpkg-deb -b unpack/ "rofi-pkexec_${version}.deb" + +sudo rm -rf unpack \ No newline at end of file diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..9c4c92d --- /dev/null +++ b/debian/control @@ -0,0 +1,13 @@ +Package: rofi-pkexec +Version: {{version}} +Architecture: all +Priority: optional +Provides: pkexec +Breaks: pkexec +Replaces: pkexec +Maintainer: Yutent +Installed-Size: {{size}} +Homepage: https://git.wkit.fun/appcat/rofi-pkexec +Author: yutent +Description: rofi版的pkexec. + 纯`bash shell + rofi`实现的pkexec, 能最大程度上适配当前用户的环境变量. diff --git a/usr/bin/pkexec b/usr/bin/pkexec new file mode 100755 index 0000000..6500d05 --- /dev/null +++ b/usr/bin/pkexec @@ -0,0 +1,6 @@ +#!/bin/bash + + +export SUDO_ASKPASS=/usr/bin/rofi-passwd + +sudo -E -A $1 "$@" \ No newline at end of file diff --git a/usr/bin/rofi-passwd b/usr/bin/rofi-passwd new file mode 100755 index 0000000..bdf8e24 --- /dev/null +++ b/usr/bin/rofi-passwd @@ -0,0 +1,3 @@ +#!/bin/bash + +rofi -dmenu -password -i -p "Enter your password" -theme password \ No newline at end of file diff --git a/usr/share/rofi/themes/colors.rasi b/usr/share/rofi/themes/colors.rasi new file mode 100644 index 0000000..91bd4a7 --- /dev/null +++ b/usr/share/rofi/themes/colors.rasi @@ -0,0 +1,22 @@ +* { + border: 0; + margin: 0; + padding: 0; + spacing: 0; + + bg: #57606fae; + fg: #f8f8f2; + dark: #39404f; + red: #bf616a; + blue: #81a1c1; + green: #a3be8c; + grey: #ffffff10; + greydim: #aeaeae; + bluea: #81a1c150; + greena: #a3be8ca0; + + background-color: @bg; + text-color: @fg; + + font: "Menlo 12"; +} diff --git a/usr/share/rofi/themes/password.rasi b/usr/share/rofi/themes/password.rasi new file mode 100644 index 0000000..0099201 --- /dev/null +++ b/usr/share/rofi/themes/password.rasi @@ -0,0 +1,54 @@ +configuration { + show-icons: false; +} + +@import "./colors.rasi" + + +window { + transparency: "real"; + width: 360px; + border-radius: 4px; + background-color: @bg; +} + +mainbox { + padding: 24px; + children: [ "inputbar", "entry", "listview"]; +} + +inputbar { + spacing: 10px; + background-color: transparent; + children: [ "textbox-prompt-colon", "prompt" ]; +} + +textbox-prompt-colon { + expand: false; + str: ""; + padding: 12px 14px; + border-radius: 50%; + background-color: @blue; +} + +prompt { + padding: 12px 16px; + border-radius: 24px; + background-color: @grey; + text-color: @fg; + vertical-align: 0.5; +} + +entry { + margin: 16px 0 0 0; + padding: 12px; + border-radius: 6px; + font: "Menlo 18px"; + background-color: @grey; + placeholder: "Type here"; +} + + +listview { + enabled: false; +} \ No newline at end of file