Re: [qubes-users] Colourful prompt

2023-05-06 Thread NewRoot
> I do see this in .bashrc on Debian and there is nothing of it in .bashrc
> on Fedora. There is in fact a lot of stuff in .bashrc on Debian that is
> not there on Fedora.

I use a custom color prompt for my bash shell.  I had to use different 
methods in my Fedora and Debian qubes to get the prompt I wanted.  It's a 
little tricky because you have to check and see how the system files setup 
the $PS1 file.  Because I wanted the same definition in each of my qubes I 
ended up creating a /etc/profile.d/custom.sh file to define the prompt in 
Fedora templates to set the prompt in each appVM based on that template.  
The code  based on some adapted Debian or Ubuntu code.  There is also a 
bunch of code to setup definitions for colors and other terminal escape 
sequences.

My custom.sh produces prompt like:

[user@docker-fed-37:2 Fri 2023-05-05 17:35 GMT /etc/profile.d]$

where
user@docker-fed-37 is green
/etc/profile.d is bright_blue
the :2 represents the terminal number where numbering starts with :0


===custom.sh===

# User specific aliases and functions

term-control-colors () {
# https://mywiki.wooledge.org/BashFAQ/037
# Variables for terminal requests.
[[ -t 2 ]] && {
alt=$(  tput smcup  || tput ti  ) # Start alt display
ealt=$( tput rmcup  || tput te  ) # End   alt display
hide=$( tput civis  || tput vi  ) # Hide cursor
show=$( tput cnorm  || tput ve  ) # Show cursor
save=$( tput sc ) # Save cursor
load=$( tput rc ) # Load cursor
bold=$( tput bold   || tput md  ) # Start bold
stout=$(tput smso   || tput so  ) # Start stand-out
estout=$(   tput rmso   || tput se  ) # End stand-out
under=$(tput smul   || tput us  ) # Start underline
eunder=$(   tput rmul   || tput ue  ) # End   underline
reset=$(tput sgr0   || tput me  ) # Reset cursor
blink=$(tput blink  || tput mb  ) # Start blinking
italic=$(   tput sitm   || tput ZH  ) # Start italic
eitalic=$(  tput ritm   || tput ZR  ) # End   italic
[[ $TERM != *-m ]] && {
red=$(  tput setaf 1|| tput AF 1)
green=$(tput setaf 2|| tput AF 2)
yellow=$(   tput setaf 3|| tput AF 3)
blue=$( tput setaf 4|| tput AF 4)
bright_blue=$( tput setaf 12|| tput AF 12)
magenta=$(  tput setaf 5|| tput AF 5)
cyan=$( tput setaf 6|| tput AF 6)
# for broken termcap databases with 16 ANSI colors
# blue=$'\e[0;34m'
# green=$'\e[0;32m'
# white=$'\e[0;37m'

}
white=$(tput setaf 7|| tput AF 7)
default=$(  tput op )
eed=$(  tput ed || tput cd  )   # Erase to end of display
eel=$(  tput el || tput ce  )   # Erase to end of line
ebl=$(  tput el1|| tput cb  )   # Erase to beginning of line
ewl=$eel$ebl# Erase whole line
draw=$( tput -S <<< '   enacs
smacs
acsc
rmacs' || { \
tput eA; tput as;
tput ac; tput ae; } )   # Drawing characters
back=$'\b'
} 2>/dev/null ||:
}

# set local definitions
term-control-colors

# my_blue=$'\e[0;34m'
# my_green=$'\e[0;32m'
# my_white=$'\e[0;37m'
# my_reset=$'\e[00m'

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi

