Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
package-helpers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
trisquel
package-helpers
Commits
494e5075
Commit
494e5075
authored
9 years ago
by
Frank
Browse files
Options
Downloads
Patches
Plain Diff
Enhancing the behaviour of the script
parent
558784cc
No related branches found
Branches containing commit
No related tags found
1 merge request
!106
Belenos
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
helpers/DATA/compton/trisquel-compton-switcher
+113
-113
113 additions, 113 deletions
helpers/DATA/compton/trisquel-compton-switcher
with
113 additions
and
113 deletions
helpers/DATA/compton/trisquel-compton-switcher
+
113
−
113
View file @
494e5075
#!/bin/bash
DONT_SUPPORT_3D
=
"Your machine does not support 3D acceleration"
if
[
$LANG
=
es_ES.UTF-8
]
;
then
DONT_SUPPORT_3D
=
"Su equipo no soporta aceleración 3D"
fi
# First, check if the computer
# supports 3D acceleration. If not, it
# it informs the user and then exits.
[
0
=
$(
glxinfo |grep
"renderer string:"
|grep
-v
llvmpipe |
wc
-c
)
]
&&
zenity
\
--info
--text
=
"
$DONT_SUPPORT_3D
"
&&
exit
0
# Check if compton is currently running.
case
"
$(
pgrep
-u
$USER
compton |
wc
-w
)
"
in
0
)
COMPTON_RUNNING
=
false
;;
1
)
COMPTON_RUNNING
=
true
;;
esac
if
$COMPTON_RUNNING
;
then
COMPTON
=
true
DISCOMPTON
=
false
elif
!
$COMPTON_RUNNING
;
then
COMPTON
=
false
DISCOMPTON
=
true
fi
# The text that will be showed to the user.
TEXT
=
"Use Compton compositor if 3d acceleration available"
TITLE
=
"Choose between enabling or disabling Compton"
COMPTON_ENABLED
=
"Compton enabled"
COMPTON_DISABLED
=
"Compton disabled"
INFO
=
"Compton is already running"
#Checks the languange of the system (more can be added in the future) and displays the text corresponding to the language selected.
if
[
$LANG
=
es_ES.UTF-8
]
;
then
TEXT
=
"Usar el compositor Compton si el equipo soporta aceleración 3D"
TITLE
=
"Seleccionar entre habilitar o deshabilitar los efectos de Compton"
COMPTON_ENABLED
=
"Compton habilitado"
COMPTON_DISABLED
=
"Compton deshabilitado"
INFO
=
"Compton ya se encuentra en ejecución"
fi
# Zenity is summoned to interact with the user.
# The XOR with the "exit 0" means that the script
# will exit with no error if zenity is "canceled"
# (user clicking on the "cancel" button, for
# instance).
ans
=
$(
zenity
--list
--hide-header
\
--title
"
$TITLE
"
\
--text
"
$TEXT
"
\
--radiolist
\
--column
""
--column
""
\
$COMPTON
"
$COMPTON_ENABLED
"
\
$DISCOMPTON
"
$COMPTON_DISABLED
"
||
exit
0
)
# Evaluate if compton is runnning or not, if it does,
# warn the user if he/she tries to run compton again
# or disable the compositor if he/she select to disable
# it. If compton is not running, run and enable it if
# the user selects to do so:
# .-----------------.
# | |
# | |
# | Compton running |
# | |
# | |
# '-----------------'
# |
# | .-----------------. .-----------------.
# |-->| User selects no |-->| Disable compton |
# | '-----------------' '-----------------'
# | .------------------. .-----------------.
# '-->| User selects yes |->| Inform the user |
# '------------------' '-----------------'
# .---------------------.
# | |
# | |
# | Compton not running |
# | |
# | |
# '---------------------'
# |
# | .-----------------. .------------.
# |-->| User selects no |-->| Do nothing |
# | '-----------------' '------------'
# | .------------------. .-----------------.
# '-->| User selects yes |-->| Enable compton |
# '------------------' '-----------------'
if
$COMPTON_RUNNING
# Compton running
then
if
[[
$ans
==
$COMPTON_DISABLED
]]
;
then
touch
$HOME
/.config/disable-compton
killall compton
elif
[[
$ans
==
$COMPTON_ENABLED
]]
;
then
zenity
--info
--text
=
"
Compton is already running"
fi
else
# Compton not running
if
[[
$ans
==
$COMPTON_ENABLED
]]
;
then
rm
-f
$HOME
/.config/disable-compton
compton-launcher
else
exit
0
fi
fi
#!/bin/bash
DONT_SUPPORT_3D
=
"Your machine does not support 3D acceleration"
if
[
$LANG
=
es_ES.UTF-8
]
;
then
DONT_SUPPORT_3D
=
"Su equipo no soporta aceleración 3D"
fi
# First, check if the computer
# supports 3D acceleration. If not, it
# it informs the user and then exits.
[
0
=
$(
glxinfo |grep
"renderer string:"
|grep
-v
llvmpipe |
wc
-c
)
]
&&
zenity
\
--info
--text
=
"
$DONT_SUPPORT_3D
"
&&
exit
0
# Check if compton is currently running.
case
"
$(
pgrep
-u
$USER
compton |
wc
-w
)
"
in
0
)
COMPTON_RUNNING
=
false
;;
1
)
COMPTON_RUNNING
=
true
;;
esac
if
$COMPTON_RUNNING
;
then
COMPTON
=
true
DISCOMPTON
=
false
elif
!
$COMPTON_RUNNING
;
then
COMPTON
=
false
DISCOMPTON
=
true
fi
# The text that will be showed to the user.
TEXT
=
"Use Compton compositor if 3d acceleration available"
TITLE
=
"Choose between enabling or disabling Compton"
COMPTON_ENABLED
=
"Compton enabled"
COMPTON_DISABLED
=
"Compton disabled"
INFO
=
"Compton is already running"
#Checks the languange of the system (more can be added in the future) and displays the text corresponding to the language selected.
if
[
$LANG
=
es_ES.UTF-8
]
;
then
TEXT
=
"Usar el compositor Compton si el equipo soporta aceleración 3D"
TITLE
=
"Seleccionar entre habilitar o deshabilitar los efectos de Compton"
COMPTON_ENABLED
=
"Compton habilitado"
COMPTON_DISABLED
=
"Compton deshabilitado"
INFO
=
"Compton ya se encuentra en ejecución"
fi
# Zenity is summoned to interact with the user.
# The XOR with the "exit 0" means that the script
# will exit with no error if zenity is "canceled"
# (user clicking on the "cancel" button, for
# instance).
ans
=
$(
zenity
--list
--hide-header
\
--title
"
$TITLE
"
\
--text
"
$TEXT
"
\
--radiolist
\
--column
""
--column
""
\
$COMPTON
"
$COMPTON_ENABLED
"
\
$DISCOMPTON
"
$COMPTON_DISABLED
"
||
exit
0
)
# Evaluate if compton is runnning or not, if it does,
# warn the user if he/she tries to run compton again
# or disable the compositor if he/she select to disable
# it. If compton is not running, run and enable it if
# the user selects to do so:
# .-----------------.
# | |
# | |
# | Compton running |
# | |
# | |
# '-----------------'
# |
# | .-----------------. .-----------------.
# |-->| User selects no |-->| Disable compton |
# | '-----------------' '-----------------'
# | .------------------. .-----------------.
# '-->| User selects yes |->| Inform the user |
# '------------------' '-----------------'
# .---------------------.
# | |
# | |
# | Compton not running |
# | |
# | |
# '---------------------'
# |
# | .-----------------. .------------.
# |-->| User selects no |-->| Do nothing |
# | '-----------------' '------------'
# | .------------------. .-----------------.
# '-->| User selects yes |-->| Enable compton |
# '------------------' '-----------------'
if
$COMPTON_RUNNING
# Compton running
then
if
[[
$ans
==
$COMPTON_DISABLED
]]
;
then
touch
$HOME
/.config/disable-compton
killall compton
elif
[[
$ans
==
$COMPTON_ENABLED
]]
;
then
zenity
--info
--text
=
"
$INFO
"
fi
else
# Compton not running
if
[[
$ans
==
$COMPTON_ENABLED
]]
;
then
rm
-f
$HOME
/.config/disable-compton
compton-launcher
else
exit
0
fi
fi
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment