Ubuntu のログイン画面の壁紙を変更する
個人的には、Ubuntu 22.04のログイン画面は単調すぎると思います。また、ロック画面もあまり好きではありません。現在、Gnomeの設定ではデスクトップの壁紙しか変更できません。以前のバージョンではロック画面の壁紙も変更できたと記憶しています。調べてみたところ、ログイン画面は変更できるものの、ロック画面を変更する簡単な方法がないことがわかりました。もし方法をご存知の方がいらっしゃいましたら、メールでご連絡ください。メールアドレスは私のGitHubプロフィールに記載されています。
ログイン画面の変更手順は以下の通りです。Linuxではログイン画面はディスプレイマネージャと呼ばれ、GnomeではGNOMEディスプレイマネージャ(GDM)と呼ばれます。LightDMなど、他にもディスプレイマネージャは存在します。システムに複数のディスプレイマネージャがインストールされている場合は、選択できるのは1つだけです。さらに、これは他のソフトウェアの機能に影響を与える可能性があります。以前、LightDM に切り替えたところ、ロック画面のショートカットが機能しなくなり、GDM3 に戻らざるを得なくなったという状況に遭遇しました。
さっそく始めましょう。
1. スクリプトをダウンロードする
wget -qO - https://github.com/PRATAP-KUMAR/ubuntu-gdm-set-background/archive/main.tar.gz | tar zx --strip-components=1 ubuntu-gdm-set-background-main/ubuntu-gdm-set-background`
2. ファイル形式とヘルプ情報を確認する
スクリプトを理解している場合は、エディタで開くことができます。このスクリプトは libglib2.0-dev-bin パッケージに依存しており、このパッケージには .gresource で終わるファイルを操作できる gresource というツールが含まれています。 .gresource ファイルは、GTK-3 テーマ CSS ファイルのプリコンパイル済みバイナリデータファイルです。このスクリプトは、関連するスタイルをこのように変更します。
-
imageパラメータ: ログイン画面の壁紙を変更します。 -
colorパラメータ: ログイン画面の色を変更します(単色、画像なし)。 -
gradient horizontalパラメータ: ログイン画面を水平グラデーションカラーに変更します(左から右に向かって徐々に色が変化します)。 -
gradient verticalパラメータ: ログイン画面を垂直グラデーションカラーに変更します(説明は不要です)。
テストした結果、やはり画像の方が視覚的に魅力的です。
➜ ~ ls -al ubuntu-gdm-set-background
-rwxrwxr-x 1 mephisto mephisto 10752 Feb 3 12:41 ubuntu-gdm-set-background
➜ ~ file ubuntu-gdm-set-background
ubuntu-gdm-set-background: Bourne-Again shell script, Unicode text, UTF-8 text executable
➜ ~ ./ubuntu-gdm-set-background --help
ubuntu-gdm-set-background script (for changing Ubuntu 20.04, 21.04, 21.10 & 22.04 GDM Background) HELP
there are four options
1. background with image
2. background with color
3. background with gradient horizontal ( requires two valid hex color inputs)
4. background with gradient vertical ( requires two valid hex color inputs)
Tip: be ready with valid hex color code in place of below example like #aAbBcC or #dDeEfF. Change them to your preffered hex color codes.
you may choose colors from https://www.color-hex.com/
Example Commands:
1. sudo ./ubuntu-gdm-set-background --image /home/user/backgrounds/image.jpg
2. sudo ./ubuntu-gdm-set-background --color \#aAbBcC
3. sudo ./ubuntu-gdm-set-background --gradient horizontal \#aAbBcC \#dDeEfF
4. sudo ./ubuntu-gdm-set-background --gradient vertical \#aAbBcC \#dDeEfF
5. sudo ./ubuntu-gdm-set-background --reset
6. ./ubuntu-gdm-set-background --help
RESCUE_MODE, Example Commands:
1. $ sudo ./ubuntu-gdm-set-background --image /home/user/backgrounds/image.jpg rescue
2. $ sudo ./ubuntu-gdm-set-background --color \#aAbBcC rescue
3. $ sudo ./ubuntu-gdm-set-background --gradient horizontal \#aAbBcC \#dDeEfF rescue
4. $ sudo ./ubuntu-gdm-set-background --gradient vertical \#aAbBcC \#dDeEfF rescue
Why RESCUE_MODE?
It is when you try to change the background with some other scripts and then interacted with this script,
there will be some conflicts. In case you ran other scripts to change the background and then tried this script,
found conflicts? then add 'rescue' to the end of the command as mentiond above.
Please note that for 'RESCUE_MODE' active internet connection is necessary
3. ログイン画面の背景画像(一般的に壁紙と呼ばれます)を変更します。
使用したい画像のフルパスを入力してください。変更は再度ログインすることで反映されますので、お早めにご登録ください。
➜ ~ sudo ./ubuntu-gdm-set-background --image ~/Pictures/th.jpeg
😕 Seems 'background change is successful'
Changes will be effective after a Reboot (CTRL+ALT+F1 may show the changes immediately)
If something went wrong, log on to tty and run the below command
$ sudo update-alternatives --quiet --set gdm-theme.gresource /usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource
4. 復元するには
sudo ./ubuntu-gdm-set-background --reset
これでログイン画面は修正されますが、不適切な操作によって再び画面が破損するリスクが依然としてあります。その場合、唯一の解決策はリモート接続して対応するファイルを探し、復元することです。そのため、公式開発者がGnomeの設定で関連する設定オプションを提供することが望ましいと思われます。
また、Bing検索のホームページには壁紙として使用できる日替わり画像が用意されており、非常に便利です。
著作権に関する声明:
- 出典のないコンテンツはすべてオリジナルです。、無断転載はご遠慮ください(転載後にレイアウトが崩れたり、内容が制御不能になったり、継続的に更新できない等の理由から)。
- このブログのコンテンツを非営利目的で解釈したい場合は、(読者の便宜のため)「オリジナル ソース」または「参照リンク」の形式でこのサイトの関連 Web ページ アドレスを提供してください。