if [ "$color_prompt" = yes ]; then
PS1='[\[$green\]\u@\h\[$reset\]:\l \D{%a %F %R %Z} 
\[$bright_blue\]\w\[$reset\]]\$ '
# PS1='[\[\033[01;32m\]\u@\h\[\033[00m\]:\l \D{%a %F %R %Z} 
\[\033[01;34m\]\w\[\033[00m\]]\$ '
else
PS1='[\u@\h:\l \D{%a %F %R %Z} \w]\$ '
fi
unset color_prompt force_color_prompt

===custom.sh===


Another alternative I explored is the setup the above or similar file in 
the appVM .bashrc.d file.

Unfortunately, the Debian default overrides any $PS1 string defined 
/etc/profile.d/custom.sh so I define and export a $CUSTOM_PS1 environment 
variable and then use it appropriately in my Debian .bashrc to set the $PS1 
string.  Also note that the term-control-colors function doesn't work in 
Debian login shell and the "my_" variable definitions can be used instead.


 

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 

Re: [qubes-users] Re: Help with a small test

2023-04-24 Thread NewRoot


> I have noticed that Krusader is missing a dependency, kde-cli-tools,
> installing this should fix the above problem and then you should also
> see the error I mention about KSysoca.

After installing kde-cli-tools in the template the errors (ignoring 
gdk_atom_intern errors) change to : 
[user@krusader-fed-37 ~]$ kf.i18n: KLocalizedString: Using an empty domain, 
fix the code. msgid: "No jobs" msgid_plural: "" msgctxt: ""

14:41:50.307-warning kf.i18n unknown@0 # Trying to convert empty 
KLocalizedString to QString.
14:41:51.048-warning default unknown@0 # QDBusConnection: name 
'org.freedesktop.UDisks2' had owner '' but we thought it was ':1.41'

I don't see the KSysoca error at all, just in case you are interested.

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/70c098b0-747b-4a04-bc8f-3daafe6a1933n%40googlegroups.com.


[qubes-users] Re: Help with a small test

2023-04-24 Thread NewRoot
I performed your test with a clone of fedora-37 template.  I did get a 
dialog window requesting me to select the program to use to open the pdf 
file.  It did not remember the /usr/bin/evince path the next time after I 
browsed to it and checked the remember box when opening the pdf the first 
time.

I did not get the same error message you did when I launched krusader from 
cli.  I got the following error messages

kf.i18n: KLocalizedString: Using an empty domain, fix the code. msgid: "No 
jobs" msgid_plural: "" msgctxt: ""

(krusader:2530): Gdk-CRITICAL **: 10:23:45.254: gdk_atom_intern: assertion 
'atom_name != NULL' failed

(krusader:2530): Gdk-CRITICAL **: 10:23:45.255: gdk_atom_intern: assertion 
'atom_name != NULL' failed
10:23:45.446-warning kf.i18n unknown@0 # Trying to convert empty 
KLocalizedString to QString.

When I first launched krusader I got a popup warning with the following 
text:
No text editor plugin available
Internal editor will not work without this.
You can fix this by installing Kate:
https://kde.org/applications/utilities/org.kde.kate

After I installed kate in the appVM, just to see what would happen, I got 
the following message after loading krusader and opening the pdf the first 
time but not subsequent times.
10:43:29.756-critical default unknown@0 # "applications.menu"  not found in 
 ("/etc/xdg/menus")


On Monday, April 24, 2023 at 3:02:42 AM UTC-7 Qubes wrote:

> I am trying to get to the bottom of a problem but I need someone, 
> perhaps more than one someone, to do a small test for me to confirm 
> whether my problem is specific for me to my system or if this is a 
> general issue. I have a problem description and test request which 
> should only take a couple of minutes (1. clone template, 2. sudo dnf 
> install krusader, 3. open file from appVM using Krusader).
>
> == PROBLEM DESCRIPTION ==
>
> I have Krusader installed on a Debian 10/11 machine without any issues, 
> but, if I install Krusader on Fedora 36/37 it does not have any file 
> type associations. Which means whenever I double click, or press enter, 
> on a file it brings up the dialog window where I am supposed to be able 
> to select a program to use for the file type I am opening. This window 
> does not display any programs, which is still ok (but not normal) I can 
> point it to the program in /usr/bin to use, the problem then continues 
> in that Krusader does not save this (yes I do select the checkbox for it 
> to remember).
>
> I have also tried right clicking on a file and selecting Properties, 
> from there I select the Change button next to Open With, but the same 
> happens here, my selection does not stick.
>
> If I launch Krusader from cli I get the following output on the cli 
> window when I double click a file (when the dialog opens where I should 
> select the program to use), “15:08:53.325-warning kf.service.services 
> unknown@0 # KServiceFactory: unexpected object entry in KSycoca database 
> (type= 305 )”.
>
> I am almost certain this is because of a missing dependency but I cannot 
> figure out what dependency it is. Can anyone help with this?
>
> == END PROBLEM DESCRIPTION==
>
> == TO TEST ==
>
> I use the minimal template for all of my configs, but to rule out any 
> underlying issue with the minimal template I suggest using the Fedora 
> 36/37 template. I did the same.
>
> 1. Clone template
> 2. sudo dnf install krusader
> 3. create appVM based on above template
> 4. copy a pdf document to the appVM
> 5. open the pdf from Krusader
>
> Do you also get a dialog window requesting you to select the program to 
> use to open the file and it is empty? Or does your program list include 
> evince? If you type in the location to the program (either just "evince" 
> or /usr/bin/evince") and click to "remember", does it remember or do you 
> get the same empty program list selection window when you open the pdf 
> again?
>
> Finally, do you also see the "warning kf.service.services unknown@0 # 
> KServiceFactory: unexpected object entry in KSycoca database (type= 305 
> )” when you launch Krusader from cli?
>
> == END TEST ==
>

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/503cf334-2c73-4e33-b2ff-9d38eb0f7e9cn%40googlegroups.com.