- 1 Post
- 6 Comments
DollyDuller@programming.devto Linux@programming.dev•Help! My bash script isn't executing in my sway configEnglish1·2 months agoI’m not entirely sure how it works, but I think it’s read from top to bottom. If you need to control the order of execution, I’d suggest writing shell scripts and adding them to the config file. It should make things easier to manage.
DollyDuller@programming.devto Linux@programming.dev•Help! My bash script isn't executing in my sway configEnglish5·3 months agoFirst, make sure to include the full path to the script in your config file, like
exec /home/your_username/path/start_cmus.sh
orexec ~/path/start_cmus.sh
. If you just use./start_cmus.sh
, there will be a complaint as it doesn’t know where to look for the script.Another thing to keep in mind is that
swaymsg
is usually the better choice (man sway
) when you want to send commands to sway. You can write your script asswaymsg -t command 'workspace 10; exec wezterm -e cmus'
and then put the whole thing in your config file.To make debugging easier, I like to add some
echo
ornotify-send
commands to my script to see if it’s working as expected. I’ll put those in my config file, run it, and check if the debug commands are being executed correctly likeecho "first: $first_output" && commands && echo "second: $second_output"
. It’s a simple trick that can save you a lot of time. Also, don’t forget to check outjournalctl
for more info.
Yes, they are different because they are for different flatpak applications.
What’s in the files? Do they have a line called
sockets
? Is that line set tox11
orx11-fallback
? Have you tried adding those options likesockets=wayland;x11;x11-fallback
? I usually get an error saying I can’t connect to the display or that X is missing when I revoke access tox11
orwayland
. Or did you removex11
from your system?
It’s likely because it can’t access X11 or Wayland. To fix this, try editing the files in
/home/your_username/.local/share/flatpak/overrides/
like I mentioned earlier. Specifically, look for thesockets
line and make sure it includeswayland
,x11
, andx11-fallback
likesockets=wayland;x11;x11-fallback;
. This should help you launch flatpaks that need X11 access.
man 1 flatpak-override
Overrides the application specified runtime requirements. This can be used to grant a sandboxed application more or less resources than it requested.
By default the application gets access to the resources it requested when it is started. But the user can override it on a particular instance by specifying extra arguments to flatpak run, or every time by using flatpak override.
The application overrides are saved in text files residing in $XDG_DATA_HOME/flatpak/overrides in user mode.
Scroll down, you will see the
--reset
option to remove the overrides.I noticed you used
sudo
to run the command, so I think the override files are stored in/var/lib/flatpak/overrides/
. To get everything back to normal, try deleting everything inside that directory.If you want to override the system-wide settings, you can create files in the same format as the ones in
/var/lib/flatpak/overrides/
, but put them in/home/your_username/.local/share/flatpak/overrides/
.To generate the pre-config settings for a flatpak, you can use the
flatpak -m info app_id
command. This will show you some info about the flatpak, and the-m
option will print out the metadata. You can also save this info to a file by runningflatpak -m info app_id > ~/.local/share/flatpak/overrides/app_id
.When you edit the file, pay attention to the
Context
,System Bus Policy
, andSession Bus Policy
sections and delete everything else. By default, flatpak is set to share some resources, but you can deny access by adding an exclamation mark before the resource, for example, you could changeshared=network
toshared=!network
.If you’re looking for a user-friendly way to manage flatpak permissions, I recommend checking out
flatseal
. It’s a great GUI tool that can make it easier for you in this case.That being said, it’s always a good idea to be cautious when using commands posted online. Make sure you understand what you’re doing before copying and pasting anything into your terminal. And if you’re ever unsure about something, there are some great resources available to help you out.
One of the best places to start is the Arch wiki, and I think,
man
is a friend everybody needs!
Watching this video brought back memories of when I first started using Linux. I really connected with him. Linux makes you feel like you have a lot of control – like you can change things easily. Windows, on the other hand, often feels frustrating and doesn’t really help you much.
What I noticed about the video is that he encourages you to try new things and be willing to make mistakes. He doesn’t seem to get upset when things go wrong, which I think is helpful for viewers. He also admits that Linux isn’t for everyone, which is a realistic acknowledgement. It’s a good video for introducing Linux, but it doesn’t overhype it either.